Repository navigation
fix(agc): correct PRIME_UTCL2 arguments and packets - #19191
Conversation
|
@AlexWhitehouse @MauriceSirius: this independent PRIME_UTCL2 correction has mechanical overlap with #16878 (supported-opcode list/catalog count) and #19051 (adjacent, different known.tsv deletions). It does not implement either PR's packet. I propose keeping your older PRs ahead of this one; I will refresh #19191 after either merges, retain both opcode additions (catalog count 58 after #16878), and preserve both sets of oracle removals after #19051. No functional dependency or agreement is assumed. The scoped trial-merge findings are described in the PR. AI-assisted: yes |
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed PR 19191: PRIME_UTCL2 arguments and packets — no blocking findings
Nothing blocks this; the points below are optional.
What I ran
Head SHA 7404465805094d6a48fd3fefb402420b5d2356c8, base main. No build and no tests were run. The review read the diff and the head text through the reader:
python3 repo_read.py search PrimeUtcl2
python3 repo_read.py search "void Validate("
python3 repo_read.py cat core/libs/prx/libSceAgcDriver/Execution/src/Pm4.cpp 299 330
python3 repo_read.py cat core/libs/prx/libSceAgcDriver/Execution/src/Pm4.cpp 420 470
python3 repo_read.py cat core/libs/prx/libSceAgc/CMakeLists.txt 505 530
python3 repo_read.py cat core/libs/prx/libSceAgc/DcbState/include/Display.hpp 1 8
Results
| Check | Result | Note |
|---|---|---|
Build and ctest (agc_prime_utcl2_tests, agc_driver_pm4) |
not run | Author reports 12/12 passed, three repeats per arm |
Six reference packets in tests/PrimeUtcl2.cpp |
not run | Expected words checked by hand against the packet encoding; they agree |
| Test target links the driver | not run | CMakeLists.txt links libSceAgcDriver |
| Opcode catalog count | not run | 57 with this PR; the count of 58 applies once #16878 is also merged |
Findings
Blocking
None.
Non-blocking
core/libs/prx/libSceAgc/DcbState/include/Display.hpp:10— the new declaration spellsstd::uint32_t, while the other declarations in this header use bareuint32_t. Matching the neighbours keeps the header consistent:
uint32_t* APS5_VABI sceAgcDcbPrimeUtcl2(CommandBuffer* buf, uint32_t cachePermission, uint32_t primeMode, const volatile void* address, uint32_t pageCount);
Sources
Not verified
- Build, unit tests and the packet tests were not run here. The author's Linux x86-64 runs are reported, not performed by me.
- The GPU runs (alpha-to-coverage on RX 6650 XT with validation layers) are author-reported only.
- The 131,072-vector comparison against the bundled compatibility
libSceAgcis author-reported. That module is not retail firmware, and the PR claims no new console measurement. - The six console oracle cases in the external prosper golden file were not fetched, so the expected payloads were checked only against the test file.
- The overlap with #16878 and #19051 and the later-main merge preview were not checked. Windows was not tested, as the author states.
- Files read: the diff hunks of all 13 files listed in
files.jsonunderreviewed. Head text only forPm4.cpplines 299–330 and 420–470,CMakeLists.txtlines 505–530 andDisplay.hpplines 1–8. No file was read in full. Excluded by rule: none.
To get this to a good state
Nothing is required.
Optional: the uint32_t spelling in Display.hpp:10 above.
|
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.
Some 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.
|
|
Windows check of head
Not checked: Linux, real titles. AI-assisted: yes |
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — looks good
The change updates the ACB and DCB PRIME_UTCL2 interfaces to take five arguments and emit the corresponding packet. It adds driver validation and handling for the packet and removes the six corrected cases from the known-differences list.
What I ran
No commands were run. The review read 13 of 13 changed files, 96 of 96 added lines, through the repository reader at head e2da8639d3ae5aeec824b70fb4fafc817aa37119, in 2 parts.
Results
| Check | Result | Note |
|---|---|---|
| Change review | passed | Every added line was read. |
| Automated checks | not run | Author-reported results were not independently run. |
Findings
Blocking
None.
Non-blocking
None.
Sources
AnyPS5/docs/dev/debt/libSceAgcDriver.md
Line 486 in e2da863
Not verified
- Console oracle and compatibility library: The packet contract and CPU comparison depend on external console measurements and bundled compatibility-library binaries.
- Physical GPU behavior: GPU validation-layer runs and physical alpha-to-coverage regression behavior require GPU hardware and measurements.
To get this to a good state
Nothing is required.
e2da863 to
fd11aed
Compare
|
Refreshed on main Fresh Linux: change passes all four focused gates; control exposes the two expected failures. Raw oracle 209 compared each, 147 to 141 known findings: exactly six PrimeUtcl2 cases fixed, no new/stale AGC-profile findings or kind changes. Physical RX6650XT/validation1.4.363 on each arm, zero skips/VUIDs. Full SDK/relinker builds pass and both 836-file banks stay unchanged. Verified evidence. Mechanical overlap with #19051 remains separate PopMarker ledger deletions. #18914 refactors validation and must preserve the new opcode handler when composing. No fresh Windows or title-performance claim. AI-assisted: yes |
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — looks good
Nothing blocks this change; the points below are optional.
What I ran
Reviewed head fd11aedf010f6108134150f032f4c2d12b4a0fae using repo_read.py against the prepared diff and pinned repository files. I did not run builds or tests; the qualification results below are author reported.
Results
| Check | Result | Note |
|---|---|---|
| Diff and changed code | passed | Read all changed files listed as reviewed. |
| Builds and tests | not run | The description reports Linux qualification; I did not independently verify it. |
| Security and performance | not run | No separate runtime audit was performed. |
Findings
Blocking
None.
Non-blocking
None.
Not verified
I read all ten changed files listed as reviewed in manifest.json; none were excluded. I did not independently confirm the console measurement provenance, bundled-module comparison, Linux qualification logs, merged-preview build, Windows behavior, or physical-console behavior. The description explicitly notes that its compatibility module is not authenticated retail firmware and that this refresh adds no new console timing measurement. files.json was not available through the reader.
To get this to a good state
Nothing is required.
fd11aed to
c0dcf41
Compare
|
Rebased the three owned commits onto main Fresh Linux: full SDK/relinker builds pass; identical four gates give the two expected control failures and all four change passes. Physical RX6650XT, required Vulkan/no cache, validation1.4.363 loaded on both arms, zero skips/VUIDs. Oracle209 comparisons each: 137→131 known findings, exactly six prime cases corrected, no new findings/kind changes. The evidence records 13 raw detail variations and the same six stale AcquireMem entries inherited from main; no new title/FPS or Windows claim. Downloaded and verified evidence (76 payloads). Description updated with exact pins, overlap review and the unrelated main debt-fold failure addressed separately by #21531. AI-assisted: yes. |
|
The historical Windows failure on this PR is from an unrelated libc regression, rather than the PRIME_UTCL2 change. The failed job checks out main I reproduced the boundary result with verbatim production-function components: current Linux and MinGW 16.2/Wine 11.22 agree across 327,680 UTF-16-unit/capacity cases (digest This component result does not replace a fresh full Windows check against current main. It establishes why changing/rebasing this AGC code to address that old codec failure would target the wrong source. No additional change was pushed to this PR. AI-assisted: yes |
|
Windows follow-up on the failing It doesn't reproduce here:
This PR changes AGC packet code, which the libc locale test doesn't use. So the red status looks stale or runner-related, inferred from it not reproducing. Re-running the Setup: Windows 11 Enterprise 22621, AMD Ryzen 9 5950X, WinLibs GCC 15.2 UCRT r7, Release. AI-assisted: yes. |
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — comments
Nothing blocks this; the points below are optional.
What I ran
Reviewed head c0dcf418bd01ccdf61019e35c234fac47ce4a5fb. No commands or tests were run; this review used the prepared diff and the pinned repository reader. The description reports qualification results, which I did not independently run.
Results
| Check | Result | Note |
|---|---|---|
| Changed code review | passed | All 12 changed files were read |
| Tests and builds | not run | Results in the PR description were not independently verified |
| Runtime behavior | not run | No title or console run performed |
Findings
Blocking
None.
Non-blocking
docs/dev/debt/changes/agc-prime-utcl2.md:3removes thesceAgcDcbPrimeUtcl2debt item, but the existing entry indocs/dev/debt/libSceAgc.md:39remains. The code search found that stale entry still saying both builders write a NOP. Please update the existing ledger entry or confirm the debt-generation process removes it when this fragment is applied.
Not verified
- No checks or tests were run in this review; the build, CTest, oracle and hardware qualification claims come from the PR description.
- No new console measurement, title behavior, Windows behavior, or physical timing was verified.
- Reviewed files:
core/libs/prx/libSceAgc/Acb/include/Memory.hpp,core/libs/prx/libSceAgc/Acb/src/Memory.cpp,core/libs/prx/libSceAgc/Command/include/Memory.hpp,core/libs/prx/libSceAgc/Command/src/Memory.cpp,core/libs/prx/libSceAgc/DcbState/include/Display.hpp,core/libs/prx/libSceAgc/DcbState/src/Display.cpp,core/libs/prx/libSceAgc/tests/PrimeUtcl2.cpp,core/libs/prx/libSceAgcDriver/Execution/include/Pm4Opcodes.hpp,core/libs/prx/libSceAgcDriver/Execution/src/Pm4.cpp,core/libs/prx/libSceAgcDriver/tests/Pm4.cpp,docs/dev/debt/changes/agc-prime-utcl2.md, andtools/library-oracle/known.tsv. All 12 changed files were included in the review folder; none were excluded.
To get this to a good state
Nothing is required. Optionally reconcile the stale debt ledger entry noted above.
|
Confirmed against the reviewed head I verified the exact-head The raw ledger is intentionally unchanged on this branch: the repository's fragment workflow requires the change through a pending fragment. No direct ledger edit or production-code change is needed for this point. This was an isolated check of this PR's fragment, not a claim that every unrelated pending fragment folds globally. AI-assisted: yes |
|
Resolved the main conflict and pushed 3/3 focused CTests pass on both candidate and pinned main54160814c992: public headers, PrimeUtcl2 packet checks and the actual physical-RX6650XT buffer-descriptor runtime case. Own committed fixtures per arm; zero skips/VUID/SYNC-HAZARD, validation1.4.363 inserted for each GPU case, own-driver loader traces and unchanged hashes verified. Both reservations released after cleanup. Conventions, debt folding and topic whitespace pass; later mainf8a67ff6a6fbe merges cleanly by source-only preview. Complete 38-payload evidence — SHA-256 AI-assisted: yes. |
|
No actionable comments were generated in the recent review. Walkthrough
Change: Bug fix Merge Risk:
|
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — changes requested
The packet writer silently truncates unsupported argument bits, so callers can receive a successful packet containing different cache permissions, prime mode, address, or page count than they supplied.
What I ran
Reviewed head b7bfb7a6fec1e63d58f3263ee72de149a0b9ee6c using the prepared diff and repo_read.py at the pinned head. No tests were run. The description reports focused CTest results; those are author-reported and were not independently verified here.
Results
| Check | Result | Note |
|---|---|---|
| Changed code review | passed | All changed files were included and read |
| Tests | not run | Focused runs are author-reported |
Findings
Blocking
core/libs/prx/libSceAgc/Command/src/Memory.cpp:54-55maskscachePermission,primeMode, the address low bits, andpageCountinstead of rejecting unsupported encodings. For example,primeMode=2is encoded as mode 0 and a misaligned address is rounded down, while packet validation sees only the already-truncated packet. This contradicts the description's claim that unsupported encodings are rejected and can make the guest command act on a different request. Validate the original arguments before emitting the packet (including address alignment and field widths).
Non-blocking
None.
Not verified
No tests or build checks were run. The PR description's reported CTest, hardware, oracle, and merge qualification results were not independently confirmed.
To get this to a good state
Reject unsupported permission/mode bits, misaligned addresses, and page-count overflow before packet emission, then add tests that call the public writers with those inputs and assert failure without modifying the command buffer.
|
@MarcZX10, I clarified the description. The public ACB/DCB writers normalize their arguments as the recorded console exports do. The decoder applies the rejection rules to raw packet words received from the guest. I rechecked all six pinned console rows against
At this head, AI-assisted: yes |
The writers normalize their arguments the way the console exports do. testReferencePackets in libSceAgc/tests/PrimeUtcl2.cpp pins six recorded console rows for both the ACB and DCB writers, and rejecting before emission would refuse all six. The author answered this on 27 Nov with the row details.
What
sceAgcAcbPrimeUtcl2andsceAgcDcbPrimeUtcl2took three arguments and wrote a NOP. Correct both public declarations to the measured five-argument interface (command buffer, cache permissions, prime mode, address, page count) and emit the five-dwordPRIME_UTCL2packet (opcode0x5d), including the graphics engine bit. The public writers mask permission, mode and page-count fields and round the address down to a 16 KiB boundary, matching the recorded console exports. The driver names the opcode and validates the raw packet fields and engine selection when decoding guest command buffers. PRIME_UTCL2 execution preserves guest memory and queue register state.The contract is from six cases in prosper's pinned console measurements, SHA-256
aa6cc7b818a1016c20732e4547cea8c12b0472aec681bcf11f8f9a3c897f7de3. The earlier 131,072-vector comparison with PPSA06652's bundled compatibility module also matched permissions/mode masks, 16 KiB address rounding, 14-bit page count, engine bit, return pointer and cursor advance. That module is not authenticated retail firmware; this is no new console measurement.Host GPU translation is managed by the host driver; guest prefetch and acknowledgement timing remain unmodelled and are recorded in debt. Preserve command-buffer allocation failure behavior. No title unblock or FPS gain claimed.
Merged main
54160814c992into the existing topic atb7bfb7a6fec1. The sole manual conflict is the oracle-status table: retain main's removal of resolved PopMarker rows and this topic's removal of six resolved PrimeUtcl2 rows. All three production prime builder bodies, the opcode0x5dvalidator and the focused prime fixture retain their exact source from the previous reviewed headc0dcf418bd01.Tested
Latest focused merge qualification (2026-11-27 UTC): candidate
b7bfb7a6fec1e63d58f3263ee72de149a0b9ee6c, pinned main54160814c99200758e940191c3c0c249b76fb331.The same three CTest names pass on both arms, 3/3 each:
public_headers,agc_prime_utcl2_tests, andagc_driver_buffer_descriptor_runtime. Each arm uses its own committed fixtures. This covers the public interface, packet writing and validation, and a physical-GPU descriptor regression. It is integration coverage of the merge; no fresh negative-control or oracle comparison was run.Linux 7.3.5-arch1-1 / GCC16.2.1 / Release / SPIRV-Tools disabled, Ryzen9 7950X / RX6650XT / RADV Mesa26.3.1-2. The GPU case requires physical Vulkan, disables shader caches, and inserts Khronos validation1.4.363 with headers335. One actual layer insertion per arm; zero skips, VUIDs or SYNC-HAZARD messages. Loader traces initialize each arm's own raw driver. Source, executable and driver hashes remain unchanged; 49 matching recursive dependency pins. Each complete arm used the shared FIFO and released its sentinel after terminal cleanup; no fixture processes remain.
Conventions, debt folding and topic whitespace pass. Later main
f8a67ff6a6fbemerges cleanly by source-only preview. Earlier full SDK, oracle and Windows evidence remains scoped to its original heads; this adds no title, FPS or console-timing claim. Initial configuration/fixture-selection corrections were retained and excluded before tests: the invalid execution selector was cleared and the mock Graphics case was replaced by the actual GPU runtime case. Both admitted arms and completed build phases exited0.Complete source/merge checks, commands, logs, JUnit, provider and cleanup receipts — 38 payloads, anonymous download and every payload hash verified; SHA-256
d362bcde84aad2646ac5cf8dc4f3939fe92c4f15cb4b10c8c902c1bbfb397d99.Earlier Arch Linux qualification (original heads): main
e4caa07950f862269fbe664e3502b15544161e1f, fixture-only control7f8bb51815dcb9a090dc2ea8d701d85b85b72c9e, changec0dcf418bd01ccdf61019e35c234fac47ce4a5fb. AMD Radeon RX 6650 XT, RADV/Mesa 26.2.7, Vulkan validation 1.4.363 (headers 335).0x5dor the AtomicMem signature. perf(agc): cut the CPU work of PM4 register writes, submission copies and validation #18914's validation refactor must preserve the new whitelist/validator; fix(libSceAgc): write the console's pop marker tag #19051 removes independent PopMarker ledger rows. No functional dependency or blanket composition claim.Verified logs, source/control patches, fixtures and qualification report, SHA-256
97a943e3555dc0b353c0bc76d26aea29555c301f67cd528155be371dfb568344; all 76 payloads verified after download.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)Summary by CodeRabbit