Skip to content

fix(shader): write a GCN v_cmpx result to its VCC or SDST as well as EXEC - #9671

Merged
oneandonlydean merged 3 commits into
boykopovar:mainfrom
ntamas94:up/gcn-cmpx-writes-destination
Nov 3, 2026
Merged

oneandonlydean merged 3 commits into
boykopovar:mainfrom
ntamas94:up/gcn-cmpx-writes-destination

Conversation

@ntamas94

@ntamas94 ntamas94 commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

What

The GCN decoder refused every v_cmpx_* ("writes both VCC and EXEC"), so a PS4 shader with one threw at recompilation. On GCN a v_cmpx is a v_cmp whose 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's v_cmpx writes EXEC only, which is what the translator emitted.

The decoder now keeps the RDNA v_cmpx opcode, so every analysis that treats v_cmpx as an EXEC writer is unchanged, and carries the GCN destination (VCC for VOPC, the SDST field for VOP3) in the instruction's destination2, as the VOP3B carry-out forms already do. emitCompareResult writes that destination through writeMask with the same masked value it puts into EXEC; an RDNA-decoded v_cmpx has no destination2 and behaves as before. No new opcode or tag is needed.

This moves Get-fix#16 (opened against ps4/limbo-gpu) to main, as Get-fix asked there. It was stacked on #9430, which is merged; the branch now has current main merged in.

Behaviour measured on HW

PS4 Pro CUH-7016B, firmware 10.71 (Sony CP firmware, real GPU), a wave64 compute dispatch submitted with sceGnmSubmitCommandBuffers from homebrew. v0 = lane id; before every case vcc = 0x2222222211111111, s[8:9] = 0x4444444433333333; EXEC, VCC and s[8:9] are sampled after s_nop 4.

Case Instruction EXEC before EXEC after VCC after s[8:9] after
A v_cmpx_lt_u32_e32 vcc, v0, 32 -1 00000000ffffffff 00000000ffffffff preset
B v_cmpx_lt_u32_e64 s[8:9], v0, 32 -1 00000000ffffffff preset 00000000ffffffff
C v_cmpx_eq_f32_e32 vcc, 4.0, f32(v0) -1 0000000000000010 0000000000000010 preset
D v_cmpx_lt_u32_e32 vcc, v0, 64 (all true) 0000ffff0000ffff 0000ffff0000ffff 0000ffff0000ffff preset
E v_cmpx_lt_u32_e64 s[8:9], v0, 64 (all true) 0000ffff0000ffff 0000ffff0000ffff preset 0000ffff0000ffff
F v_cmpx_lt_u32_e64 vcc, v0, 32 -1 00000000ffffffff 00000000ffffffff preset
G v_cmp_lt_u32_e64 s[8:9], v0, 32 (control) -1 ffffffffffffffff preset 00000000ffffffff

D 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_cmp control. 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 what clang -mcpu=bonaire assembles 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 default FLOAT_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 with main 78becbb merged in:

  • agc_driver_gcn_compare_exec_writes passes (wave64 and wave64 split).
  • With the decoder and translation changes reverted to the base, it fails: "GCN VOPC v_cmpx (writes both VCC and EXEC) opcode 209 at program counter 60 is not implemented".
  • Unchanged RDNA compare paths still pass: 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.
  • Earlier, on fix(shader): write a GCN v_cmpx result to its VCC or SDST as well as EXEC Get-fix/AnyPS5#16: the fix variants that write EXEC without the destination (case A), let the VOP3 form write VCC (case B) or skip the EXEC AND (case D) each fail the test.
  • tools/check_conventions.py --base main with this title and description: no findings.
  • Paired validation-layer run: main 78becbb (100% tests passed out of 7; agc_driver_gcn_compare_exec_writes does not exist there) and this branch with that main merged in (100% tests passed out of 8) with VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, ANYPS5_NO_SHADER_CACHE=1, ANYPS5_REQUIRE_VULKAN=1 and VK_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's adding layers "VK_LAYER_KHRONOS_validation" line (14 and 16 times) and neither reports was not found but was requested by env var VK_INSTANCE_LAYERS; VUID- ids on main: 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 in GcnInstructionDecoder.cpp and docs/dev/debt/shader.md, a union either way).

