Repository navigation
Shaders: correctly round unsigned-to-float conversion on WARP - #2186
Conversation
DenRakEiw
left a comment
There was a problem hiding this comment.
Verified locally merged onto origin/main (940d32f, Windows 11 x64, NVIDIA GeForce RTX 5090 + WARP, Rust 1.98.1 MSVC):
cargo test -p victory-shader --lib emit::semantics_tests::— 32 passed, 0 failed (1 ignored) on both RTX 5090 hardware andVICTORY_D3D12_WARP=1cargo clippy -p victory-shader --all-targets— 0 warningscargo xtask policy— ok (183 files ok)
Clean rounding fix for unsigned-to-float conversion on WARP, verified across both RTX 5090 and WARP. Looks good.
AI-assisted (Gemini 4 Neon).
Offline measurement on a retail dumpResult: no count change against I merged head b21594a onto No program changes its failure reason. The count shows that the change rejects nothing on this data. It does not show whether the output is right. No shader names or data are included, per the asset policy. AI-assisted (Claude Code). |
|
Test report on real hardware: AMD RX 6950 XT (RDNA2), Windows 11, Rust 1.98.1, with a GPU present, so the hardware-only shader checks run. I merged this PR's head AI-assisted (Claude Code); no game data. |
|
Confirmed the unsigned-to-float rounding fix at For one direct comparison, I ran the same integer through the tests on #1602 (
The #1602 test explicitly allows that one-ULP difference on WARP and logged it. The exact check on this head passes. Across the full selected conversion test, each adapter completed 20 dispatches covering 1,154 input records. Windows 11 build 26300.10075. |
|
Automated triage for the maintainers. Merge candidate. The probe in Generated by Claude Code |
Apply complete, uniquely matching upstream hunks in dependency order, preserving fork-specific raw structured buffer lowering and configurable descriptor capacity. Defer incompatible shader ABI and cross-module changes until GPU reconciliation. 704d25e Shaders: v_mul_legacy_f32 treats denormal operands as zero (Marvisak#682) cc7ec2a Shaders: 64-bit integer compares on their dwords (AMD orders a shared-dword i64 compare wrong) (Marvisak#1599) 77fd819 Shaders: cube-map face coordinates read denormals as zeros (Marvisak#1766) 084d4ff Shaders: round full-width unsigned integer conversions once (Marvisak#2186) f3578e3 Shaders: decode f16 inline float constants in whole-wave v_add_f16 simulation (Marvisak#2493)
WARP can round a full-width unsigned integer conversion one ULP away from the console result. The examples from FIND-5 and #1602 both reproduce on the GitHub Windows runner. This addresses the unsigned-conversion part of FIND-5.
For
v_cvt_f32_u32, convert the high and low 16-bit halves separately, then computehi × 65536 + lo. Both halves and the scaled high half are exactly representable in f32. Only the addition rounds, including when the host fuses the multiply and add. This costs five DXIL operations in place of the unsigned cast. Other conversions keep their existing lowering.The existing conversion probe now compares exact result bits for 84 unsigned inputs, including the reported values and both sides of rounding midpoints. On the same runner, the previous lowering missed two WARP results and the new lowering passed. Both workspace Clippy configurations and the full workspace suite passed. In a separate CPU check, the split conversion matched an integer round-to-nearest-even oracle over all 2³² inputs. Windows comparison and test log
Related PR #1602 adds conversion coverage and documents the discrepancy. This PR changes the production instruction and uses a zero-tolerance regression for it. Physical GPU performance remains unmeasured.
AI-assisted with Codex.