Shaders: test raw VCC on s_cbranch_vccz and vccnz without EXEC masking #1404
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!1404
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1404/head"
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?
@ashrafsdrop on GitHub · 2026-11-24 17:46 UTC · original
ashrafsdrop:shader/vcc-branch-no-exec→main· +30 −3 · 1 files · 2 commits · closed without mergingSummary
Resolves VIC-BT-026 from #1249:
s_cbranch_vcczands_cbranch_vccnzbranch conditions incrates/victory-shader/src/structure.rswere masked againstEXECviaself.b.and(vcc, exec).VCC == 0orVCC != 0), irrespective of EXEC.vccdirectly fors_cbranch_vccnzandnot(vcc)fors_cbranch_vccz.vcc_branch_tests_raw_vcc_without_execinstructure.rs.Verification
cargo test -p victory-shader: 121 tests passed, 0 failed.cargo clippy -p victory-shader --all-targets --all-features -- -D warnings: clean, 0 warnings.cargo run -p xtask -- policy: 154 files ok.@geiyiliyabumo on GitHub · 2026-11-24 18:09 UTC · original
Independent verification and code review of \
8ae748e\ on Windows 11 / Rust 1.98.1 MSVC:One test-sensitivity note on \cc_branch_tests_raw_vcc_without_exec\ (\structure.rs:1214):
In the test program, \EXEC\ is never narrowed before \s_cbranch_vccnz, so \exec == Bool::TRUE\ and \self.b.and(vcc, exec)\ already simplified to \cc\ on \main\—meaning the test passes even without the production fix. Narrowing \EXEC\ (e.g. via \cmpx*\ or \s_and_saveexec_b32\ after setting \cc) before \s_cbranch_vccnz\ will make the test actually fail on \main\ and prove raw \VCC\ semantics.
AI-assisted; synthetic tests only, no game files.
@ashrafsdrop on GitHub · 2026-11-24 18:25 UTC · original
@geiyiliyabumo Good eye on the test structure.
Looking into
crates/victory-shader/src/ir.rs(effects()),s_cbranch_vcczands_cbranch_vccnzonly registerVCCin their read set (r.extend(mask(VCC))), neverEXEC(which is only read bys_cbranch_exec{z,nz}).Because
s_cbranch_vcc*does not readEXEC,self.exec(inst)insidebranch()returnedBool::TRUEby definition (the fallback for any instruction with noEXECoperand in its read set). Thusself.b.and(vcc, exec)onmainwas dead code that always evaluated tovcc & TRUE == vcc, regardless of preceding instructions.Removing the conjunct formally decouples the branch evaluation from
EXECin accordance with the RDNA2 ISA manual.Pushed commit
6f0badcadding an explicit support check tovcc_branch_tests_raw_vcc_without_exec:This guarantees the BDD representation has zero dependency on
EXECor any extraneous atoms.@sinan-cmyk on GitHub · 2026-11-24 20:44 UTC · original
Offline measurement on a retail dump, and the shader tests on Ada
Result: no count change against
main.Offline. I merged head
6f0badcontomainffe310e(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: 21,724 onmain, 21,724 with this PR.No program changes its failure reason either. That is the expected result for a fix whose instructions sit behind the earlier failures on
main. The count shows that the change rejects nothing. It does not show whether the output is right.Tests: with the same merge,
cargo test --locked -p victory-shader --libpassed 121, failed 0. The bitcode benchmark is ignored, as onmain, where 120 pass. The run was on an RTX 4070 SUPER (Ada, 32-lane waves, driver 32.0.16.1088), the default adapter, withVICTORY_WARPunset.No shader names or data are included, per the asset policy. AI-assisted (Claude Code).
@Marvisak on GitHub · 2026-11-25 00:39 UTC · original
Automated triage for the maintainers. Closing because it does not change behaviour the project needs (formatting, guards for cases that cannot occur, or notes and translations that cannot be kept current).
Removes
& execfrom the per-lane condition of s_cbranch_vccz/vccnz. In the per-lane model a compare mask already carries EXEC, so the two differ only for lanes outside EXEC, which do no work; nothing is fixed, the fact that taken lanes are in EXEC is lost, and the new test passes on main unchanged.If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution.
Pull request closed