Not yet run on a PS4 title with this branch.

Checklist

@github-actions github-actions Bot added the unblocks title Names a title ID on the Unblocks line label Oct 22, 2026
@github-actions

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

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.

Pull request Shared files not compared
PR 1368 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 1395 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 1896 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 5021 core/libs/prx/libSceAgcDriver/CMakeLists.txt
docs/dev/debt/shader.md
PR 5371 core/libs/prx/libSceAgcDriver/CMakeLists.txt
docs/dev/debt/shader.md
PR 5925 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6186 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6187 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6188 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6192 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6209 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6235 docs/dev/debt/shader.md
PR 6280 core/libs/prx/libSceAgcDriver/CMakeLists.txt
docs/dev/debt/shader.md
PR 6412 core/libs/prx/libSceAgcDriver/CMakeLists.txt
docs/dev/debt/shader.md
PR 6481 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6488 docs/dev/debt/shader.md
PR 6808 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6924 docs/dev/debt/shader.md
PR 7085 core/libs/prx/libSceAgcDriver/CMakeLists.txt
docs/dev/debt/shader.md
PR 7223 core/libs/prx/libSceAgcDriver/CMakeLists.txt
docs/dev/debt/shader.md
PR 7275 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 7392 docs/dev/debt/shader.md
PR 7410 docs/dev/debt/shader.md
PR 7457 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 7508 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 7514 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 7604 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 7642 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 7684 docs/dev/debt/shader.md
PR 7689 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 8004 docs/dev/debt/shader.md
PR 8246 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 8484 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 8592 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 8707 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 9020 core/libs/prx/libSceAgcDriver/CMakeLists.txt
docs/dev/debt/shader.md
PR 9183 docs/dev/debt/shader.md
PR 9335 core/libs/prx/libSceAgcDriver/CMakeLists.txt
docs/dev/debt/shader.md
PR 9387 docs/dev/debt/shader.md
PR 9712 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 9748 docs/dev/debt/shader.md
PR 9852 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 9884 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 9889 core/shader/recompiler/RdnaDecoder/src/GcnInstructionDecoder.cpp
docs/dev/debt/shader.md
PR 10193 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 10233 core/libs/prx/libSceAgcDriver/CMakeLists.txt
docs/dev/debt/shader.md
PR 10359 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 10442 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 10757 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 10867 core/libs/prx/libSceAgcDriver/CMakeLists.txt
docs/dev/debt/shader.md
PR 10920 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 11351 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 11483 docs/dev/debt/shader.md
PR 12120 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 12323 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 12324 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 12548 docs/dev/debt/shader.md
PR 12746 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 12790 docs/dev/debt/shader.md
PR 12828 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 12944 docs/dev/debt/shader.md
PR 13148 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 13262 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 13707 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 13928 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 13929 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 14212 docs/dev/debt/shader.md
PR 14217 docs/dev/debt/shader.md
PR 14218 docs/dev/debt/shader.md
PR 14853 docs/dev/debt/shader.md

@fogydes

fogydes commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

Verified: the x-family classification (opcode < 0x100 && opcode & 0x10) selects exactly the v_cmpx families in both forms — the GCN→RDNA opcode tables mirror plain/x at bit 4 well past the codes used (e.g. v_cmp_lt_u32 0xc1 vs v_cmpx_lt_u32 0xd1, both identity-mapped), so a plain v_cmp never gains the second destination, and the VOP3 path routes the compare destination through DecodeRdnaScalarDestination while the VOPC form always carries VCC.

One correction to a detail in the PR's own review: the Four = 246 literal is right, not a mislabel — the repo's RDNA inline-constant table is {0.5, -0.5, 1.0, -1.0, 2.0, -2.0, 4.0, -4.0} for encodings 240–247 (RdnaInstructionDecoder.cpp), so 246 is 4.0 and the case string v_cmpx_eq_f32_e32 vcc, 4.0, f32(v0) matches what the decoder sees. The competing list (0.0/1.0/-1.0/-2.0/-4.0 at 240-244) is the pre-GCN8 chip constants and doesn't apply here.

