test: add independent FP16 FMA regression tests #339
No reviewers
Labels
No labels
accessibility
bloqué : binaire console
bug
chargeur
console-dll
cpu
documentation
duplicate
enhancement
good first issue
gpu
help wanted
invalid
performance
question
runtime-gdk
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/LooperSalty--AnyXboxX!339
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-339"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@GravynChips on GitHub · 2026-11-26 07:28 UTC · original
<html>GravynChips:test/fp16-independent-fma-v2→main· +124 −0 · 1 files · 1 commits · openChange
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 | 0Test commands and results
NVIDIA hardware
$env:ANYXBOXX_GPU = "RTX 4070"python -m pytest -v -s tests/test_rdna2_f16_independent.pyResult: 2 passed in 0.71s.
Microsoft WARP
$env:ANYXBOXX_GPU = "warp"python -m pytest -v -s tests/test_rdna2_f16_independent.pyResult: 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 FullNamepython -m pytest -v @fp16TestsResult: 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 -raResult: 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 toolsResult: All checks passed!
README synchronisation
python -m pytest -v tests/test_readme_sync.pyResult: 9 passed, 1 skipped in 0.07s.
Test collection
python -m pytest --collect-only -qResult: 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
F16FmaHLSL 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>View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.