Repository navigation
fix(shader): write a GCN v_cmpx result to its VCC or SDST as well as EXEC - #9671
Conversation
|
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
|
Verified: the x-family classification ( One correction to a detail in the PR's own review: the Two untested paths worth one sentence in the debt entry (the debt change covers the writes, which the seven measured cases pin):
|
MarcZX10
left a comment
There was a problem hiding this comment.
The direct change records the GCN VOP3 SDST (or VOPC VCC) as the second destination and writes the EXEC-masked comparison through that destination while retaining RDNA's EXEC-only behavior. The seven-case wave64 test checks VOPC, VOP3 SGPR/VCC, partial EXEC, float compare, and a plain compare control. The PR also reports direct PS4 Pro hardware measurements, and its checklist identifies CUSA04865/#7941. Current-main git diff --check passes; the hosted eligibility, conventions, intake, labels, and report checks pass. The PR is currently mergeable and declares its dependency on #9430.
One required validation remains: CONTRIBUTING requires shader-recompiler changes to run the same focused tests on main and the change with VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, ANYPS5_NO_SHADER_CACHE=1, and ANYPS5_REQUIRE_VULKAN=1, using ctest -V on the same machine/GPU. Please provide the paired output, confirm the layer loaded, compare for new VUID- errors, and record the GPU details on the checklist. The reported NVIDIA test run does not state that it used these settings or include the paired main comparison. I could not run the Vulkan test locally in this environment.
4d61e74 to
7ea4706
Compare
|
Thanks. Paired validation-layer run, now in the description: On fogydes's two notes: the debt text is now its own "GCN v_cmpx" entry and records both, a VOP3 SDST of EXEC writing EXEC twice in an inferred order, and no case reading the SDST pair right after the compare; it also says the measurement used the default AI-assisted: yes (Claude Code) 🤖 Generated with Claude Code |
…EXEC The GCN decoder refused every v_cmpx. On GCN a v_cmpx writes its compare mask to EXEC and to its destination: VCC in the VOPC form, the SDST field in the VOP3 form, which leaves VCC alone. Both get the mask ANDed with the EXEC the compare ran under, as measured on a PS4 Pro (firmware 10.71) with a wave64 compute dispatch. The decoder keeps the RDNA v_cmpx opcode and carries the GCN destination in destination2; emitCompareResult writes it with the masked result it puts into EXEC. RDNA-decoded v_cmpx has no destination2 and is unchanged. GcnCompareExecWrites runs the seven measured cases on wave64 and on the wave64-split target. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MarcZX10
left a comment
There was a problem hiding this comment.
The updated report addresses the paired validation-layer request, and the debt entry now records the two unmeasured paths identified in the earlier review. The hardware measurement table and focused wave64 test are detailed and internally consistent; the current-main diff check is clean. I did not rerun the C++/Vulkan tests locally because there is no configured build tree and the filesystem is full.
The remaining limitation is the dependency stack: this branch is based on #9430/#9431 and still needs to be rebased against current main after those dependencies are refreshed. The description also says the affected title has not yet been run with this branch. Once the stack is current, please run the focused GCN path/title check on the resulting merge commit and update the bring-up thread if it changes the reported blocker or furthest point. The reported paired validation baseline is main 7e2ba73, which predates current main.
7ea4706 to
5ad97ab
Compare
|
Rebased onto #9430's new head ( AI-assisted: yes (Claude Code) 🤖 Generated with Claude Code |
|
Gang Beasts (CUSA04865) on the current stack: The six pull requests alone do not carry the title over For this PR: the GCN shaders of the title decoded and ran with the v_cmpx change in the build (no decoder throw in 330 s); the decoder line of this PR had to be merged with Get-fix#1's V_RSQ_CLAMP_F32 line in AI-assisted: yes (Claude Code) 🤖 Generated with Claude Code |
|
Landing-order note: @savvaniss's #9889 (GCN MTBUF, V_RSQ_CLAMP_F32, SOPK, SMRD literals and the image dimension from the T#, also on #9430) touches the lines next to this PR's: in AI-assisted: yes (Claude Code) 🤖 Generated with Claude Code |
|
#9430 is merged, so this branch now has current The landing note on #9889 still holds: its AI-assisted: yes (Claude Code) 🤖 Generated with Claude Code |
adriadam10
left a comment
There was a problem hiding this comment.
The full Build of this head fails on Linux (lavapipe, llvmpipe LLVM 20.1.2, subgroup size 8), run 40053688535:
agc_driver_gcn_compare_exec_writesfails:AGC graphics: GCN compare EXEC writes wave64: v_cmpx_lt_u32_e32 vcc, v0, 32 left exec 0000000000000000, expected 00000000ffffffff. The test is new in this PR, so main has no such failure, and it is deterministic rather than an infra flake.- The wave64 program on lavapipe's 8-lane subgroups ends with EXEC = 0 for case A. Your RTX 2080 run passes, so the
SetExec/SetExecLo/SetExecHipluswriteMask(inst.destination2)sequence inemitCompareResult(CompareInstructions.cpp:88-94), or the test's expectation, differs between drivers. Please reproduce with lavapipe (Mesa 25.2.8 / LLVM 20.1.2, as in CI) and fix the translation or the test so all seven cases pass there.
The rest of the diff (decoder destination2, debt entry, RDNA path unchanged) looks fine; once the test is green on Linux this can go in.
|
Thanks, @adriadam10, confirmed from the run log: case A of the device-target (wave64) run ends with EXEC = 0 on llvmpipe, while the 32-lane split run and both runs on the RTX 2080 pass. AI-assisted: yes (Claude Code) |
The wave64 program needs a host subgroup of at least 32 lanes; on llvmpipe (8 lanes) even the plain v_cmp control case sees only the low 8 lanes, so the test reports the skip like the other execution tests that need a full wave in one subgroup. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Reproduced locally with lavapipe from Mesa 25.2.8 (pal1000 MSVC build, llvmpipe LLVM 21.1.7, subgroup size 8; the same CI message for case A). With a per-case dump of EXEC, VCC and s[8:9], the failure is not the 5086de2 makes the test skip when the device's subgroup size is below 32, as AI-assisted: yes (Claude Code) 🤖 Generated with Claude Code |
adriadam10
left a comment
There was a problem hiding this comment.
@MarcZX10 your CHANGES_REQUESTED from 2026-10-22 is still active and blocks the merge queue; only you can clear it. Both points of it are now covered on the current head (5086de2):
- Paired validation-layer run (main vs branch,
VK_LAYER_KHRONOS_validation,ANYPS5_NO_SHADER_CACHE=1,ANYPS5_REQUIRE_VULKAN=1): 0VUID-on both sides, in the PR description. - Stack/title: #9430 is merged and
mainis merged into the branch (it merges cleanly against currentmain); the author's Gang Beasts (CUSA04865) run on this stack is in the 2026-10-22 15:44 comment.
The only change since your last review is the skip on subgroups narrower than 32 lanes (the Linux lavapipe failure also hit the plain v_cmp control, so it is independent of this PR). Could you re-review and approve, or say what is still missing?
|
A run of this head on Windows with an AMD device, and with a second NVIDIA generation. Windows 11 Home 10.0.26200, WinLibs GCC 15.2.0 r7 (MinGW-w64 UCRT), Release.
Negative control on the RTX 4070 SUPER: Not run: the validation layer, Linux, a PS4 title. AI-assisted: yes (Claude Code) |
Dismissing a stale review: the requested changes were addressed after it (new head) and the merge queue blocks on it. Please request changes again if anything is still open.
|
Static review plus an independent Linux/AMD run on both trees per the repo AGENTS shader-recompiler protocol (CachyOS, kernel 7.2.10, GCC 16.2.1, Ninja 1.13.2, Release, What I checked (static)
Focused paired run (VVL env)
Both logs: 0 Not covered The debt note records exactly what stays unmeasured: f32 denormal modes 1 and 2 on GCN hardware (the console measurement covers default |
✅ NVIDIA GPU test: passedPR head
Unstable on main (1, these also failed in recent main runs on this machine; not counted against this PR)Failing on main too (3, not counted against this PR)Validated but not compared (1, not in the main baseline's validation pass)Validation IDs already present on main (5 IDs in 481 tests)Skipped (45)ReproduceAutomated build and test on a contributor's NVIDIA machine; it does not replace upstream CI. A new comment is posted for each new push. Full logs. |
|
Independent AMD/Linux RADV check: all seven GCN compare cases pass in both native wave64 and wave64-split modes, three times, with the seven existing RDNA compare controls unchanged. Head
All 55 individual invocations confirm the RX 9060 XT and actual Environment: CachyOS Linux, kernel ReproductionOn main, build and run these seven entries; on the merge, add export ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1
export VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_LOADER_DEBUG=layer
export VK_LAYER_PATH=/path/to/validation-layer/explicit_layer.d
pattern='^(agc_driver_vopc_compare|agc_driver_vopc_compare_f64|agc_driver_vopc_compare_table|agc_driver_vop3_compare_modifiers|agc_driver_f32_compare_constant|agc_driver_vcmp_f32_denormals|agc_driver_vcmp_eq_f16_clamp|agc_driver_gcn_compare_exec_writes)$'
ctest --test-dir build-main -R "$pattern" -V --parallel 1 --repeat until-fail:3 --timeout 30 --no-tests=errorFor the negative control, take only Limits: automated translated-shader tests only; no game, PS4/PS5 hardware measurement, performance claim, other OS or full-suite run. AI-assisted independent hardware test run (GPT-6.1-sol). |
What
The GCN decoder refused every
v_cmpx_*("writes both VCC and EXEC"), so a PS4 shader with one threw at recompilation. On GCN av_cmpxis av_cmpwhose mask also lands in EXEC: the VOPC (_e32) form writes VCC, the VOP3 (_e64) form writes its SDST field and leaves VCC alone, and both destinations get the mask ANDed with the EXEC the compare ran under (inactive lane = 0), exactly like EXEC. RDNA'sv_cmpxwrites EXEC only, which is what the translator emitted.The decoder now keeps the RDNA
v_cmpxopcode, so every analysis that treatsv_cmpxas an EXEC writer is unchanged, and carries the GCN destination (VCC for VOPC, the SDST field for VOP3) in the instruction'sdestination2, as the VOP3B carry-out forms already do.emitCompareResultwrites that destination throughwriteMaskwith the same masked value it puts into EXEC; an RDNA-decodedv_cmpxhas nodestination2and behaves as before. No new opcode or tag is needed.This moves Get-fix#16 (opened against
ps4/limbo-gpu) tomain, as Get-fix asked there. It was stacked on #9430, which is merged; the branch now has currentmainmerged in.Behaviour measured on HW
PS4 Pro CUH-7016B, firmware 10.71 (Sony CP firmware, real GPU), a wave64 compute dispatch submitted with
sceGnmSubmitCommandBuffersfrom homebrew. v0 = lane id; before every casevcc = 0x2222222211111111,s[8:9] = 0x4444444433333333; EXEC, VCC and s[8:9] are sampled afters_nop 4.v_cmpx_lt_u32_e32 vcc, v0, 3200000000ffffffff00000000ffffffffv_cmpx_lt_u32_e64 s[8:9], v0, 3200000000ffffffff00000000ffffffffv_cmpx_eq_f32_e32 vcc, 4.0, f32(v0)00000000000000100000000000000010v_cmpx_lt_u32_e32 vcc, v0, 64(all true)0000ffff0000ffff0000ffff0000ffff0000ffff0000ffffv_cmpx_lt_u32_e64 s[8:9], v0, 64(all true)0000ffff0000ffff0000ffff0000ffff0000ffff0000ffffv_cmpx_lt_u32_e64 vcc, v0, 3200000000ffffffff00000000ffffffffv_cmp_lt_u32_e64 s[8:9], v0, 32(control)ffffffffffffffff00000000ffffffffD and E show the destination holds the EXEC-masked mask, not the full compare; B and E show the VOP3 form does not touch VCC, and G is the plain
v_cmpcontrol. The shader, the submission code and the raw output are attached to Get-fix#16 (shader.s, vcmpx.c, orbis-result.txt).Test
agc_driver_gcn_compare_exec_writes(tests/execution/GcnCompareExecWrites.cpp) builds the same seven cases from GCN field encodings (Sea Islands VOPC, VOP3, SOP1, SOPP, VOP1, MUBUF; the words equal whatclang -mcpu=bonaireassembles for the measured shader), decodes them as GCN shaders, runs the wave64 program on the device's own target and on the wave64-split target, and checks EXEC, VCC and s[8:9] of every case against the table above. Before the fix the recompilation throws; a fix that copies EXEC without writing the destination fails A, a fix that lets the VOP3 form write VCC fails B.docs/dev/debt/shader.md, new "GCN v_cmpx" entry: records the measured rule, that the measurement used the defaultFLOAT_MODE(the f32 denormal modes are not measured on GCN), how the decoder carries the destination, and two paths the test does not cover: a VOP3 SDST of EXEC, and a read of the SDST pair right after the compare.Tested
Windows 11 Pro (10.0.26200), WinLibs GCC, NVIDIA GeForce RTX 2080 (driver 617.14), Release build with
BUILD_TESTING=ON, on this branch withmain78becbb merged in:agc_driver_gcn_compare_exec_writespasses (wave64 and wave64 split).agc_driver_vopc_compare,agc_driver_vopc_compare_f64,agc_driver_vopc_compare_table,agc_driver_vop3_compare_modifiers,agc_driver_f32_compare_constant,agc_driver_vcmp_f32_denormals,agc_driver_vcmp_eq_f16_clamp.tools/check_conventions.py --base mainwith this title and description: no findings.main78becbb (100% tests passed out of 7;agc_driver_gcn_compare_exec_writesdoes not exist there) and this branch with thatmainmerged in (100% tests passed out of 8) withVK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation,ANYPS5_NO_SHADER_CACHE=1,ANYPS5_REQUIRE_VULKAN=1andVK_LOADER_DEBUG=warn,error,ctest -V, on the NVIDIA GeForce RTX 2080, driver 617.14, Windows 11 (10.0.26200), Vulkan SDK 1.4.363.0: both logs carry the loader'sadding layers "VK_LAYER_KHRONOS_validation"line (14 and 16 times) and neither reportswas not found but was requested by env var VK_INSTANCE_LAYERS;VUID-ids onmain: 0, on this branch: 0, new on this branch: 0.tools/pr_overlap.py --branch: feat(shader): decode more GCN instructions and take a GCN image's dimension from its T# #9889 (adjacent lines inGcnInstructionDecoder.cppanddocs/dev/debt/shader.md, a union either way).Not yet run on a PS4 title with this branch.
Checklist
main; no other open PR implements the same functions (based on feat(shader): decode PS4 (GCN) shaders by re-encoding them to RDNA #9430's head, which this depends on; searchedcmpxandv_cmpxin open boykopovar/AnyPS5 PRs on 2026-10-22)NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)