test: add independent FP16 FMA regression tests #339

Open
github-bot wants to merge 1 commit from github-bot/gh-339 into main AGit
Owner

@⁠GravynChips on GitHub · 2026-11-26 07:28 UTC · original
GravynChips:test/fp16-independent-fma-v2 → main · +124 −0 · 1 files · 1 commits · open

<html>

Change

Adds independent numerical regression tests for finite binary16 fused multiply-add (FMA), following the FP16 correctness investigation in #115 and the implementations merged through #218 and #219.

The tests use an exact signed-integer oracle, independent of both the reference interpreter and HLSL arithmetic helpers.

Coverage includes 65,536 deterministic operand triples:

  • Single rounding to nearest-even.

  • Double-rounding-sensitive midpoint cases.

  • Gradual underflow and subnormal operands.

  • Signed zero and exact cancellation.

  • Overflow boundaries.

  • Seeded random finite operands.

This is a test-only contribution. No production arithmetic code is modified.

Linked issue: Refs #115

Verification

Tested against upstream commit c4c93bd.

Contribution commit: ee4fb01.

Environment:

  • Windows x64

  • Python 3.13.17

  • Visual Studio 2026 / MSVC 19.52

  • NVIDIA GeForce RTX 4070 SUPER

  • NVIDIA driver 617.14

  • Microsoft D3D12 WARP

Independent arithmetic validation

Backend | Comparisons | Mismatches -- | -- | -- CPU interpreter | 65,536 | 0 NVIDIA RTX 4070 SUPER | 65,536 | 0 Microsoft WARP | 65,536 | 0 Total | 196,608 | 0

Test commands and results

NVIDIA hardware

$env:ANYXBOXX_GPU = "RTX 4070"

python -m pytest -v -s tests/test_rdna2_f16_independent.py

Result: 2 passed in 0.71s.

Microsoft WARP

$env:ANYXBOXX_GPU = "warp"

python -m pytest -v -s tests/test_rdna2_f16_independent.py

Result: 2 passed in 0.41s.

FP16 regression suite — NVIDIA hardware

$env:ANYXBOXX_GPU = "RTX 4070"

$fp16Tests = Get-ChildItem tests\test_rdna2*f16*.py | Select-Object -ExpandProperty FullName

python -m pytest -v @⁠fp16Tests

Result: 143 passed, 5 warnings in 5.66s.

Broader regression suite

python -m pytest -q --ignore=tests/test_lanceur_victory.py --ignore=tests/test_launcher.py --tb=short -ra

Result: 1453 passed, 176 skipped, 5 warnings in 72.22s (0:01:12).

The two launcher modules were excluded as a precaution following an antivirus quarantine of generated mock executables during previous testing. The complete C++ and Rust runtimes and some optional tools were not built or installed, accounting for skipped tests. The D3D12 GPU runner was built successfully.

The five warnings concern existing pytest parameterisation deprecations.

Lint

python -m ruff check --select W605,F,E9 PrototypeScarlett tests tools

Result: All checks passed!

README synchronisation

python -m pytest -v tests/test_readme_sync.py

Result: 9 passed, 1 skipped in 0.07s.

Test collection

python -m pytest --collect-only -q

Result: 1667 tests collected in 1.42s.

The rounded README test count remains unchanged at 1600+.

Oracle and test data

Every finite binary16 operand is represented exactly as a signed integer in units of 2^-24. Multiplication and addition are performed exactly in units of 2^-48, followed by a single rounding step using a precomputed binary16 representable-value grid and nearest-even tie breaking.

All test inputs are generated synthetically within the test module and are contributed under the repository's licence.

The GPU test directly exercises the production F16Fma HLSL helper. This isolates arithmetic correctness from instruction decoding and translation.

The regression targets double rounding that can occur when an intermediate FP32 result is subsequently rounded to FP16. It protects the existing correction rather than introducing a new production fix.

Scope is limited to finite-input FMA with nearest-even rounding and gradual underflow. Physical RDNA 2 hardware equivalence has not been tested.

