feat(agc): accept the GFX10 packet forms RADV emits #1917
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1917"
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 TheAggie on 2026-10-08T23:45:03Z.
What
RADV on the PS5 (mihawk-99/PS5_Mesa) builds its own command streams, as on Linux. Its preamble, draws and dispatches use packet forms the PM4 validator refused, so ccleste's (PPSA59322) command buffers were rejected.
Two commits.
Graphics preamble and draws:
CONTEXT_CONTROLthat only updates the load and shadow enables to zero, which RADV emits when it does not shadow registers. It is a no-op. Any enable bit, a compute queue, or a short packet is still rejected.SET_UCONFIG_REG_INDEXofVGT_PRIMITIVE_TYPEwith index 1, next to the index-2VGT_INDEX_TYPEwrite already accepted.WRITE_DATAto memory (DST_SEL5) from the graphics queue.EVENT_WRITEPIPELINESTAT_START(25),PIPELINESTAT_STOP(26),SQ_NON_EVENT(38) and, on the graphics queue,VGT_FLUSH(36). The statistics counters are not modelled, and the events that would read them stay rejected.ACQUIRE_MEMover the full 48-bit range (COHER_SIZE_HIandCOHER_BASE_HI); the bits above 48 are still rejected.Dispatches and register loads:
DISPATCH_DIRECTandDISPATCH_INDIRECTwith theSHADER_TYPEheader bit, which RADV sets on every dispatch, as other packets already may.FORCE_START_AT_000in the dispatch initiator. The driver never offsets dispatches byCOMPUTE_START_X/Y/Z, so they already start at zero.LOAD_CONTEXT_REG_INDEX,LOAD_SH_REG_INDEXandLOAD_UCONFIG_REG_INDEXin their consecutive-register form (a register offset and a count,DATA_FORMAT0). RADV uses it to loadDB_STENCIL_CLEARandDB_DEPTH_CLEARfrom an image's clear values. The offset-and-data form keeps its old checks.The four vkQuake commits added after review started (partial last thread group,
COPY_DATAto context registers,COPY_DATADST_SEL5, in-order dispatches) and the two that followed (indirect draw register location 0, 4-byte-aligned indirect argument bases) are no longer in this PR, as requested in review. They change how many threads a dispatch runs and how indirect draws and dispatches are decoded, so they will go to their own PR. That one waits until I am allowed to open new PRs again.Tests (
agc_driver_pm4): each accepted form, and next to it the neighbouring form that is still rejected (an enable bit inCONTEXT_CONTROL, a wrong index bank, event indices on the statistics andVGT_FLUSHevents,VGT_FLUSHon a compute queue, an unrelated event type, dispatch modifiers beyondFORCE_START_AT_000,ACQUIRE_MEMrange bits above 48, and an out-of-range register in the consecutive load form). Each new check fails with its change reverted.RADV's other packet,
DMA_DATAtoDST_SELNOWHERE (its L2 prefetch of shader code), is not here: #1709 implemented it and is merged.Tested
Windows 11 Pro (26200), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release, NVIDIA GeForce RTX 5070 Ti.
mainecd3dbadbwith only the first two commits. Full suite: 512 of 515 pass, 1 skipped. The two failures,agc_driver_prepared_shaders_debug_failureandagc_driver_f32_arithmetic_nan, fail the same way on cleanmainecd3dbadbon this machine. It was run from the generatedCTestTestfile.cmakecommands because antivirus blocksctest.exeon this machine.tools/check_conventions.pypasses.Not tested on AMD, Intel, Linux or macOS. Earlier, @johnmaia ran the full suite on an RX 7600 (RADV) with the eight-commit head: 494/494.
Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)Pm4.cpp, is closed)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by klosixgaming-arch on 2026-10-09T00:47:18Z.
Review: APPROVED
I can approve this. It meets the "cited source / measured" bar for shader/GPU behaviour, which is the one thing I hold these PRs to hardest.
CONTEXT_CONTROL, a wrong index bank, stats/VGT_FLUSHevent indices,VGT_FLUSHon compute, dispatch modifiers beyondFORCE_START_AT_000,ACQUIRE_MEMbits above 48, out-of-range consecutive-load register). Accept-then-reject is how you keep the boundary tight.case 0x28: return;forCONTEXT_CONTROLis defensible because you only accept the form that zeroes the load/shadow enables and rejects any enable bit, compute queue, or short packet. It's a no-op, not a guess.DMA_DATAto NOWHERE to #1709 rather than half-implementing it here — good scope discipline.Non-blocking notes:
FORCE_START_AT_000rationale ("the driver never offsets dispatches byCOMPUTE_START_X/Y/Z") is a claim about RADV specifically. If a different RADV build or a future one did offset, this silently accepts it as zero. Worth one sentence in the debt entry that this assumesCOMPUTE_START_X/Y/Zare zero for GFX10 dispatches.Written with AI assistance.
Imported from boykopovar/AnyPS5. Originally posted by johnmaia on 2026-10-09T01:01:38Z.
Linux run on AMD, since the description lists it as not tested: Ubuntu 24.04.5 (kernel 6.8), GCC 13.3, Release, AMD Radeon RX 7600 (RADV NAVI33, Mesa 25.2.8). This PR's head
0b7d1cb6, merged ontomainf1451396. Full ctest: 494/494 pass, the same asmainon this machine, with the GPU tests running on the RX 7600 (none skipped). That includesagc_driver_pm4with this PR's new packet cases.Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-09T09:22:44Z.
Please move the four commits added for vkQuake (partial last thread group,
COPY_DATAto context registers,COPY_DATADST_SEL5, in-order dispatches) into a new PR. They change how many threads a dispatch runs, so they need their own review; this one can stay the ccleste packet forms.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-10T05:58:14Z.
Review: CHANGES_REQUESTED
Following @oneandonlydean's request above, which is still open:
run RADV's dispatches with a partial last thread group,load context registers from memory with COPY_DATA,accept COPY_DATA to memory through DST_SEL 5,accept dispatches that launch waves in order. They change how many threads a dispatch runs, so they need their own review.read indirect draw register location 0 as no register,accept 4-byte-aligned indirect argument bases) also come from vkQuake and change indirect draw/dispatch decoding, so they belong in the new PR as well.CONTEXT_CONTROL,SET_UCONFIG_REG_INDEX,WRITE_DATADST_SEL 5, the events,ACQUIRE_MEM,DISPATCH_*header bit /FORCE_START_AT_000,LOAD_*_REG_INDEX), with the matching tests and theDispatch.cpp/ShaderInputState.cpp/Graphics.cppchanges they need. Update the PR body to match.Pm4.cpp; list it under Depends on if the split still touches the same lines.Once split, this is ready for another look.
Imported from boykopovar/AnyPS5. Originally posted by TheAggie on 2026-10-10T07:14:59Z.
@adriadam10 @oneandonlydean the split is done. This PR now holds only the first two commits, the ccleste packet forms, rebased onto
mainecd3dbadb, and the description is updated to match.The six vkQuake commits (partial last thread group,
COPY_DATAto context registers,COPY_DATADST_SEL5, in-order dispatches, indirect register location 0, 4-byte-aligned indirect bases) are kept on a separate branch for their own PR. I'll open that once I'm allowed to open new PRs again.The
DMA_DATAprefetch overlap is gone, since #1709 is merged, and #2156 is closed. Full suite on Windows: 512 of 515 pass, 1 skipped. Both failures (agc_driver_prepared_shaders_debug_failure,agc_driver_f32_arithmetic_nan) also fail on cleanmain.AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-10T08:09:34Z.
Review: APPROVED
Checked the build and the scoped ctest for libSceAgcDriver (312/312,
agc_driver_pm4included) on Linux, and that the newPm4.cpptest cases fail with the validator change reverted. The split @oneandonlydean asked for is done, and each accepted form has its still-rejected neighbour in the tests. Merging.