Two untested paths worth one sentence in the debt entry (the debt change covers the writes, which the seven measured cases pin):

  1. A GCN VOP3 v_cmpx whose SDST is EXEC: it decodes to ExecLo and the destination write plus the following SetExec touch the same register twice — harmless in the current cleanup order, but the ordering is inferred rather than measured and isn't recorded.
  2. No case checks the SDST pair immediately after the compare, i.e. the readMask/scalar-mask path that reads destination2. If a title ever reads the compare mask straight out of the SGPR pair, that's the branch it runs and it is uncovered by the execution test.

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@ntamas94

Copy link
Copy Markdown
Contributor Author

Thanks. Paired validation-layer run, now in the description: main (100% tests passed, main build 7e2ba73) and this branch (100% tests passed) with VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, ANYPS5_NO_SHADER_CACHE=1, ANYPS5_REQUIRE_VULKAN=1 and VK_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's adding layers "VK_LAYER_KHRONOS_validation" line (78 and 16 times) and neither reports was not found but was requested by env var VK_INSTANCE_LAYERS; VUID- ids on main: 0, on this branch: 0, new on this branch: 0.

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 FLOAT_MODE, so the f32 denormal modes stay RDNA2-only evidence.

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>
@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 22, 2026

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@ntamas94
ntamas94 force-pushed the up/gcn-cmpx-writes-destination branch from 7ea4706 to 5ad97ab Compare October 22, 2026 13:21
@ntamas94

Copy link
Copy Markdown
Contributor Author

Rebased onto #9430's new head (a13d01bcc, on main 7e2ba73e4); the commit applied without conflicts, so the diff is unchanged apart from the debt entry round already posted. Paired validation-layer run, now in the description: main (100% tests passed, main build 7e2ba73) and this branch (100% tests passed) with VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, ANYPS5_NO_SHADER_CACHE=1, ANYPS5_REQUIRE_VULKAN=1 and VK_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's adding layers "VK_LAYER_KHRONOS_validation" line (78 and 16 times) and neither reports was not found but was requested by env var VK_INSTANCE_LAYERS; VUID- ids on main: 0, on this branch: 0, new on this branch: 0.

AI-assisted: yes (Claude Code)

🤖 Generated with Claude Code

@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 22, 2026
@ntamas94

Copy link
Copy Markdown
Contributor Author

Gang Beasts (CUSA04865) on the current stack: main 7e2ba73 + #9430, #9431, #9432 (Get-fix's rebased heads) + #9671-#9676, relinked with --windows --registry --module-dir Media/Modules --module-dir Media/Plugins and run with APS5_GNM_SUBMIT_WAIT_IDLE=1 on the same machine as the validation runs (NVIDIA GeForce RTX 2080, driver 617.14, Windows 11 10.0.26200). Furthest point: title screen, Local, costume select, match setup, a stage in play (sharedassets13); 330 s, stopped by the run's timeout, no crash, about 42 FPS in the stage ([present] 418 presents over 10 s), 13,771 presents from the resident image, not implemented and AGC graphics: throws: 0.

The six pull requests alone do not carry the title over main; the bare stack stopped, in this order, on: the PS4 T# base address read as 40 bits (storage texture has no committed guest pages; fixed by Get-fix#1's 38-bit base address commit a2bd6f6, not in #9431), the rect-list point/line polygon-mode throw that e61d31d added (register 0x205 = 0x12c; run with a local stand-in that draws it filled, PS4 behaviour not measured), the GCN image dimension taken from the T# and MTBUF (Get-fix#1 f9b38d1 and 6350d27), and the white lighting without #6948. Those were added for the run and will be listed on the bring-up discussion #7941 with the log; the run log (11 MB) is kept and can be attached there.

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 GcnInstructionDecoder.cpp, a one-line union, which is the landing-order note for #1.