Checklist

  • The PR covers a single reviewable behaviour.

  • A test fails without this change and passes with it. (Test-only contribution protecting existing corrected behaviour.)

  • The commands and results of each check are given above.

  • No fake success or changes to unimplemented functions.

  • README consistency maintained across all nine languages.

  • No game, console or SDK file, no key, no dump, no download link.

  • No findings or data extracted from a commercial title.

  • No external project code imported.

AI assistance

ChatGPT assisted with mathematical analysis, test development and review. All reported Windows, NVIDIA hardware and WARP validation was performed locally by the contributor.

</html>
**@⁠GravynChips** on GitHub · 2026-11-26 07:28 UTC · [original](https://github.com/LooperSalty/AnyXboxX/pull/339) `GravynChips:test/fp16-independent-fma-v2` → `main` · +124 −0 · 1 files · 1 commits · open <html> <body> <!--StartFragment--><h2><span>Change</span></h2><p><span>Adds independent numerical regression tests for finite binary16 fused multiply-add (FMA), following the FP16 correctness investigation in #115 and the implementations merged through #218 and #219.</span></p><p><span>The tests use an exact signed-integer oracle, independent of both the reference interpreter and HLSL arithmetic helpers.</span></p><p><span>Coverage includes 65,536 deterministic operand triples:</span></p><ul><li><p><span>Single rounding to nearest-even.</span></p></li><li><p><span>Double-rounding-sensitive midpoint cases.</span></p></li><li><p><span>Gradual underflow and subnormal operands.</span></p></li><li><p><span>Signed zero and exact cancellation.</span></p></li><li><p><span>Overflow boundaries.</span></p></li><li><p><span>Seeded random finite operands.</span></p></li></ul><p><span>This is a test-only contribution. No production arithmetic code is modified.</span></p><p><span>Linked issue: Refs #115</span></p><h2><span>Verification</span></h2><p><span>Tested against upstream commit </span><code><span>c4c93bd</span></code><span>.</span></p><p><span>Contribution commit: </span><code><span>ee4fb01</span></code><span>.</span></p><p><span>Environment:</span></p><ul><li><p><span>Windows x64</span></p></li><li><p><span>Python 3.13.17</span></p></li><li><p><span>Visual Studio 2026 / MSVC 19.52</span></p></li><li><p><span>NVIDIA GeForce RTX 4070 SUPER</span></p></li><li><p><span>NVIDIA driver 617.14</span></p></li><li><p><span>Microsoft D3D12 WARP</span></p></li></ul><h3><span>Independent arithmetic validation</span></h3> Backend | Comparisons | Mismatches -- | -- | -- CPU interpreter | 65,536 | 0 NVIDIA RTX 4070 SUPER | 65,536 | 0 Microsoft WARP | 65,536 | 0 Total | 196,608 | 0 <h3><span>Test commands and results</span></h3><p><strong><span>NVIDIA hardware</span></strong></p><p><code><span>$env:ANYXBOXX_GPU = "RTX 4070"</span></code></p><p><code><span>python -m pytest -v -s tests/test_rdna2_f16_independent.py</span></code></p><p><span>Result: 2 passed in 0.71s.</span></p><p><strong><span>Microsoft WARP</span></strong></p><p><code><span>$env:ANYXBOXX_GPU = "warp"</span></code></p><p><code><span>python -m pytest -v -s tests/test_rdna2_f16_independent.py</span></code></p><p><span>Result: 2 passed in 0.41s.</span></p><p><strong><span>FP16 regression suite — NVIDIA hardware</span></strong></p><p><code><span>$env:ANYXBOXX_GPU = "RTX 4070"</span></code></p><p><code><span>$fp16Tests = Get-ChildItem tests\test_rdna2*f16*.py | Select-Object -ExpandProperty FullName</span></code></p><p><code><span>python -m pytest -v @⁠fp16Tests</span></code></p><p><span>Result: 143 passed, 5 warnings in 5.66s.</span></p><p><strong><span>Broader regression suite</span></strong></p><p><code><span>python -m pytest -q --ignore=tests/test_lanceur_victory.py --ignore=tests/test_launcher.py --tb=short -ra</span></code></p><p><span>Result: 1453 passed, 176 skipped, 5 warnings in 72.22s (0:01:12).</span></p><p><span>The two launcher modules were excluded as a precaution following an antivirus quarantine of generated mock executables during previous testing. The complete C++ and Rust runtimes and some optional tools were not built or installed, accounting for skipped tests. The D3D12 GPU runner was built successfully.</span></p><p><span>The five warnings concern existing pytest parameterisation deprecations.</span></p><p><strong><span>Lint</span></strong></p><p><code><span>python -m ruff check --select W605,F,E9 PrototypeScarlett tests tools</span></code></p><p><span>Result: All checks passed!</span></p><p><strong><span>README synchronisation</span></strong></p><p><code><span>python -m pytest -v tests/test_readme_sync.py</span></code></p><p><span>Result: 9 passed, 1 skipped in 0.07s.</span></p><p><strong><span>Test collection</span></strong></p><p><code><span>python -m pytest --collect-only -q</span></code></p><p><span>Result: 1667 tests collected in 1.42s.</span></p><p><span>The rounded README test count remains unchanged at 1600+.</span></p><h2><span>Oracle and test data</span></h2><p><span>Every finite binary16 operand is represented exactly as a signed integer in units of 2^-24. Multiplication and addition are performed exactly in units of 2^-48, followed by a single rounding step using a precomputed binary16 representable-value grid and nearest-even tie breaking.</span></p><p><span>All test inputs are generated synthetically within the test module and are contributed under the repository's licence.</span></p><p><span>The GPU test directly exercises the production </span><code><span>F16Fma</span></code><span> HLSL helper. This isolates arithmetic correctness from instruction decoding and translation.</span></p><p><span>The regression targets double rounding that can occur when an intermediate FP32 result is subsequently rounded to FP16. It protects the existing correction rather than introducing a new production fix.</span></p><p><span>Scope is limited to finite-input FMA with nearest-even rounding and gradual underflow. Physical RDNA 2 hardware equivalence has not been tested.</span></p><h2><span>Checklist</span></h2><ul><li><span><input type="checkbox" disabled="" checked=""></span><div><p><span>The PR covers a single reviewable behaviour.</span></p></div></li><li><span><input type="checkbox" disabled=""></span><div><p><span>A test fails without this change and passes with it. (Test-only contribution protecting existing corrected behaviour.)</span></p></div></li><li><span><input type="checkbox" disabled="" checked=""></span><div><p><span>The commands and results of each check are given above.</span></p></div></li><li><span><input type="checkbox" disabled="" checked=""></span><div><p><span>No fake success or changes to unimplemented functions.</span></p></div></li><li><span><input type="checkbox" disabled="" checked=""></span><div><p><span>README consistency maintained across all nine languages.</span></p></div></li><li><span><input type="checkbox" disabled="" checked=""></span><div><p><span>No game, console or SDK file, no key, no dump, no download link.</span></p></div></li><li><span><input type="checkbox" disabled="" checked=""></span><div><p><span>No findings or data extracted from a commercial title.</span></p></div></li><li><span><input type="checkbox" disabled="" checked=""></span><div><p><span>No external project code imported.</span></p></div></li></ul><h2><span>AI assistance</span></h2><p><span>ChatGPT assisted with mathematical analysis, test development and review. All reported Windows, NVIDIA hardware and WARP validation was performed locally by the contributor.</span></p><!--EndFragment--> </body> </html>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 07:31:11 +00:00
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/339/head:github-bot/gh-339'
git switch 'github-bot/gh-339'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-339'
git switch 'github-bot/gh-339'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-339'
git switch 'github-bot/gh-339'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-339'
git switch 'main'
git merge --squash 'github-bot/gh-339'
git switch 'main'
git merge --ff-only 'github-bot/gh-339'
git switch 'main'
git merge 'github-bot/gh-339'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.