Repository navigation
Conversation
Lower v_ldexp_f32 (src0.f32 * 2^src1.i32) in crates/victory-shader/src/emit/lower.rs using exact IEEE-754 exponent adjustment in 32-bit integer arithmetic (without requiring INT64): - Clamps the signed exponent to [-512, 512] so biased_exp + n never overflows i32 (including i32::MIN and i32::MAX), handling full-range scaling like 2^-126 * 2^253 = 2^127 without intermediate overflow. - Overflows to signed infinity, underflows to signed zero (matching RDNA2/D3D12 f32 FTZ), preserves +/-0.0 and +/-inf regardless of exponent, and quiets sNaN to qNaN. - Supports VOP3 source abs/neg and output omod/clamp modifiers. - Adds hardware + WARP + dxil.dll test emit::valu_tests::v_ldexp_f32_matches_rdna2.
|
Ran on an RTX 5070 (desktop, driver 621.40, the only adapter), Windows 11 26300, Rust 1.98.1 at One question on the denormal cases. The lowering returns a signed zero when the result exponent is |
|
On the denormal question above: #157 also lowers |
catminou4
left a comment
There was a problem hiding this comment.
Tested locally on macOS arm64 (rustc 1.98.1): PR head merged cleanly into current main (ffe310e), cargo test -p victory-shader --locked → 96 passed, 0 failed. Execution/valu tests are #[cfg(all(test, windows))] and only run on Windows; macOS covers lowering/structure/IR unit tests.
Lowers v_ldexp_f32 (VOP3 0x362) with RDNA2-matched cases (v_ldexp_f32_matches_rdna2).
|
Automated triage for the maintainers. Needs rebase. This pull request conflicts with Generated by Claude Code |
Offline measurement on a retail dump, and the shader tests on AdaResult: no count change against Offline. I merged head 59e48eb onto No program changes its failure reason either. That is the expected result for a fix whose instructions sit behind the earlier failures on Tests: with the same merge, No shader names or data are included, per the asset policy. AI-assisted (Claude Code). |
|
I rebased the The same test stops at Claim. AI-assisted with Codex. Synthetic shaders only. |
Gap
v_ldexp_f32(VOP3 0x362, computingsrc0.f32 * 2^src1.i32) was not lowered incrates/victory-shader/src/emit/lower.rs, failing shader translation with:Fix
v_ldexp_f32incrates/victory-shader/src/emit/lower.rsusing exact IEEE-754 exponent adjustment in pure 32-bit integer arithmetic (requiring noINT64shader feature flag):src1to[-512, 512]sobiased_exp + nnever overflowsi32(includingi32::MINandi32::MAX) while still handling full-span shifts such as2^-126 * 2^253 = 2^127without intermediate overflow.f32FTZ), preserves±0.0and±infregardless of exponent, and quietssNaNtoqNaN.abs/neg(viafsrconsrc0) and outputomod/clamp(viafloat()).dxil.dlltestemit::valu_tests::v_ldexp_f32_matches_rdna2covering normal positive/negative scaling, full-span scaling, overflow to±inf, underflow to±0.0,i32::MIN/i32::MAXexponents,±0.0/±inf/sNaN/qNaN, and VOP3abs/neg/clamp/omod.Verification
Tested on Windows 11, NVIDIA RTX 3050 6GB Laptop GPU, WARP, and Windows SDK
dxil.dll:rustfmt --edition 2024 --checkonvalu_tests.rs: cleancargo xtask policy:154 files okcargo clippy --workspace --all-targets --locked -- -D warnings: cleancargo clippy --workspace --all-targets --all-features --locked -- -D warnings: cleancargo test -p victory-shader --locked -- v_ldexp_f32_matches_rdna2 --nocapture --test-threads=1: passed (hardware + WARP +dxil.dll)VICTORY_WARP=1 cargo test -p victory-shader --locked -- --test-threads=1:121 passed, 0 failed, 1 ignored