feat(libs): implement the AMPR nops and the 04_00 completion writes #580
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/580"
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 CnRJay on 2026-10-04T23:28:53Z.
What
Depends on #579, whose commits are included here; only the last commit is new. It reuses the validation added there.
14 libSceAmpr exports threw
NotImplemented. Signatures and argument checks follow ampr_emu; only signatures and documented behaviour are taken, no code.sceAmprCommandBufferNop(n)(1..16 dwords) andsceAmprCommandBufferNopWithData(n, data)(0..15 payload dwords) record aNopwith the payload copied. The executor already skipsNop.sceAmprMeasureCommandSizeNop(n)returns the size ofNop(n).sceAmprMeasureCommandSizeNopWithData(n)returns the size ofNopWithData(n - 1). ampr_emu reports that retail measures the total record dwords there, while the append takes payload dwords.datawith a non-zero count throws, since that behaviour is unknown.sceAmprCommandBufferWaitOnAddress_04_00takes the extended compare set: 4 >= wrapped, 5 > signed, 6 < signed. It needs a non-null aligned address. The executor handles these values since #579.sceAmprCommandBufferWriteAddressFromTimeCounter_04_00,WriteAddressFromCounter_04_00,WriteAddressFromCounterPair_04_00andWriteKernelEventQueue_04_00record the same commands as theirOnCompletionforms.sceAmprMeasureCommandSize*_04_00forms validate the same arguments and returnEINVALlike the marker measures.Still stubbed: map begin/end, gather/scatter reads, the
_04_00counter waits and writes, andConstructNop/ConstructMarker. They need executor support or semantics that are not documented.tools/progress.py: libraries 2529/3190 (79.28%), +14.Tested
Windows 11, MinGW GCC 15.2.0 r7.
guest_ampr_markersgains two tests:Nopsize against its measure, theNopWithDatapayload and measure, submission, and the rejected counts._04_00waits with compares 4/5/6 on values where the signed and unsigned orders differ, run under a 10 s deadline. Also the_04_00counter, pair and time-counter writes read back after submission, and the rejected arguments and measures.Full
ctest: 216/217 pass.agc_shader_memoryfails without this change too; #574 fixes it.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)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-04T23:44:10Z.
Thanks. The signatures, ranges and checks of the nops, the versioned wait and the versioned writes match ampr_emu (src/sceampr_exports.cpp and src/ampr_emu_command_buffer.cpp at cfa85df3). That includes the NopWithData measure counting the record dwords while the append takes payload dwords. Ignoring the at-start flag gives the same result here, since the executor runs each command only after the previous one has finished. The signed
_04_00row (reference 1, compare 6) is a good one: it would fail with an unsigned compare.Before it goes in:
Nop(n)record is n dwords including its header (ampr_emu's packing gives n * 4 bytes for a nop, and (n + 1) * 4 for a nop with data). Here the emulator's 8-byte command header comes on top, soNop(n)takes 8 + 4n bytes. The measure functions agree with that, so a title that sizes with them works. But a title that pads to an exact offset or the end of the buffer withNop(remaining / 4)getsBUFFER_FULLor a shifted offset. Could you add a line to docs/dev/TechnicalDebt.md for that? The ignored at-start flag could go on the same line.sceAmprMeasureCommandSizeWriteAddressFromCounter_04_00rejects counters of 128 and up, and the pair measure rejectsindex & 0x80, but ampr_emu's measures only check the address, plusindex & 1for the pair. Unless you have another source, I'd match it and adjust the(&single, 128)test row.For context, PPSA21564 imports Nop, NopWithData and most of the
_04_00forms here. They all throw on main and aren't reached in my runs yet, so this makes them usable without changing the current path.The CI run still needs approval. This needs #579 first; the commits it carries are identical to #579's head.
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-04T23:44:46Z.
Progress report (
681f83e→c3ab220)📈 System libraries: 79.91% (+0.43%, +14 implemented functions)
✅ 14 implemented
sceAmprCommandBufferNopsceAmprCommandBufferNopWithDatasceAmprCommandBufferWaitOnAddress_04_00sceAmprCommandBufferWriteAddressFromCounterPair_04_00sceAmprCommandBufferWriteAddressFromCounter_04_00sceAmprCommandBufferWriteAddressFromTimeCounter_04_00sceAmprCommandBufferWriteKernelEventQueue_04_00sceAmprMeasureCommandSizeNopsceAmprMeasureCommandSizeNopWithDatasceAmprMeasureCommandSizeWaitOnAddress_04_00sceAmprMeasureCommandSizeWriteAddressFromCounterPair_04_00sceAmprMeasureCommandSizeWriteAddressFromCounter_04_00sceAmprMeasureCommandSizeWriteAddressFromTimeCounter_04_00sceAmprMeasureCommandSizeWriteKernelEventQueue_04_00Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-05T01:18:24Z.
Thanks,
6f5cb736covers both: the TechnicalDebt line records the Nop and NopWithData sizes against the console records and the ignored at-start flag, and the two measures now check only what ampr_emu checks (the address, plus an even start for the pair), with the 128 rows flipped to expect a size.#579 is on main now, and merging this branch into it gives a conflict in docs/dev/TechnicalDebt.md, a leftover of the two separate merges of main. The resolution is to keep your "AMPR command sizes" line under main's pair line; the code merges cleanly, and with that resolution
guest_ampr_markerspasses here. After that update it's ready to merge from my side (CI is green on7030c57).Imported from boykopovar/AnyPS5. Originally posted by alfalfa-star on 2026-10-05T18:05:45Z.
Tested
7030c573with LEGO Horizon Adventures (PPSA14632, Unreal Engine), Arch Linux, GCC 16.2, Release, on top of main0518f0e0together with #672, #722, #723 and local throwing stubs for the title's other missing imports.Without this PR the title stops right after Unreal starts its first worker thread:
With it the title continues through its config, key-value store, crash report client and localization setup and starts more threads, until
sceVoiceQoSInit, which is not implemented and unrelated to AMPR. The AMPR tests pass on this combination.