Repository navigation
Shaders: lower binary64 reciprocal square root with dwords - #2811
andrewpozdnakov7-jpg wants to merge 2 commits into
Conversation
kotekompotek
left a comment
There was a problem hiding this comment.
Same careful pattern as the rcp64 PR (#2799), shared FpMode16 base — sqrt-of-significand to 28 bits then dword division for a 26-bit quotient, with explicit subnormal normalization, signed-zero/inf handling, NaN quieting, and refusal on modifiers or unknown modes. The 2^29 ULP bound cited from the RDNA2 ISA is the right correctness bar for V_RSQ_F64, and 112 validator-checked cases across rounding modes/denorm modes/specials is solid coverage. LGTM; same merge-order note — whichever of the FpMode16 refactor PRs lands first wins the base.
|
Verified
|
…t, sat mul24 - Marvisak#2953: v_div_fixup_f64 in 32-bit ops (quotient classification, overflow and underflow handling, DX10 clamp) - Marvisak#2799: v_rcp_f64 (96/48-bit divisor refinement to 2^-53) - Marvisak#2811: v_rsq_f64 (denormal normalization, guarded reciprocal) - Marvisak#2791: v_sqrt_f64 (non-restoring refinement with sticky bits) - Marvisak#2743: v_ldexp_f64 (52-bit significand scaling, subnormal rounds) - Marvisak#2938: v_mullit_f32 lighting multiply (NaN/zero/limit handling) - Marvisak#2926: v_mul_*_u24/v_mad_*_u24 via valu_mul24; the clamped form now saturates against the full 48-bit product instead of failing emit Rounding-mode reads assume the console's initial 16/64-bit mode (nearest even, denormals preserved): the MODE register is not modelled, so shaders changing it already fail emit. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
Automated triage for the maintainers. This lowers CI: passing. Generated by Claude Code |
Dukestar69
left a comment
There was a problem hiding this comment.
Tested merged onto origin/main (63bcca4) on Windows 11 x64 (NVIDIA GeForce RTX 5090 + WARP, dxil.dll validator active):
cargo test -p victory-shader --lib emit::valu_tests::rsqrt: 2 passed, 0 failed (rsqrt_f64_obeys_the_input_denormal_modeandrsqrt_f64_tracks_binary64_range_and_roundingpass on both RTX 5090 hardware and WARP).cargo clippy -p victory-shader --all-targets -- -D warnings: clean.cargo xtask policy: 192 files ok.
Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
…quare root with dwords # Conflicts: # crates/victory-shader/src/emit/lower.rs
…atch merge Reconcile four cross-PR interactions across the 32 merged PRs: - Marvisak#2953/Marvisak#2975 vs Marvisak#2811: read `self.mode16.round` in `div_fixup.rs` and `div_scale.rs` - Marvisak#2841 vs Marvisak#2177: pass `host_heap_views` in `pipeline.rs` partial-dispatch translation and `dispatch_threads.rs` - Marvisak#2841 vs Marvisak#2999: use guest group dimensions (`self.rows.or(self.s.threads)`) in `dispatch_guard` - Marvisak#2177 vs merged test fixtures: add `host_heap_views: 0` to `Parts` test initializers
…quare root with dwords # Conflicts: # crates/victory-shader/src/emit/lower.rs
…atch merge Reconcile four cross-PR interactions across the 32 merged PRs: - Marvisak#2953/Marvisak#2975 vs Marvisak#2811: read `self.mode16.round` in `div_fixup.rs` and `div_scale.rs` - Marvisak#2841 vs Marvisak#2177: pass `host_heap_views` in `pipeline.rs` partial-dispatch translation and `dispatch_threads.rs` - Marvisak#2841 vs Marvisak#2999: use guest group dimensions (`self.rows.or(self.s.threads)`) in `dispatch_guard` - Marvisak#2177 vs merged test fixtures: add `host_heap_views: 0` to `Parts` test initializers
Main stops translation on
V_RSQ_F64. This lowering normalizes a binary64 input, computes the square root of its significand to 28 bits, and divides to obtain a 26-bit reciprocal. The 32-bit DXIL arithmetic retains the known rounding direction and input-denormal mode, handles signed zeros and infinities, and quiets NaNs. AMD specifies a 2^29 binary64 ULP bound for this instruction. RDNA 2 ISA referenceBoth synthetic shaders stop on unsupported
v_rsq_f64at13f91ca. The same tests pass all 112 cases on app-local WARP SM 6.6 with the DXIL validator. They cover VOP1 VGPR and VOP3 SGPR sources, all four rounding modes, input-subnormal modes, special values, and the two-dword normalization boundary. Feature-flag checks confirm the 32-bit lowering. An independent integer model stayed within the bound for all 327,520 CPU comparisons across the finite exponent fields.The paired full shader suite moved from 268 passed, 5 failed and 3 ignored to 270 passed, 3 failed and 3 ignored. The other three failures were the same gather-at-level, lane-permute and edge-flagged-triangle tests in both runs. All 33 patched VALU tests including runtime identity passed. Strict shader Clippy and staged asset policy passed.
The mode analysis follows the same approach as #2743, #2791 and #2799. Coordination claim
Please retain the Git author on cherry-pick or rebase. If you fold this change into another commit, please include
Co-authored-by: andrewpozdnakov7-jpg <andrewpozdnakov7-jpg@users.noreply.github.com>.