Shaders emit fewer DXIL instructions for scalar bitfield masks #3528
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3528"
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 andrewpozdnakov7-jpg on 2026-11-27T14:26:51Z.
Lower the scalar
s_bfm_b32mask with one DXILBfiwhen an operand is dynamic. With two known operands, compute the mask before emitting DXIL. Both operations use the low five bits for width and offset. The code uses the same documented primitive as the vector work in #3525. RDNA 2 SOP2 reference · DXIL Bfidxc -dumpbinon synthetic scalar shaders frommain63bcca4and this change produced these complete entry-point counts and container sizes.The single runtime case pays for the additional Bfi declaration. The multi-mask and immediate cases produce smaller containers. The immediate fixture uses the
(12, 12)mask from the project's descriptor-analysis test. Fixture on mainThe runtime regression covers 4,096 width, offset, high-bit and prior SCC combinations, plus both SCC inputs to the immediate mask. The exact mask and SCC agree with the reference on app-local WARP 1.0.22. Coordination comment
The shader semantics suite passed 35 tests with one existing ignored test, and all 33 lowering tests passed. Strict shader Clippy in both feature configurations and the asset check passed.
Please retain the Git author if cherry-picking or rebasing. If folding it in, add
Co-authored-by: andrewpozdnakov7-jpg <[email protected]>. AI-assisted. Synthetic shaders only.Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-27T14:30:38Z.
Windows CI passed on
e0385720cc01d42b32be99bfe360f641914de054, including both Clippy configurations and the workspace tests. Exact-head CIFor an independent physical-adapter check, leave
VICTORY_WARPunset and runcargo test --locked -p victory-shader --lib scalar_bitfield_mask_preserves_width_offset_and_scc -- --test-threads=1 --nocapture. The fixture checks the mask and preserved SCC for 4,098 inputs. The size table in the PR measures emitted DXIL.Imported from Marvisak/VIctory. Originally posted by cloph-dsp on 2026-11-27T14:49:32Z.
Independent CPU-only verification on Windows / Rust 1.100.0 / MSVC.
e0385720cc01d42b32be99bfe360f641914de054, merge base63bcca43c6a00a758510398fa43096ce7e4f7df0.cargo test --locked -p victory-shader --lib -- emit::semantics_tests::scalar_bitfield_mask_preserves_width_offset_and_scc --exact --test-threads=1 --quiettest result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 305 filtered out, exit 0.git grep -F -c scalar_bitfield_mask_preserves_width_offset_and_scc 63bcca43 -- .→ exit 1 / 0 hits (test genuinely new); present on PR head.git diff --check 63bcca43 HEAD→ exit 0.Imported from Marvisak/VIctory. Originally posted by futurepro62 on 2026-11-27T20:01:38Z.
NVIDIA full-suite run, to go with the reports above by cloph-dsp, since none of them names a GPU run. Tested exact head
e038572(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.scalar_bitfield_mask_preserves_width_offset_and_scc.--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
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.