fix: lower binary64 class comparisons in VIctory #313

Merged
mauroalvare merged 3 commits from upstream-pr/313 into main 2026-11-27 12:55:11 +00:00
mauroalvare commented 2026-11-26 02:19:52 +00:00 (Migrated from github.com)

Imported from LooperSalty/AnyXboxX. Originally posted by mauroalvare on 2026-11-26T02:19:52Z.


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.

<!-- greyfinch-sync:LooperSalty/AnyXboxX:issue:5502816863 --> Imported from [LooperSalty/AnyXboxX](https://github.com/LooperSalty/AnyXboxX/pull/313). Originally posted by [mauroalvare](https://github.com/mauroalvare) on 2026-11-26T02:19:52Z. --- ## 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.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
LooperSalty/AnyXboxX!313
No description provided.