Shaders: pass SignedOpKind::Signed for float dx.op.wavePrefixOp #3149
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3151"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from Marvisak/VIctory. Originally posted by reeledMarek on 2026-11-26T10:27:20Z.
Summary
crates/victory-shader/src/emit/lower.rs(Lower::shape),wavePrefixOpunconditionally passedSignedOpKind = 1(Unsigned) even whenop == Op::AddF(dx.op.wavePrefixOp.f32).SignedOpKind = 0(Signed) for floating-pointwavePrefixOp(matchingwaveActiveOpdirectly below atOp::AddF => (0, 0)), otherwisedxil.dllvalidation rejects the shader.self.s.m.i8(u8::from(!float))and add a synthetic compute wave32 prefix-sum test incrates/victory-shader/src/emit/lower/wave_prefix_tests.rsverifyingSignedOpKind = 0forOp::AddF(plus DXIL validator check on Windows) andSignedOpKind = 1forOp::AddU.Imported from Marvisak/VIctory. Originally posted by oni-swr on 2026-11-26T10:44:06Z.
Independent WARP verification of head
c9b42b64(parent main63bcca4). Synthetic only, no game data.Setup:
VICTORY_D3D12_WARP=1,VICTORY_WARP=1; DXGI adapter reported "Microsoft Basic Render Driver" (flags=2 software, 0 video memory). The physical GPU was not opened. DXIL validator: dxil.dll 1.8.2502.11 (Windows Kits 10.0.26100.0). rustc: rustc 1.98.1 (48a229cea 2026-09-01).cargo test -j 4.Result: no defect found in the change.
emit::lower::wave_prefix_tests::wave_prefix_op_sets_signed_op_kind_for_float_and_unsigned_for_intpasses on head. With only theself.s.m.i8(u8::from(!float))line put back toi8(1), it fails on the float assertion (left[121, None, 0, 1], right[121, None, 0, 0]), so the test does discriminate the change.cargo test -p victory-shader --no-fail-fast -- --test-threads=1: head 299 passed, 4 failed, 3 ignored. main: 298 passed, 4 failed, 3 ignored. The same 4 fail on both:synthetic_tests::{a_mask_joined_with_data_at_a_uniform_loop_is_its_number, gathers_at_a_level_match_the_hardware, permutes_mask_high_address_bits_and_divergent_branches, permutes_read_the_lane_named_and_zero_from_lanes_left_out}. They are not caused by this PR (the wave-of-32 ones are WARP refusing the fixed-wave pipeline).Limits of what I could show:
wavePrefixOpmodule with sop = 1 (before) and sop = 0 (after), so the validator does not enforce "Signed required for float" here. The change follows the DXIL operand definition, which I did not find a way to confirm through this validator.The parameter is incorrect), exactly as it does for the existing wave-of-32 tests above. So there is no runtime comparison of results on WARP; the evidence is the emitted operands plus validation.AI use: Claude Code (Claude Sonnet 5.5) ran this verification; Claude Code (Claude Opus 5.5) coordinated. No game files, dumps, shader names or hashes were used.
Imported from Marvisak/VIctory. Originally posted by Dukestar69 on 2026-11-26T11:31:42Z.
Review: APPROVED
Verified against
origin/main(63bcca4):cargo test -p victory-shader --lib wave_prefix_tests:: -- --test-threads=1: passed (wave_prefix_op_sets_signed_op_kind_for_float_and_unsigned_for_int).cargo clippy -p victory-shader --all-targets -- -D warnings: clean.cargo xtask policy: 192 files ok.Cleanly passes
SignedOpKind::Signedfor floatdx.op.wavePrefixOpcalls per DXIL spec.Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
Imported from Marvisak/VIctory. Originally posted by futurepro62 on 2026-11-26T21:14:28Z.
NVIDIA full-suite run, to go with the reports above by oni-swr, since none of them names a GPU run. Tested exact head
c9b42b6(on its base63bcca4).Tested
dxil.dllfrom Windows SDK 10.0.26100 (the loader's default), debug.cargo build --workspace --locked, thencargo test --workspace --locked --no-fail-fast -- --test-threads=4 --skip emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index --skip descriptor::host::tests::dynamic_slots_are_held_until_released --skip memory::tests::lists_share_a_table_and_copies_keep_their_views --skip emit::stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride --skip emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros --skip emit::synthetic_tests::gathers_at_a_level_match_the_hardware: 867 passed, 0 failed, 10 ignored.wave_prefix_op_sets_signed_op_kind_for_float_and_unsigned_for_int.--skipleaves out tests that fail on main63bcca4on this card too, not because of this PR:heap_direct_texture_reads_mark_their_heap_indexends thevictory-shadertest process with0xc0000005(#2571), so without the skip the rest of that crate never reports;dynamic_slots_are_held_until_released,lists_share_a_table_and_copies_keep_their_viewsand the twostride_testshit the 1,000,000-view heap cap of NVIDIA drivers (#1835, #2317);gathers_at_a_level_match_the_hardwarefails on lane 0 (#1744).Not tested
AI use
Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T21:52:39Z.
Review: APPROVED
Verified on
c9b42b64:cargo xtask policy:192 files ok.cargo clippy --locked -p victory-shader --all-targets -- -D warnings(default and--all-features): clean.crates/victory-shader/src/emit/lower.rssize is521,161bytes (under the 512 KiB ceiling).cargo test --locked -p victory-shader --lib -- --test-threads=1 emit::lower::: 34 passed, 0 failed under bothVICTORY_WARP=0andVICTORY_WARP=1, includingemit::lower::wave_prefix_tests::wave_prefix_op_sets_signed_op_kind_for_float_and_unsigned_for_int.Passing
u8::from(!float)forSignedOpKind(0 = SignedforwavePrefixOp.f32,1 = UnsignedforwavePrefixOp.i32) atlower.rs:1252matches the DXIL specification and aligns withwaveActiveOp(lower.rs:1183, 1280), and inspecting the emitted call arguments directly inwave_prefix_tests.rsis great sincedxil.dllonly validates overload/signature and does not rejectsop=1on float calls. One tiny formatting note:rustfmt --edition 2024 --checkflags lines55-58ofcrates/victory-shader/src/emit/lower/wave_prefix_tests.rswhere the three bitwise-OR operand terms invop3wrap onto separate lines instead of one line. LGTM.Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-28T14:37:29Z.
I combined your exact
c9b42b6head with #470 ated2d2c8in branch1cadfb8. Both commits are direct parents. The difference from #470 is entirely test code. Its float and unsigned sum lowering already emits the operands your test expects, so the regression can travel with #470 if it lands first.I compiled a short HLSL compute shader that calls
WavePrefixSumwith bothfloatanduint. DXC 1.9.2609.5 emitsSignedOpKind=0for the float call and1for the unsigned call. Your generated test on main emits1for both unless the fix is applied.dxil.dll1.9.2609.5 accepts both float operands, which agrees with the earlier 1.8.2502.11 result in this thread. The regression checks parity with Microsoft's emitter.All 35 lowering tests pass on the combined head, including your float and unsigned operand test and #470's minimum-prefix scan. The separate 35-test VALU suite passes on WARP 1.0.22 with Agility 1.620.2 and the debug layer off and on. The prefix probes checked emitted DXIL. Strict all-feature shader Clippy and the asset policy passed.
Please retain the original Git authors if carrying the test or lowering changes separately. AI-assisted with OpenAI Codex.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.