fix(agc): decode a fast-launch draw as one point per subgroup whatever its input type #8395
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/8395"
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 hugodearaujo on 2026-10-20T12:06:38Z.
What
DecodeStateacceptsVGT_SHADER_STAGES_EN.GS_FAST_LAUNCH = 1only with a point list inVGT_PRIMITIVE_TYPE(#4702). A fast-launch draw with any other type and the sameGE_CNTLgroup of one vertex and one primitive stops the title withfast launch other than one point per subgroup is unsupported.This PR decodes such a draw as one point per subgroup whatever
VGT_PRIMITIVE_TYPEholds:radv_shader_info.c;ac_nir_lower_ngg_mesh.c: "the vertex ID which is equivalent to the index of the current workgroup within the current dispatch").GE_CNTLasks for one vertex per subgroup, which no line or triangle can fill, so the type cannot be what sizes the subgroup.Other group sizes, fast launch 2 and indexed fast-launch draws still throw; the message for other group sizes now reads
fast launch other than one vertex and one primitive per subgroup is unsupported. That a console starts one subgroup per vertex for a line or triangle type is assumed, not measured, and the technical debt entry says so.Title
CONTROL Resonant (PPSA34547) makes fast-launch draws with
VGT_SHADER_STAGES_EN0x482030,VGT_PRIMITIVE_TYPE6 (triangle strip) andGE_CNTL0x201 right after New Game, as @ps54all reported in #7302; they got past it with a local change that treats the input as a point list.On
main06d97be8bwith #7064 (needed to reach New Game), Linux, RX 9070 XT with RADV, in the same run directory with onlylibSceAgcDriver.prxswapped:Shader 0x10041aa500 could not be prepared when the title created its pipeline (AGC graphics: VGT_SHADER_STAGES_EN=0x482030: fast launch other than one point per subgroup is unsupported);APS5_TRACE_DRAW_PROGRAMSshows 6 of those 8 programs drawn on the mesh path (0x10041aa50060 times). I stopped the run there.Further on, the title loses the GPU after New Game with or without this PR: the run without it lost the device 2 min after New Game, before any of those programs was drawn. That loss is tracked in #7302.
Tested
main5454cd2e45merged in (f29635063c), by a merge commit; history is not rewritten.State.cppconflicted becausemainmoved the geometry subgroup decode into ameshConfiguration(inputPrimitive, fastLaunch)helper that the tessellation-geometry path also uses. The resolution keeps that helper and makes the same change as before: the fast-launch check no longer requires a point list, and the geometry path passes a point list as the input primitive for a fast-launch draw (meshConfiguration(fastLaunch ? 1u : primitive, fastLaunch)). The tests and the debt entry merged without conflicts. Againstmain, the diff is still 4 files, +16/-6.Paired validation on one machine and GPU: AMD Radeon RX 9070 XT (RADV GFX1201, Mesa 26.2.6), Arch Linux with kernel 7.2.11, GCC 16.2.1, Release.
ctest -V -R '^(agc_driver|agc_driver_graphics|agc_driver_mesh)$'withVK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation(Khronos layer 1.4.363),ANYPS5_NO_SHADER_CACHE=1,ANYPS5_REQUIRE_VULKAN=1andVK_LOADER_DEBUG=layer:Insert instance layer "VK_LAYER_KHRONOS_validation"was not found but was requestedVUID-linesmain5454cd2e45f29635063cIn each run
agc_driverinserts the layer twice andagc_driver_meshonce;agc_driver_graphics, which holds the decode test, creates no Vulkan instance.Negative control,
main5454cd2e45with only this PR's test changes, same settings: both tests that hold the new checks fail.agc_driver_graphicsfails withAGC graphics: unexpected failure: AGC graphics: VGT_SHADER_STAGES_EN=0x482030: fast launch other than one point per subgroup is unsupported, andagc_driverwitha registered fast-launch program resolved with a triangle strip was not prepared as for a point list.agc_driver_meshpasses.c65b4eff5f, on top of that head, only adds type 21 (the polygon type, whichDecodeStatealso accepts on this path) to the decode test: the three tests pass on it with the layer inserted and noVUID-lines.agc_driver_graphics: with fast launch andGE_CNTL0x201,VGT_PRIMITIVE_TYPE2 to 6 and 21 decode as the point list does (one point per subgroup,PRIM_AMP_FACTORprimitives);GE_CNTL0x402 is still refused.agc_driver: the registered fast-launch program from #6150 is resolved with a triangle strip before the point list, and the point list has to reuse the artifact the strip prepared (Driver::PreparedEntryHashesis the same after both resolves). On the RX 9070 XT the strip prepares one entry, with the same hash as the entrymainprepares for the point list. Withmain'sState.cppthe strip's decode fails and the stage stays deferred (without a log line, since it is already deferred at registration), so the point list prepares the program itself and the check fails. A device that cannot prepare the program for either type has nothing to compare; the decode itself is covered byagc_driver_graphics, which needs no GPU.The fast-launch mesh draws of
agc_driver_meshpass unchanged: the draw side still receives a point list.Earlier revisions of the same change, not repeated on this base:
-j8,ANYPS5_REQUIRE_VULKAN=1andANYPS5_NO_SHADER_CACHE=1on the same machine, onmain74acfad65b:mainandfb4caca45f(the head before its last, test-only commit) both pass 2396 of 2431 tests. On both, the same 34 tests are skipped andagc_driver_tessellationsegfaults (#5444).BUILD_TESTING=ON, onmain06d97be8b. The VM has no GPU, so the GPU tests do not run there: of 1704 tests, 1077 pass, 627 are skipped, nearly all of them GPU tests (agc_driverandagc_driver_meshamong them), and none fails.agc_driver_graphics, which holds the decode test above, runs and passes there.75720e0de, run by @TheSovietWaffle: on an RTX 3080 (NVIDIA 617.42) and an AMD Radeon RDNA 2 iGPU (1002:164e, 32.0.21045.5002),agc_driver_graphics,agc_driver,agc_driver_meshandagc_driver_tessellationpass 3 of 3 on both GPUs (that Radeon driver reports no mesh shaders).main06d97be8bwith #7064.tools/check_conventions.py --base origin/main --head f29635063cwith this title and description passes, andgit diff --checkis clean.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 hugodearaujo on 2026-10-20T12:17:53Z.
On the two pull requests with conflicting lines, neither implements this change nor depends on it:
DecodeShaderStagesinto ameshConfiguration(inputPrimitive, fastLaunch)lambda, to draw tessellation followed by an NGG geometry stage, and keeps fast launch limited to a point list. Whichever lands second passes a point list to the lambda for a fast-launch draw (fastLaunch ? 1u : primitive) and keeps this PR's check on the group size.VGT_GS_OUT_PRIM_TYPEcheck on the line above and adds a technical debt entry next to the GS_FAST_LAUNCH one; the two only touch neighbouring lines.Imported from boykopovar/AnyPS5. Originally posted by TheSovietWaffle on 2026-10-20T13:47:50Z.
NVIDIA and AMD proprietary data point: RTX 3080 (NVIDIA 617.42) and AMD Radeon RDNA 2 iGPU (
1002:164e, 32.0.21045.5002), Windows 10 Pro 22H2, WinLibs GCC 15.2.0, Release, head75720e0de:agc_driver_graphics,agc_driver,agc_driver_meshandagc_driver_tessellationpass 3 of 3 on both GPUs (this Radeon driver reports no mesh shaders).AI-assisted: yes (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by hugodearaujo on 2026-10-21T12:23:02Z.
@TheSovietWaffle Thanks, that is the first run of this change on NVIDIA and on AMD's own driver; I only had RADV. I added it to the Tested section.
Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-10-29T13:00:36Z.
Review: APPROVED
Reviewed — approved
The change decodes a
GS_FAST_LAUNCH = 1draw with a one-vertex, one-primitiveGE_CNTLgroup as one point per subgroup whateverVGT_PRIMITIVE_TYPEholds. It merges cleanly, builds, and the focused AGC tests pass with the Khronos validation layer and noVUID-lines on either side. The negative control fails both new checks on an NVIDIA GPU as well as on the author's RADV.What I ran
f29635063ca9e80488a1f6f18b1e4d12147e3742main:899ae3d1ad32ccea94dc24e66fdc948ce8a88171main+ head,--no-ff):d99ad97ab97e7d05f3625c86c3646bacc1e270fa, no conflictsResults
maingit diff --checktools/check_conventions.py --base origin/mainAll conventions checks passed.libsand the three test targets)agc_driver,agc_driver_graphics,agc_driver_meshon the merged tree, with validationmainInsert instance layer "VK_LAYER_KHRONOS_validation"main, 3 on the merged treewas not found but was requested by env var VK_INSTANCE_LAYERSVUID-linesagc_driverandagc_driver_graphicsfail,agc_driver_meshpassesMerged tree
main
Negative control
I restored only
core/libs/prx/libSceAgcDriver/Graphics/src/State.cppfrommain, kept the PR's tests, rebuilt and ran the same command. Both tests that hold the new checks fail:Output
This confirms the description's negative control on a second vendor. The
PreparedEntryHashescomparison inagc_driveralso detects the change on NVIDIA, so on this device it is not just two empty sets compared with each other.Findings
Blocking
None.
Non-blocking
state.topologystill followsVGT_PRIMITIVE_TYPEfor a fast-launch draw, so the provoking-vertex checks can refuse the draw with a misleading message.DecodeShaderStagesnow gives the mesh a point list (State.cpp:1332).DecodeStatestill setstopologyfrom the raw type, so types 5 and 21 giveTRIANGLE_FAN(State.cpp:1512-1515). With last provoking vertex observed, a fast-launch draw of type 5 or 21 therefore throwslast provoking vertex is unsupported for triangle fans assembled for a geometry program(Pipeline.cpp:234-236), although this path assembles no fan. A strip type hits the same problem through the per-vertex triangle-strip interpolation check (Pipeline.cpp:242). Both checks throw instead of drawing anything wrong, so this is not a correctness bug. Still, once a title reaches them they will point at the wrong cause. A follow-up could key the fan check onstate.stages.mesh->inputPrimitiverather thanstate.topology.DecodeStatealso accepts type 21 on this path (State.cpp:1513), and now decodes it as a point list. Adding21uto the list would cover every type that the PR newly accepts on the fast-launch path. Types 7, 17 and 19 still throw because they require vertex routing.Not verified
VGT_PRIMITIVE_TYPEunder fast launch. The PR states this as an assumption and records it in the debt entry. I did not check the RADV sources that the description cites.Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-10-29T13:31:20Z.
Review: APPROVED
Re-checked — approved
The only new commit,
c65b4eff5f, addsVGT_PRIMITIVE_TYPE21 to the fast-launch decode test, as my previous review suggested. The merge with currentmainis clean, the focused AGC tests pass with the Khronos validation layer and log noVUID-lines on either side, and the new type 21 case fails on its own againstmain'sState.cpp.What changed since my last review
f29635063c:c65b4eff5f, test only. It changes{2u, 3u, 4u, 5u, 6u}to{2u, 3u, 4u, 5u, 6u, 21u}in the decode loop (tests/Graphics.cpp:1187). Production code is the same as in the commit I approved.c65b4eff5f.mainmoved from899ae3d1adto478b5f1a93.What I ran
c65b4eff5f04f9587d9d220b8e87a654edff093cmain:478b5f1a93c9bb1cb79e7578f4438a42d7381353main+ head,--no-ff):a69d18318712b1c2f42a9f7e5d9fa83b283874a4, no conflictsmaingit diff --checktools/check_conventions.py --base origin/mainAll conventions checks passed.libsand the three test targets), merged tree andmainagc_driver,agc_driver_graphics,agc_driver_mesh, merged tree, with validationmainInsert instance layer "VK_LAYER_KHRONOS_validation"main, 3 on the merged treewas not found but was requested by env var VK_INSTANCE_LAYERSVUID-linesmain'sState.cpp)agc_driverandagc_driver_graphicsfail,agc_driver_meshpassesmain'sState.cpp)agc_driver_graphicsfailsMerged tree
main
Negative controls
The full-loop control fails on type 2 before it reaches 21. So I also ran the loop with type 21 alone, which confirms that the new case covers behaviour of its own and does not just pass because the earlier types pass.
Previous findings
state.topologystill followsVGT_PRIMITIVE_TYPEfor fast launch, so the provoking-vertex and strip-interpolation checks can give the wrong cause. Still open, non-blocking.c65b4eff5fdoes not touch it (Pipeline.cpp:236 on currentmainstill checksstate.topology). The author agrees and plans a follow-up with a test for each check. They also say that neither message appears in their 17 CONTROL Resonant logs (author-reported). Both checks throw rather than draw anything wrong, so a follow-up is reasonable, and I am not holding this PR for it.c65b4eff5f(tests/Graphics.cpp:1187). It passes on the merged tree and fails alone againstmain'sState.cpp(negative control 2).New findings
Blocking
None.
Non-blocking
None.
Not verified
VGT_PRIMITIVE_TYPEunder fast launch. This is unchanged from my last review and is recorded in the debt entry as an assumption.c65b4eff5f. Both are author-reported; I launched no title.