Shaders: lower s_ff0_i32_b32 and s_ff0_i32_b64 in pure 32-bit DXIL #2063
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!2063
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2063"
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?
@geiyiliyabumo on GitHub · 2026-11-25 04:19 UTC · original
geiyiliyabumo:feat/shader-s-ff0→main· +95 −8 · 2 files · 1 commits · openSummary
s_ff0_i32_b32(opcode0x11) ands_ff0_i32_b64(opcode0x12) incrates/victory-shader/src/emit/lower.rsusing pure 32-bit DXIL (FirstbitLoon inverted source dword(s)), matchings_ff1_i32_b32ands_ff1_i32_b64without enablingInt64/WIDE_OPS.SCCacross both instructions and applies the same numeric lane-mask guard in pixel/vertex shaders ass_ff1_i32_*(since a shorter host wave can change the lowest clear bit).crates/victory-shader/src/emit/valu_tests.rscovering all boundary inputs for 32-bit and 64-bit operands with bothSCC = 0andSCC = 1, verifyingInt64is not set.Verification
cargo xtask policy: passedcargo clippy -p victory-shader --tests -- -D warnings: passedcargo test -p victory-shader --lib scalar_ff0with Microsoftdxil.dll: 2/2 passed on AMD Radeon RX 9060 XT (RDNA4) and Microsoft Basic Render Driver (WARP)@jeremygold02 on GitHub · 2026-11-25 04:28 UTC · original
Triage verdict — Keep the focused FF0 change and reconcile #148’s overlap (
d1d33ea)Evidence
main. Focused lowering · #148 patchChecks and limits
Next step
This verification was AI-assisted.
@upipibi on GitHub · 2026-11-25 04:41 UTC · original
Ran on Windows 11 with an RTX 3070 (Ampere, driver 616.56), debug build, at
d1d33ea.victory-shader: 246 passed, 3 failed, 3 ignored; the newscalar_ff0_reads_the_source_width_and_writes_only_one_sgprandscalar_ff0_finds_the_lowest_clear_bit_and_preserves_sccpass. The 3 failures are #1744's NVIDIA failures onmain. Same asmainon this hardware. Not run: a title.AI-assisted (Claude Code).
@sinan-cmyk on GitHub · 2026-11-25 09:24 UTC · original
Offline measurement on a retail dump
Result: no count change against
main.I merged head
d1d33eaaontomain940d32f(clean merge) and ranvictory translate --validate --listonshaders.rpf(1.0.2.1), with dxil.dll 1.8.2502.11. I compared the result withmainprogram by program (25,889 programs). Validated: 23,918 onmain, 23,918 with this PR.No program changes its failure reason. The count shows that the change rejects nothing on this data. It does not show whether the output is right.
No shader names or data are included, per the asset policy. AI-assisted (Claude Code).
@Marvisak on GitHub · 2026-11-25 09:25 UTC · original
Automated triage for the maintainers.
Merge candidate.
This lowers
s_ff0_i32_b32ands_ff0_i32_b64(crates/victory-shader/src/emit/lower.rs,Lower::soparms) as first-bit-low of the complemented source dword(s). It reuses the existings_ff1_*paths, so the result is -1 when there is no clear bit, the b64 form adds 32 for a match in the high half, and no Int64 is needed. Checked against main:gfx10/opcodes.rsalready decodes 0x11 and 0x12, andgfx10/fields.rsreads the 64-bit source.Lower::inst, which is right because missing high lanes would read as clear bits. The added comment sits inside thatmatchwithout a matching name, which reads oddly. A rewording would help but is not a blocker.#148 and #1684 also lower s_ff0 among other instructions, but both conflict with main. This one merges cleanly. The retail-dump comparison above shows no program changes, so this adds a capability the current title does not use. Recommending a look, not approving.
CI: passing (
check).Generated by Claude Code
@fuzeofficlal on GitHub · 2026-11-26 01:42 UTC · original
Code review and RTX 5090 + WARP + DXIL verification at head
d1d33eaaf030merged cleanly ontomain(63bcca43c6a0;emit/lower.rs=521,062B,3,226B under the 512 KiB cap):crates/victory-shader/src/emit/lower.rs:3509-3511, 3737-3760, 3930-3941):s_ff0_i32_b32inverts viaXor u32::MAX+ DXILFirstbitLo(op 32), mapping0 -> 0andu32::MAX -> -1without touchingSCC.s_ff0_i32_b64splits into two 32-bitFirstbitLocalls (pure 32-bit DXIL, noInt64SFI0 flag), adding32when only the high word has a zero bit, andmask_okproperly excludess_ff0_i32_*fromMaskData::Host.dxil.dll10.0.26100.0,VICTORY_D3D12_DEBUG=1, Rust 1.98.1):cargo xtask policy:191 files ok;cargo clippy(default +--features diagnostics): 0 warningsscalar_ff0(2/2),emit::lower::tests(33/33), andemit::semantics_tests(34/34 on both RTX 5090 and WARP, 1 ignored) all passed.LGTM.
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.