feat(agc): skip draws whose graphics stage the recompiler refuses behind APS5_SKIP_REFUSED_DRAWS #8206
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/8206"
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?
Imported from boykopovar/AnyPS5. Originally posted by Celegans12 on 2026-10-20T03:05:27Z.
What
When the recompiler refuses a graphics stage while a draw builds it, the packet worker fails the queue and the next
SubmitorWaitIdlerethrows the error, which ends the title. That's the right default. But on a host where some stages are refused it ends a bring-up run at the first one: on lavapipe's 8-lane subgroups Dextroid17's Yōtei runs abort at pixel shader 0x80002e6d00, and they asked for this switch in #675. So it's opt-in and off by default.APS5_SKIP_REFUSED_DRAWS(set = on): an error whilematerializeDrawStageprepares, captures or recompiles a stage becomes aRefusedDraw. The packet loop skips that draw, counts it as a thrown skip, runs the rest of the submission and logs[gpu] APS5_SKIP_REFUSED_DRAWS: skipping the draws that use shader 0x...: <first line of the error>once per shader.ENVIRONMENT.mdrow and alibSceAgcDriverdebt line describe it.Overlaps: #7682 keeps prepare-at-use failures, which would make the repeat cheap; independent. #7689 edits the same test file (small rebase for whichever lands second). #7201, #7332 (
Diagnostics.hpp/.cpp) and #7683 (ENVIRONMENT.md) add lines next to ours, textual only.Tested
-DBUILD_TESTING=ON, RTX 3080 Laptop: the newagc_driver_draw_unsupported_buffer_type_skip_refusedsubmits a draw whose pixel shader is refused (V# type 2) twice with the switch; both times theWRITE_DATAafter it lands, the color target stays untouched, and the skip is logged once. It fails onmain(the queue fails with the refusal).agc_driver_draw_unsupported_buffer_type(switch unset) still gets the named error. With the related prepared-shader, tessellation, graphics, pm4, draw cache, image table, buffer descriptor andagc_shader_*tests: 64/64 withANYPS5_REQUIRE_VULKAN=1, and the two draw tests log noVUID-underVK_LAYER_KHRONOS_validation.maina020d025: 56/56 of those tests.Checklist
main; no other open PR implements the same functionsNotImplemented_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)Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-20T03:12:00Z.
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
main)docs/dev/debt/libSceAgcDriver.mdL100docs/dev/debt/libSceAgcDriver.mdL100Some 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.
core/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketExecution.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketExecution.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawCapture.cppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketExecution.cppdocs/dev/ENVIRONMENT.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawCapture.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketExecution.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtdocs/dev/ENVIRONMENT.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawCapture.cppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketExecution.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketExecution.cppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawCapture.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketExecution.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtdocs/dev/debt/libSceAgcDriver.mddocs/dev/ENVIRONMENT.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawCapture.cppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketExecution.cppcore/libs/prx/libSceAgcDriver/tests/execution/DrawUnsupportedBufferType.cppdocs/dev/ENVIRONMENT.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawCapture.cppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketExecution.cppdocs/dev/ENVIRONMENT.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/include/Driver/Diagnostics.hppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Diagnostics.cppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawCapture.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/ENVIRONMENT.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtdocs/dev/ENVIRONMENT.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawCapture.cppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketExecution.cppdocs/dev/ENVIRONMENT.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/tests/execution/DrawUnsupportedBufferType.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtdocs/dev/debt/libSceAgcDriver.mddocs/dev/ENVIRONMENT.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtdocs/dev/debt/libSceAgcDriver.mddocs/dev/ENVIRONMENT.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtdocs/dev/ENVIRONMENT.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtdocs/dev/ENVIRONMENT.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtImported from boykopovar/AnyPS5. Originally posted by Dextroid17 on 2026-10-20T16:06:01Z.
@Celegans12, thanks for opening #8206. I ran Yōtei on lavapipe with it this morning. Here is what it did.
Setup:
llvmpipe (LLVM 23.1.1, 256 bits)from my own Mesa 26.2.4 build (its one local patch switched off), PPSA26344. Base ismainatb106f6f8c(not the current tip) plus #8206 (b25874e0c, hand-applied because my base doesn't have themeshBarycentricsparameter yet). The run branch also carries 16 other unpushed local commits: my one-lane vertex work, the min/max RG32F carry, ShaderDiskCache assert bumps, memory probes, and shader-cache memory changes.APS5_SKIP_REFUSED_DRAWS=1,APS5_NO_PIPELINE_JOURNAL=1, 40-minute limit.The switch fired once, at presented frame 690, about 27 minutes in:
After it the game presented three more frames, up to 693, with no abort and no
what().0x80002e6d00 was never requested in this run, or in my two earlier lavapipe runs with the switch set (both also reached frames 689-693). So the abort you wrote this for is still untested here. I'll send you the line if it comes up.
The run stopped presenting at frame 693 and stayed there for about 13 minutes, until my time limit. I don't think that's #8206. A profile taken during the stall shows one thread at full CPU, mostly in LLVM's
PromoteMemToReg, and the main thread spinning at 100% at one app.elf address. My stack unwinding didn't get through libLLVM, so I can't yet say what is being compiled. One earlier run without the switch also stopped at frame 693 and stayed there for about 6 minutes, and two others hit the time limit at frames 695 and 699, just past the same point, so I'm looking into it separately.One small thing: GitHub shows #8206 as conflicting with
main.Written with AI assistance.
Imported from boykopovar/AnyPS5. Originally posted by Celegans12 on 2026-10-21T02:42:48Z.
Thanks for running it on lavapipe and for the detailed log.
From your log, the switch did what it should: it fired once, at frame 690, for 0x80003c5100 (the
v_permlanex16_b32refusal on the 8-lane subgroup), and the game presented three more frames with no abort. I agree the stall at 693 doesn't look like #8206. A run without the switch stopped at the same frame for about six minutes, and the other two only got a few frames further. My guess from thePromoteMemToRegprofile is that llvmpipe is compiling one very large shader there, but I haven't checked that.It's a pity 0x80002e6d00 hasn't come up yet, since that's the abort I wrote this for. If it shows up in a later run, could you paste the
APS5_SKIP_REFUSED_DRAWSline and the few lines after it? The conflict is fixed too: the branch is rebased onto current main (d4408699d).Imported from boykopovar/AnyPS5. Originally posted by Dextroid17 on 2026-10-21T03:12:45Z.
Thanks for the rebase; the runs below carry the earlier head (b78c9a508), which should not matter for what follows. Your guess checks out: it is one very large compute shader, and I can reproduce the hang outside the game.
Run 30 (lavapipe
llvmpipe (LLVM 23.1.1, 256 bits), Mesa 26.2.4; tree = mainb85d972f4+ #8206 b78c9a508 + #8747 + #8431;MESA_SPIRV_DUMP_PATHset) stalled at frame 707 the same way. The 0x80003c5100 deferral logged at t≈1861 s (frame 706). One worker thread was busy around t=1750–1840 s, slept again briefly, then ran at 100 % continuously from t≈1900 s until the process died with SIGSEGV at t≈3770 s, with 30 % of its samples inllvm::PromoteMemToReg.I replayed the 20 compute shaders dumped in that window through a bare Vulkan harness (one compute pipeline,
vkCmdDispatch(1,1,1), spec constants at default) on the same ICD. All 20 create a pipeline, in 0.01–34 s. I dispatched the 9 larger than 400 KB: the harness binds no images, so 7 of those segfault at first dispatch and tell me nothing; 1 returns in 4 s; and one never returns:0xdcc0b0cc9d70618f600faa79c2b91ff3c9bdf972828f6e5eb6a7ee81994515a1.comp, 774 832 bytes, dumped at t≈1859 s. Its pipeline creates in 33 s, then the first dispatch was still running when a 900 s timeout killed it, one thread at 100 % inllvm::PromoteMemToReg(68 % self), in the samelibLLVM.so.23.1code region (0x4b8c5f0–0x4b8c700) the in-game thread sampled.spirv-disgives 3104 basic blocks, 1297OpSelectionMerge, 33 loops and a 77-wayOpSwitch. That fits the in-game stall (same function, same code region, the shader dumped ~40 s before the thread went continuously busy), and the harness has none of AnyPS5 in it, so the hang does not need #8206 to happen. Whether mem2reg is looping or merely super-linear I have not established (RSS was flat at 2.4 GB when I sampled it). I will take it to Mesa.On the switch itself:
APS5_SKIP_REFUSED_DRAWSwas set in run 30, but 0x80003c5100 took the deferral path at pipeline creation, so the run never reached the skip path and says nothing about the switch either way. 0x80002e6d00 still has not appeared: 0 hits in runs 27, 28 and 30 (run 29 was a 600 s smoke run that stopped at frame 228). If it shows up, I will paste the skip line and what follows.Imported from boykopovar/AnyPS5. Originally posted by Celegans12 on 2026-10-21T06:18:28Z.
Thanks for chasing this down. A bare harness that hangs on that one 775 KB compute shader in
llvm::PromoteMemToReg, with none of AnyPS5 in it, settles it: the stall at 693/707 is lavapipe's, not #8206's. Good luck with the Mesa report. And thanks for pointing out that 0x80003c5100 took the deferral path in run 30, so that run says nothing about the skip either way. If 0x80002e6d00 does show up, send me the skip line and I'll look at it.Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-21T06:20:57Z.
@Celegans12 thanks, agreed on both. Full CI on
d4408699d3is next, with the skip test as the check on Linux.Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-21T06:45:23Z.
@Celegans12 thanks for the rebase onto current
main. A quick check of952ddb784is next, then full CI.