AI-assisted: yes (Claude Code)

🤖 Generated with Claude Code

@ntamas94

Copy link
Copy Markdown
Contributor Author

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 GcnInstructionDecoder.cpp this PR's compareDestination line sits where #9889 adds its V_RSQ_CLAMP_F32 check, and in docs/dev/debt/shader.md both add an entry after "GCN instructions". Both conflicts are a union of the two sides; the Gang Beasts stack run already built and ran with that union. No dependency either way: whichever lands second takes both lines, and I will rebase this one if #9889 lands first.

AI-assisted: yes (Claude Code)

🤖 Generated with Claude Code

@ntamas94

Copy link
Copy Markdown
Contributor Author

#9430 is merged, so this branch now has current main (78becbb) merged in instead of sitting on #9430's head; the PR's own diff is unchanged and the merge had no conflicts. On the merge: the eight focused compare tests pass, and the paired validation-layer run against the same main build reports 0 VUID- ids on both sides (7 and 8 tests; the layer loaded on both, no was not found line). check_conventions against main: no findings. The description now says Depends on: none (#9430 is merged).

The landing note on #9889 still holds: its V_RSQ_CLAMP_F32 line sits next to this PR's compareDestination line, a union either way.

AI-assisted: yes (Claude Code)

🤖 Generated with Claude Code

@adriadam10 adriadam10 self-assigned this Oct 23, 2026

@adriadam10 adriadam10 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_writes fails: 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/SetExecHi plus writeMask(inst.destination2) sequence in emitCompareResult (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.

@ntamas94

Copy link
Copy Markdown
Contributor Author

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. writeMask returns the same ballotMask the RDNA v_cmpx path uses, so the EXEC value is built from the same ballot either way; what this PR adds is a second consumer of that ballot (the VCC/SDST writes), so I suspect the wave64 mapping onto 8-lane host subgroups rather than the expectation, but I will not guess at a fix. I have no lavapipe here yet; I'll reproduce it on Mesa 25.2.8 / LLVM 20.1.2, fix whichever side is wrong, and come back with the run.

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>
@ntamas94

Copy link
Copy Markdown
Contributor Author

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 v_cmpx sequence: every case, including the plain v_cmp_lt_u32_e64 s[8:9], v0, 32 control G that never writes EXEC, sees only the low 8 lanes there (G leaves EXEC 00000000000000ff instead of -1), on both the wave64 and the wave64 split run. The wave64 program does not map onto 8-lane host subgroups at all, independent of this PR, so there is no translation fix that makes the seven cases pass on llvmpipe.

5086de2 makes the test skip when the device's subgroup size is below 32, as ExecHostLanes, Dpp8, Dpp16RowShareXmask, DsSwizzle and the other execution tests that need a full wave in one subgroup already do (VulkanTestSkipped, return code 77). On lavapipe it now prints skipped, the device's subgroups are narrower than the 32 lanes a wave64 run needs (8 lanes); on the RTX 2080 (driver 617.14) it still runs and passes, and the paired validation-layer run of the compare tests reports 0 VUID- ids (layer loaded, no was not found line). check_conventions against main: no findings. Translation and expectations are unchanged.

AI-assisted: yes (Claude Code)

🤖 Generated with Claude Code

@adriadam10 adriadam10 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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): 0 VUID- on both sides, in the PR description.
  • Stack/title: #9430 is merged and main is merged into the branch (it merges cleanly against current main); 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?

@ycbuzi

ycbuzi commented Oct 25, 2026

Copy link
Copy Markdown
Contributor

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. 5086de260e merged onto main 8864d0e323 with no conflicts. One GPU at a time with ANYPS5_GPU, plus ANYPS5_REQUIRE_VULKAN=1 and ANYPS5_NO_SHADER_CACHE=1, run with ctest -V --repeat until-fail:2. Each log's Selected GPU line names the device in its row. The eight tests are agc_driver_gcn_compare_exec_writes and the seven RDNA compare tests from the description.

