feat(agc): emit the remaining workload packets for registered streams #6128
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/6128"
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 fdfawef324 on 2026-10-14T22:52:45Z.
What
sceAgcAcbSetWorkloadsActive,sceAgcAcbSetWorkloadComplete,sceAgcAcbSetWorkloadStreamInactiveandsceAgcDcbSetWorkloadStreamInactivethrewNotImplementedfor a registered workload stream.Relation to #4709
#4709 made these four return null for a null buffer or an unregistered stream. It kept the registered case throwing because the console packet is not measured, and KytyPS5 (
IT_NOP) and OpenAGC (SET_UCONFIG_REG, WRITE_DATA, SET_WORKLOAD) disagree on the layout. This PR does not claim to know the console packet either. It writes anIT_NOPof the console sequence's size, and for each sequence it says what the console packet does and what is dropped here. The sequences are from OpenAGCagc_workload_packet.c, with exact bytes in its test.0xcc000000 | streamIdand 0 to 0x342 and 0x343. WRITE_DATA (5): 0 to register 0xc343. No SET_WORKLOAD, no slot addressIT_NOP: stream id, seven zero dwords0xcc000000 | streamIdand the low mask to 0x342 and 0x343. WRITE_DATA (5): the high mask to 0xc343. SET_WORKLOAD (0x1e, 9): control word, stream slot address, maskIT_NOP: stream id, 64-bit mask (KytyPS5, onmainfor the DCB since #3789)0xcd000000 | workloadId << 5 | streamIdto 0x342. SET_WORKLOAD (9): control word, slot address, clear mask. No WRITE_DATAIT_NOP: stream id, workload id, 64-bit clear mask (KytyPS5, onmainfor the DCB since #3789)SQ_THREAD_TRACE_USERDATA_2and_3, at 0x30D08 and 0x30D0C in Mesa's gfx10.json and gfx103.json. RADV writes its RGP markers to them two dwords at a time (radv_sqtt.c). They only feed SQ thread traces, which are not emulated. The AGC driver already drops libSceAgc's predicated tag writes to 0x342 as carrying no register state (IsTagMarkerinPm4.cpp). Stream inactive writes nothing else, so its 9-dword NOP has the console's effect apart from the thread trace.SceGnmGpuInforegion at offset 0x3A000 (driver_prospero.c). It publishes the region as theSce.Debug:Gnmprocess property, namedSceGnmDumpArea(L925-L940). It is driver memory, not title memory. This write is dropped here, and its effect is not verified. OpenAGC keeps its own use of the sequence disabled on firmware 11.60 after its submissions stalled (L1736-L1742). The DCB active and complete calls onmainhave dropped this write since #3789; this PR does the same for the ACB.0xc0027904becomes0xc0027900) and bit 30 of the SET_WORKLOAD control word. TheIT_NOPform carries neither, so here the ACB and DCB calls write identical packets.So the case against #4709's throw is that the dropped effect is limited to the thread trace and a driver-owned table, that the debt entry records both, and that
mainhas used the same stand-in for the DCB since #3789. Keeping the throw remains the alternative if that is not enough.Changes
DcbState/src/Workload.cpp: the DCB active and complete encoders move intoAgc::Workload::WriteActiveandWriteComplete, and a newWriteStreamInactiveis added. The DCB exports call them; their arguments are renamed to camelCase. The ACB exports inAcb/src/Control.cppcall the same functions.Pm4::Validateaccepts a plain NOP (custom field 0) on graphics and compute queues when it is not predicated. Its only check, against0x6875xxxxflip markers, cannot match a stream id of 1 to 31.Pm4::Executereturns at once for it.Pm4::Validatethrows on a NOP with the predicate bit set. So a workload packet predicated bysceAgcSetRangePredicationorsceAgcSetPacketPredicationthrows at submission. EveryIT_NOPlibSceAgc writes already behaves this way, including markers and the DCB workload packets onmain. Accepting a predicated plain NOP inValidateis a separate change.docs/dev/debt/libSceAgc.md: the two workload entries are merged into one. It describes each sequence separately, the effect argument above, the dropped SET_WORKLOAD write, the ACB control flag and the predication gap. The KytyPS5 link is pinned to 6f0cddd, whoseagc.cppis identical to KytyPS5maintoday.Title IDs: none in
core/. No title was run. No title is shown calling these functions on a registered stream, so nothing is claimed to be unblocked.Tested
Windows Server 2025 (10.0.26100), AMD Ryzen 9 5900X, WinLibs MinGW-w64 GCC 15.2.0, Ninja, Release,
BUILD_TESTING=ON. Rebased onmaineea428ca8.testRegisteredWorkloadStreamsinagc_commands:0xdeadbeef.0x00000001,0x80000002). Checks the inactive packet (headerHeader(0x10, 9, 0), stream id, seven zero dwords) and that nothing was written past it.IT_NOPstand-in. It is not console parity: the console ACB and DCB sequences differ by the control flag above.AgcDriver::Pm4::Validate/Executeon queue 0, and each ACB packet on compute queue 0x20.testWorkloadStreamsthat expected the registered calls to throw.main'sWorkload.hpp,Workload.cppandControl.cpp,agc_commandsfails withsceAgcAcbSetWorkloadsActive not implemented.agc_commandspasses (0.24 s).agc_initialization,agc_commands,agc_platform_tests,agc_semaphore_tests,agc_packet_info_tests,agc_register_command_tests,agc_cb_cond_write_tests,agc_payload_range_tests,agc_end_of_shader_action_size_tests,agc_branch_patch_tests,agc_predication_tests,agc_shader_fusion,agc_context_state_size_tests,agc_interpolant_mapping,guest_shader_link,agc_gs_oversubscription_tests,agc_gs_prim_payload_tests,agc_dma_data_tests,agc_write_data_patch_tests,agc_prime_utcl2_tests,agc_cond_exec_patch_tests,agc_shader_helpers,agc_driver_pm4,agc_driver_pm4_failureandguest_agc_driver_resources.tools/check_conventions.pyfrommaineea428ca8, with--titleand--body: passes.Not tested: Linux, macOS, titles, Vulkan rendering. No test here does GPU work; the driver check is PM4 validation and execution on the CPU.
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)Pm4::Validate/Executeon the CPU, no GPU work)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-14T22:53:26Z.
Progress report (
6239cef→b09bf23)📈 System libraries: 88.8% (+0.11%, +4 implemented functions)
✅ 4 implemented
sceAgcAcbSetWorkloadCompletesceAgcAcbSetWorkloadStreamInactivesceAgcAcbSetWorkloadsActivesceAgcDcbSetWorkloadStreamInactiveImported from boykopovar/AnyPS5. Originally posted by fdfawef324 on 2026-10-14T23:15:42Z.
Closing this myself to respect the queue policy in #4826: no title has been shown to stop here on
mainyet. The branch stays on my fork; I'll reopen it with the title ID and the log line if one of the titles I run (Demon's Souls, GTA V, Black Myth: Wukong, Resident Evil 4, Astro Bot) stops on it.AI-assisted: yes
Pull request closed