tests: correct the S_CBRANCH_VCCNZ expectations to the diverging result #933
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
GPU
GUI
help wanted
question
Shaders
Video
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/KytyPS5--KytyPS5!933
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/933/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?
@theantipopau on GitHub · 2026-09-29 22:50 UTC · original
theantipopau:vccnz-wave-mask→main· +6 −2 · 1 files · 2 commits · closed without mergingWhat
Two
S_CBRANCH_VCCNZcases asserted results the recompiler was never going to produce, and oneof them was not testing the thing its name claims. +6/−2, test-only.
BranchVccnzUsesWaveMaskThe program sets
V_CMP_EQ_U32 vcc, 0, v0, which is true only for lane 0 of each 4-lane group,then branches on
S_CBRANCH_VCCNZ:S_CBRANCH_VCCNZis a per-lane branch — it isS_CBRANCH_CCIZthat is uniform — so lane 0stores 42 and lanes 1–3 store 11. That is what the recompiler produced:
The expectation is now the per-lane pattern. Worth noting this makes the case stronger: the
old all-42 form also passed an implementation that branched unconditionally, which is exactly
the bug class the test exists to catch.
BranchVccnzUsesCarryProducedWaveMaskThis one is subtler. It builds
0xffffffff + v1 + carry_inwithV_ADDC_U32and branches onthe carry-out, so it reads like it should cover the VCC carry-in. It did not: the VCC
producer is
V_CMP_F_U32takes its comparison predicate from an implicitsrc2, and0is the"always false" predicate —
F— so VCC was clear for every lane and the carry-in was alwayszero. Swapping in
V_CMP_EQ_U32(0xc2), which does set the bit for lane 0, makes the caseexercise the carry-in it was written for, and the original all-42 expectation then holds:
0xffffffff + 0 + 1→ carries → 420xffffffff + 1/2/3 + 0→ carries by overflow → 42I confirmed the recompiler's carry-in wiring is correct on its own with a throwaway case that
computes
0 + 0 + VCCand stores the sum; it returns 1 for lane 0 and 0 elsewhere, as itshould. So no product change is needed here.
Testing
shader_recompiler_compute_tests, with the D24 fix from #930 merged in so the suite can reachthese cases on my GPU. Both cases now pass; total failures on this machine go from 7 to 5.
@coderabbitai[bot] on GitHub · 2026-09-29 23:04 UTC · original · edited 2026-09-29 23:08 UTC
Navigate logical layers of code changes, visualize relationships, and explore their blast radius.
📝 Walkthrough
Walkthrough
Two compute tests change. One updates the expected output for lane-specific branching. The other changes its encoded comparison instruction to
V_CMP_EQ_U32and revises the related comments.Suggested reviewers:
nmzikPriority: ⬇️ Low
Change: Other
Merge Risk: 🟡 Moderate · up to
9ebbeThe updated tests are not reliable across supported devices and do not fully validate the intended carry behavior; fix these before merging.
Architecture Summary
Architecture risk: 🔵 Low · up to
2ec21The change affects 1 system.
Changed systems:
testsArchitecture concerns
No architecture-level concerns identified.
Review details
Systems and components
Before / after behavior
42in every lane to42in lanes 0 and 4 and11elsewhere.V_CMP_F_U32toV_CMP_EQ_U32and updates the comments about their predicates and lane-0 carry-in.🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
❤️ Share
Comment
@coderabbitai helpto get the list of available commands.@ -24045,3 +24046,4 @@test.expected = {42u, 11u, 11u, 11u, 42u, 11u, 11u, 11u};test.opcodes = {O::V_MOV_B32, O::V_LSHLREV_B32, O::V_ADD_NC_U32,O::V_CMP_EQ_U32, O::S_CBRANCH_VCCNZ, O::S_BRANCH,O::BUFFER_STORE_DWORD, O::S_ENDPGM};@coderabbitai[bot] on GitHub · 2026-09-29 23:04 UTC · original
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 15049
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 41684
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 41578
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 41938
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 45669
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 41968
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 32420
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 10124
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 41574
Make the expected result depend on the host subgroup size.
The default test run passes the Vulkan device subgroup size to
CompileCase. When the device reports a subgroup size of 32, the wave-size-64 shader uses two emulated halves, andS_CBRANCH_VCCNZreduces VCC across both halves. Since lanes 0 and 4 set VCC, all active lanes write42, so the fixed lane-wise expectation can fail. Make this test’s subgroup mode explicit or derive its expected vector from the selected subgroup size.@coderabbitai[bot] on GitHub · 2026-09-29 23:04 UTC · original · reviewed
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository: KytyPS5/KytyPS5/.coderabbit.yaml
Review profile: CHILL
Plan: Advanced
Run ID:
c0bd031d-3110-48f2-b0e1-31199adc6fec📥 Commits
Reviewing files that changed from the base of the PR and between
05057c9441and2ec2136dc3.📒 Files selected for processing (1)
tests/ShaderRecompilerComputeTests.cppIncluded review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review.
@Nmzik on GitHub · 2026-10-03 15:26 UTC · original
@theantipopau WRONG. S_CBRANCH_VCCNZ tests whether the wave’s VCC mask is nonzero
Pull request closed