shader: lower 64-bit scalar bit counts and bit scans in the direct compute path #3073
No reviewers
Labels
No labels
accessibility
awaiting author
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
priority: P0
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/R0Y00--Xbox2Windows!3073
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3073"
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?
@legacy-code-archaeologist on GitHub · 2026-11-27 14:12 UTC · original
legacy-code-archaeologist:shader/direct-salu-bitscan64→main· +345 −3 · 5 files · 1 commits · merged 2026-11-27 15:52 UTCChange
src/gfx1013_direct_compute.inllowers the six 64-bit-source SOP1 scalar bit-count and bit-scan instructionss_bcnt0_i32_b64,s_bcnt1_i32_b64,s_ff0_i32_b64,s_ff1_i32_b64,s_flbit_i32_b64ands_flbit_i32_i64in the direct C++ compute path using 32-bit DXILunaryBits.i32(31Countbits,32FirstbitLo,33FirstbitHi), matchingtools/startup/gfx2hlsl.py. Fixes #3072 (part of #2935; 64-bit counterparts of #3050/#3051).s0..s105) destination; aligned SGPR pair (s0..s104even), inline integer (-16..64), or 32-bit literalS0(sign-extended fors_flbit_i32_i64, zero-extended for_b64).s_bcnt0_i32_b64ands_bcnt1_i32_b64writeSCC = (D != 0); the four scans preserveSCCand return0xffffffffwhen no qualifying bit exists. NoInt64Opsneeded.transfer()insrc/gfx1013_compute_native.cppchecksi.name.find(_i32_) == Name::nposbefore clearings[dst + 1]on_b64SOP1/SOP2 instructions so 32-bit-destination_i32_b64ops do not clobber adjacent descriptors (tested withs_ff1_i32_b64 s31, s[22:23]right belows[32:35]).uses_scc_after()markss_bcnt0_i32_b64ands_bcnt1_i32_b64as overwritingSCC.tests/native_salu_bitscan64_check.py,tests/cmake/native_salu_bitscan64.cmake,docs/experiments/native-direct-salu-bitscan64.md.Verification
Tested on
upstream/maine1ea515d, Windows 10.0.26100,devpreset:cmake --build --preset dev --target compile_dxil native_store_replay native_compute_ir_dump: ok.ctest --preset dev --no-tests=error -R '^(native_salu_bitscan64_|native_bitscan_)' -V:native_bitscan_controls(0.57 s) andnative_salu_bitscan64_controls(0.93 s) passed;native_bitscan_hardwareandnative_salu_bitscan64_hardwareskipped (77— Quadro M1000M lacks shader model 6.6 with wave32, so GPU readback is unmeasured).ctest --preset dev --no-tests=error -R '^native_.*_(controls|ir)$' -j 4: 25/25 passed (18.39 s).python -B tests/docs_links_check.py: passed (76Markdown files and585links).AI-assisted.
14619992betodf32f3d925df32f3d925tob6fde8d0b5@R0Y00 on GitHub · 2026-11-27 15:52 UTC · original · approved these changes
Independently reviewed
b6fde8d0integrated overmaind71f9ed2(tree591f1c0a84165670e0c3af7782fa99db62967113). I traced the low/high selection and no-bit sentinel for the scans, signed leading-bit normalization, SCC writes for the two counts, and preservation of the adjacent SGPR for 32-bit destinations.Built
compile_dxil native_store_replay native_compute_ir_dumpwithdevandrelease. Ranctest --test-dir <build> --no-tests=error -j 1 -V -R '^native_(salu_bitscan64|bitscan|s_lshl_add_u32|v_xnor_b32)_'. Debug and Release/O2passed 8/8 each, zero skips. Replay verified the results, neighboring register, SCC and guards, including both SCC-preservation cases, negative literal extension and source/destination overlap. Compile controls passed for adjacent descriptor preservation and invalid operands.git diff --check HEAD^1 HEADpassed.NVIDIA GeForce RTX 4060 Laptop GPU, driver
32.0.16.1656, Windows26200.9974, SDK/DXC10.0.26100.0, wave32, D3D12 debug layer disabled. This supplies independent hardware coverage for the capability skip reported on the Quadro. GitHub Windows, Linux and gfx1013 checks passed; hosted/O2was skipped.