device result
GeForce RTX 4070 SUPER (0x2783, Ada), NVIDIA 616.92 8 of 8 pass, both runs
GeForce GTX 1650 SUPER (0x2187, Turing), NVIDIA 616.92 8 of 8 pass, both runs
AMD Radeon(TM) Graphics (1002:164e, RDNA2 iGPU, subgroup=64), AMD 32.0.21030.2001 8 of 8 pass, both runs

Negative control on the RTX 4070 SUPER: GcnInstructionDecoder.cpp and CompareInstructions.cpp taken from main, with the test unchanged. agc_driver_gcn_compare_exec_writes then fails with GCN VOPC v_cmpx (writes both VCC and EXEC) opcode 209 at program counter 60 is not implemented, as in the description.

Not run: the validation layer, Linux, a PS4 title.

AI-assisted: yes (Claude Code)

@adriadam10
adriadam10 dismissed MarcZX10’s stale review October 28, 2026 13:23

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.

@blawesom

Copy link
Copy Markdown
Contributor

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, BUILD_TESTING=ON, Ryzen 7 9800X3D). No findings.

What I checked (static)

  • Previously v_cmpx (both VOPC/E32 and VOP3/E64 forms) hit unsupported(...) in GcnInstructionDecoder.cpp and threw — unusable in any guest shader that reads the compare's result register alongside EXEC. The fix threads the GCN-specific secondary destination through: compareDestination is VccSdst for the VOPC path (fixed VCC) or word0 & 0xff for VOP3 (the field names SDST), carried into the decoded instruction as destination2.
  • CompareInstructions.cpp::emitCompareResult swaps ballotMask(IrU1(masked)) for writeMask(inst.destination2, IrU1(masked)) when a real destination is named, keeping the old short path when destination2.kind is Unknown/Null — so decode paths carrying no second destination behave byte-identically to before. Run-dual-every-repo rulings stay visible; nothing here reopens them.
  • The 7-case harness pins the informative cross: E32/E64, VCC-vs-SDST destinations, full and quarter EXEC masks, and the non-v_cmpx control case (v_cmp_lt_u32_e64 s[8:9], expected VCC untouched at VccPreset, SDST written). That separates "compare writing its named destination" from "compare writing VCC and EXEC at once".
  • The new test GcnCompareExecWrites.cpp skips on devices with subgroupSize < 32 (VulkanTestSkipped) rather than faking lane counts, allocates output below the 44-bit GCN buffer-base limit with a hint address and a verified bound, and runs both wave64 and wave64 split (ComputeTarget(32)) targets — covering the split-subgroup path where two lanes per invocation would matter.

Focused paired run (VVL env)

tree agc_driver_scalar_sopk_compare _vopc_compare _vopc_compare_f64 _vopc_compare_table _gcn_compare_exec_writes (new) total
this head 5086de260e Passed (0.04s) Passed (0.04s) Passed (0.06s) Passed (0.07s) Passed (0.44s) 5/5
main bb04a4f1ea Passed Passed (0.04s) Passed (0.06s) Passed (0.09s) new — not present at base 4/4

Both logs: 0 was not found but was requested by env var VK_INSTANCE_LAYERS, 0 VUID-. Comparing logs, no new validation errors. The four shared fixtures exercise emitCompareResult's former path and pass identically on both trees.

Not covered

The debt note records exactly what stays unmeasured: f32 denormal modes 1 and 2 on GCN hardware (the console measurement covers default FLOAT_MODE only), and VOP3 forms whose SDST is EXEC itself — per the note those remain explicitly refused rather than guessed.

@TechLevelZero

TechLevelZero commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

✅ NVIDIA GPU test: passed

PR head 5086de2 merged onto main e6f5730 · tested 2026-11-01 14:21 UTC · 23 min

