Update Benchstones (BenchI & BenchF) to validate results #125383
Update Benchstones (BenchI & BenchF) to validate results #125383abdulrahmanhossam wants to merge 4 commits intodotnet:mainfrom
Conversation
|
Hi @EgorBo, Thanks for the feedback. Regarding the indentation changes, these were automatically applied by the IDE's formatter on save to adhere to standard C# styles. I understand this makes the diff noisier than intended, so I will revert the unnecessary styling changes and keep the focus strictly on the validation logic. As for the "magic numbers," these are the mathematically expected reference values for these specific algorithms (e.g., the Lorenz attractor's steady state or the Plastic Ratio for root-finding). While these tests do catch JIT asserts, adding correctness validation ensures that the JIT isn't just "running" the code, but generating correct numerical output—which is the core purpose of #5049. I will clean up the PR by:
I believe even for a first-time contributor, ensuring the correctness of these long-standing benchmarks is a valuable goal. Updated commits coming soon. |
…ers with descriptive constants/boundaries
|
Closing this for now, might revisit later |

Fixes #5049
This PR completes the correctness validation for the BenchI (Integer) and BenchF (Floating Point) suites. Previously, many of these benchmarks only measured performance while silently returning
true. This update ensures that the JIT compiler produces mathematically correct results without affecting the benchmark's performance profile by using O(1) post-loop checks.Key Changes:
1. BenchI (Integer) Suite
a[200][200]resolves correctly after overflow).900jkmathematical derivation for the result matrix.2. BenchF (Floating Point) Suite
Bisect,NewtR,Regula,Secant,NewtE): Added validation for the final roots of the equations. For example, verifying the Plastic Ratio (Romber,Simpsn,Trap): Verified the definite integral results forInvMt,MatInv4,SqMtx): Added checks for matrix inversion accuracy by verifying the resulting Identity Matrix and Bit Error Rate (BER).Lorenz,FFT,DMath): Validated final attractor coordinates for Lorenz and frequency domain components (DC offset) for FFT.Exp(Log(x))transformations in Module 11 to ensure identity stability.Technical Implementation Details:
1e-5to1e-10) to account for precision differences across different hardware architectures (x64, ARM64).gotoerror labels (e.g., inMatInv4) to returnfalseupon numerical failure instead of a silenttrue, ensuring test reliability.Adams,InProd, andLLoops) were kept as-is to maintain original logic.Checklist: