fix: lower binary64 class comparisons in VIctory #313

Open
github-bot wants to merge 3 commits from github-bot/gh-313 into main AGit
Owner

@⁠mauroalvare on GitHub · 2026-11-26 02:19 UTC · original
mauroalvare:codex/victory-f64-class → main · +117 −26 · 2 files · 3 commits · open

Change

Neptune's RDNA 2 recompiler decoded v_cmp_class_f64 and v_cmpx_class_f64, then reported Unsupported when either comparison fed a live result. That stopped DXIL emission before the D3D12 compute pipeline could be created.

Extend the existing IEEE class lowering to use both dwords of a binary64 operand. The low dword participates in the fraction zero check, so a signaling NaN with a low-word payload and the smallest subnormal classify correctly. The operand reader applies abs and neg to the sign bit and sign-extends inline integer constants. The comparison uses i32 operations throughout and writes its result through the existing lane-mask or EXEC path.

This is the Rust DXIL emitter used by third_party/victory when launched through tools/lancer_victory.ps1.

Verification

Base c4c93bdc413191a9dc909998d2d53080a3f0c880. Fix a318d64335e02f823f60ea7c65d34111094d22fb.

From third_party/victory:

cargo test --locked --offline -j 2 -p victory-shader --lib class_f64 -- --nocapture --test-threads=1
Base plus regression tests: 0 passed, 4 failed at lowering (Unsupported), 244 filtered out.
Fix: 4 passed, 0 failed, 0 ignored, 244 filtered out.

cargo test --locked --offline -p victory-shader -- --nocapture --test-threads=1
246 passed, 0 failed, 2 ignored. Doc-tests passed.

cargo test --locked --offline -p victory-loader --test load_probe
2 passed, 0 failed.

cargo xtask policy
asset policy: 200 files ok

The new tests validated the DXIL with the Windows SDK validator (1.8.2502.11), created the D3D12 pipelines, and read back all 38 wave32 cases on the RTX 5070 Ti (driver 621.40, 32-lane waves) and on WARP (4-lane waves). On the RTX, a paired wave64 shader also matched all 64 console lanes for each of two EXEC masks.

The shader suite's existing skips include two ignored cases, four console-compiler comparisons that returned early, and two adapter-specific subcases in the wave-sum tests.

From the repository root, using the built runtime, TomBox DLLs, SDK DXC and the RTX 5070 Ti:

cmake -S runtime -B runtime/build -A x64
cmake --build runtime/build --config Release --parallel 2
cargo build --release --locked --manifest-path rust/Cargo.toml
cargo test --release --locked --manifest-path rust/Cargo.toml   -> 12 tests passed
python tools/build_tombox.py                                   -> 10 DLLs built
python -m pytest -rs                                           -> 1665 passed, 0 skipped (165.56 s, Python 3.13.15)
python -m ruff check --select W605,F,E9 PrototypeScarlett tests tools
All checks passed!

Oracle and test data

The new tests construct shader words and register inputs in the test source. All ten expected IEEE classes follow AMD's RDNA 2 ISA, and the Python reference interpreter agreed on all twelve binary64 patterns and four constant operands. The encoding was cross-checked against LLVM's GFX10 assembler tests. AMD RDNA 2 ISA, §12.9 · LLVM VOPC e64 tests · LLVM CMPX tests

  • One behavior with regression tests that fail on the base.
  • Synthetic fixtures only. Sources and exact verification commands are recorded above.

AI assistance from OpenAI Codex for investigation, implementation, and testing.

**@⁠mauroalvare** on GitHub · 2026-11-26 02:19 UTC · [original](https://github.com/LooperSalty/AnyXboxX/pull/313) `mauroalvare:codex/victory-f64-class` → `main` · +117 −26 · 2 files · 3 commits · open ## Change Neptune's RDNA 2 recompiler decoded `v_cmp_class_f64` and `v_cmpx_class_f64`, then reported `Unsupported` when either comparison fed a live result. That stopped DXIL emission before the D3D12 compute pipeline could be created. Extend the existing IEEE class lowering to use both dwords of a binary64 operand. The low dword participates in the fraction zero check, so a signaling NaN with a low-word payload and the smallest subnormal classify correctly. The operand reader applies abs and neg to the sign bit and sign-extends inline integer constants. The comparison uses i32 operations throughout and writes its result through the existing lane-mask or EXEC path. This is the Rust DXIL emitter used by `third_party/victory` when launched through `tools/lancer_victory.ps1`. ## Verification Base `c4c93bdc413191a9dc909998d2d53080a3f0c880`. Fix `a318d64335e02f823f60ea7c65d34111094d22fb`. From `third_party/victory`: ```text cargo test --locked --offline -j 2 -p victory-shader --lib class_f64 -- --nocapture --test-threads=1 Base plus regression tests: 0 passed, 4 failed at lowering (Unsupported), 244 filtered out. Fix: 4 passed, 0 failed, 0 ignored, 244 filtered out. cargo test --locked --offline -p victory-shader -- --nocapture --test-threads=1 246 passed, 0 failed, 2 ignored. Doc-tests passed. cargo test --locked --offline -p victory-loader --test load_probe 2 passed, 0 failed. cargo xtask policy asset policy: 200 files ok ``` The new tests validated the DXIL with the Windows SDK validator (1.8.2502.11), created the D3D12 pipelines, and read back all 38 wave32 cases on the RTX 5070 Ti (driver 621.40, 32-lane waves) and on WARP (4-lane waves). On the RTX, a paired wave64 shader also matched all 64 console lanes for each of two EXEC masks. The shader suite's existing skips include two ignored cases, four console-compiler comparisons that returned early, and two adapter-specific subcases in the wave-sum tests. From the repository root, using the built runtime, TomBox DLLs, SDK DXC and the RTX 5070 Ti: ```text cmake -S runtime -B runtime/build -A x64 cmake --build runtime/build --config Release --parallel 2 cargo build --release --locked --manifest-path rust/Cargo.toml cargo test --release --locked --manifest-path rust/Cargo.toml -> 12 tests passed python tools/build_tombox.py -> 10 DLLs built python -m pytest -rs -> 1665 passed, 0 skipped (165.56 s, Python 3.13.15) python -m ruff check --select W605,F,E9 PrototypeScarlett tests tools All checks passed! ``` ## Oracle and test data The new tests construct shader words and register inputs in the test source. All ten expected IEEE classes follow AMD's RDNA 2 ISA, and the Python reference interpreter agreed on all twelve binary64 patterns and four constant operands. The encoding was cross-checked against LLVM's GFX10 assembler tests. [AMD RDNA 2 ISA, §12.9](https://docs.amd.com/api/khub/documents/Et~wpu9g~Ffl7d9q0QZ~Og/content) · [LLVM VOPC e64 tests](https://github.com/llvm/llvm-project/blob/main/llvm/test/MC/AMDGPU/gfx10_asm_vopc_e64.s) · [LLVM CMPX tests](https://github.com/llvm/llvm-project/blob/main/llvm/test/MC/AMDGPU/gfx10_asm_vopcx.s) - [x] One behavior with regression tests that fail on the base. - [x] Synthetic fixtures only. Sources and exact verification commands are recorded above. AI assistance from OpenAI Codex for investigation, implementation, and testing.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:42:45 +00:00
This pull request can be merged automatically.
This branch is out-of-date with the base branch
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/313/head:github-bot/gh-313'
git switch 'github-bot/gh-313'

Merge

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