GPU NVIDIA RTX 2000 Ada Generation, driver 595.99.02, Vulkan 1.4.329
Host Ubuntu 26.04.1 LTS, kernel 7.0.0-38-generic, container ubuntu:24.04
Logs build and test logs for this run
Build ✅ passed (Release, -DANYPS5_ENABLE_SPIRV_TOOLS=ON)
Tests ✅ 2,488 passed · 4 failed (0 new, 3 also fail on main, 1 unstable on main) · 45 skipped (ANYPS5_REQUIRE_VULKAN=1)
Test setup CPU-only tests without a GPU; GPU tests (and any CPU-only test that failed or skipped without one) once on the GPU with VK_LAYER_KHRONOS_validation and ANYPS5_NO_SHADER_CACHE=1; main ran the same way
Test selection 2,537 of 3,148 tests run: the ones this change can reach, chosen by tools/select_tests.py from main's build graph
Vulkan validation ✅ no new validation IDs vs main (934 tests run on the GPU)
Slow tests (>30 s, GPU tests timed with validation layers) ⚠️ agc_driver_pipeline_journal 120.3 s, ⚠️ agc_driver_lookup_log_fits_build 67.4 s, ⚠️ agc_driver_graphics_maps_fallback 37.8 s, ⚠️ agc_driver_graphics 36.9 s
Unstable on main (1, these also failed in recent main runs on this machine; not counted against this PR)
agc_driver_pipeline_journal: failed in 1 of the last 10 main runs
Failing on main too (3, not counted against this PR)
agc_driver_image_table
guest_mmap_executable
guest_socket_options_multicast
Validated but not compared (1, not in the main baseline's validation pass)
agc_driver_gcn_compare_exec_writes
Validation IDs already present on main (5 IDs in 481 tests)
VUID-VkDeviceCreateInfo-pNext-pNext (481 tests): agc_driver, agc_driver_address_passes, agc_driver_alias_copy_label, agc_driver_alpha_to_coverage, agc_driver_array_layer_target, agc_driver_bc_block_copy, agc_driver_bda_anchor_reads, agc_driver_bda_span_reads, and 473 more
VUID-vkCmdCopyImage-srcImage-01548 (7 tests): agc_driver_depth_clear_hle, agc_driver_depth_plane_buffer_memory, agc_driver_depth_plane_partial_store, agc_driver_depth_plane_sampling, agc_driver_depth_storage_dispatch, agc_driver_depth_surface_from_storage, agc_driver_dispatch_move_depth
VUID-vkCmdCopyImage-srcImage-01551 (7 tests): agc_driver_depth_clear_hle, agc_driver_depth_plane_buffer_memory, agc_driver_depth_plane_partial_store, agc_driver_depth_plane_sampling, agc_driver_depth_storage_dispatch, agc_driver_depth_surface_from_storage, agc_driver_dispatch_move_depth
VUID-VkPipelineColorBlendStateCreateInfo-pAttachments-00605 (1 test): agc_driver_prepared_exports
VUID-VkShaderModuleCreateInfo-pCode-08737 (1 test): agc_driver_image_sample_derivatives
Skipped (45)
agc_driver_bda_reads_shadowed_results: skipped, the device reports watched host memory written when it imports or reads it
agc_driver_bda_reads_shadowed_results_per_build: skipped, the device reports watched host memory written when it imports or reads it
agc_driver_sample_order_grid_reference: skipped, the device does not keep depth drawn at custom sample locations at those locations, even after a transition that names them: the composite of uniform renders holds the guest's depth in 0 of 3005 sloped samples, so no path can be compared with it bit for bit
agc_host_import_sparse: skipped, host imports are unavailable: /dev/udmabuf is not accessible
agc_import_settle_initial_dcc: skipped, the device has no deferred settle of host imports: imports under 1 MiB wait for one only on Windows
agc_unit_shadow_completion_store: skipped, the device reports watched host memory written when it imports or reads it
guest_http_uri_locale: 
guest_net_ctl: skipped, the host has no IPv4 address
guest_video_out_color_space: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_hdr: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_high_frame_rate: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_output_mode: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_resolution_status: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_wqhd_detection: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
video_out_flip_aftergpu: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_backtoback: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_controls: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_cpuflip: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_cpuflip_in_order: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_dcc: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_deferred: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_eop: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_eop_aftergpu: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_eop_main: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_fps_limit: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_o
Reproduce
git fetch origin 5086de260e30f59fcb1bf84b8c90fde4bd7c3228 e6f57307fa7f47165d7fc1bee945abdb2f6816e7
git checkout e6f57307fa7f47165d7fc1bee945abdb2f6816e7 && git merge --no-ff 5086de260e30f59fcb1bf84b8c90fde4bd7c3228
git submodule update --init --recursive
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON -DANYPS5_ENABLE_SPIRV_TOOLS=ON
cmake --build build && cmake --build build --target libs
VK_DRIVER_FILES=/nonexistent/icd.json ctest --test-dir build -E '^(agc|shader|recompiler|videoout|video_out|guest_video_out|vulkan)|gpu' --timeout 120 --parallel 32 --output-on-failure
ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation \
  ctest --test-dir build -R '^(agc|shader|recompiler|videoout|video_out|guest_video_out|vulkan)|gpu' --timeout 120 --parallel 4 --output-on-failure
# failures are then re-run alone: --timeout 360 --parallel 2; new validation IDs: the test alone, twice, --parallel 1

Automated 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.

@github-actions github-actions Bot added the review queue Next in the maintainer review queue: checks pass, no open change request, no conflict label Nov 1, 2026
@RNK123

RNK123 commented Nov 2, 2026

Copy link
Copy Markdown

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 5086de260e30f59fcb1bf84b8c90fde4bd7c3228 merged cleanly onto main 926f7dd492b0b432d9287f4d6faaaf1c9d3c86c5.

  • Main: seven existing compare entries pass 3/3 each.
  • Negative control: adding only this head's unchanged GcnCompareExecWrites.cpp to that main, without either production change, builds and fails 3/3 at GCN VOPC v_cmpx (writes both VCC and EXEC) opcode 209 at program counter 60 is not implemented.
  • Main + PR: the same seven controls and agc_driver_gcn_compare_exec_writes pass 3/3 each. The new fixture reaches its final success marker after checking EXEC, VCC and s[8:9] for all seven cases in both modes. The device uses subgroup 64 and supports compute subgroup 32, so neither mode is the narrow-subgroup skip.
  • Restoration: pristine main rebuilt; all seven original controls pass again. Fixture SHA-256 is identical in the negative and positive runs: d8c30be09ecb6c10437db8f571e73d669ce3f8f82b885196608721229bcf4273.

All 55 individual invocations confirm the RX 9060 XT and actual Insert instance layer "VK_LAYER_KHRONOS_validation". Zero skips, Khronos validation errors/warnings, VUID- or SYNC-HAZARD- diagnostics. Both trees have the same unrelated implicit liblsfg-vk-layer.so loader diagnostic and RADV testing warning; those are not counted as validation-layer findings.

Environment: CachyOS Linux, kernel 7.3.1-1-cachyos; AMD Radeon RX 9060 XT (1002:7590, RADV GFX1200), Mesa 26.2.5-arch3.1, Vulkan 1.4.354; Khronos validation 1.4.363; GCC 16.2.1, Release, BUILD_TESTING=ON, existing ANYPS5_ENABLE_SPIRV_TOOLS=OFF configuration.

Reproduction

On main, build and run these seven entries; on the merge, add agc_driver_gcn_compare_exec_writes. Build their corresponding _tests targets with cmake --build build-main --parallel 4 --target ....

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=error

For the negative control, take only core/libs/prx/libSceAgcDriver/tests/execution/GcnCompareExecWrites.cpp from the exact PR head onto main, build agc_driver_gcn_compare_exec_writes_tests, then run its CTest entry three separate times. Main's existing execution-test glob registers it; no CMake or production modification is needed.

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).

@oneandonlydean oneandonlydean self-assigned this Nov 3, 2026
@oneandonlydean
oneandonlydean merged commit 99bf42a into boykopovar:main Nov 3, 2026
10 checks passed
@github-actions github-actions Bot removed the review queue Next in the maintainer review queue: checks pass, no open change request, no conflict label Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc* build docs shader core/shader unblocks title Names a title ID on the Unblocks line

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants