docs(libSceAgcDriver): copy kernel count record is read after the lease finish #13599

Closed
MarcZX10 wants to merge 2 commits from upstream-pr/13599 into main
MarcZX10 commented 2026-10-30 19:02:39 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-30T19:02:39Z.


What

Documentation correction in docs/dev/debt/libSceAgcDriver.md, entry "CPU reads behind an address-based build" (second half of the file, audited at upstream/main 50843f45d95b60e5772f4396431f9a39b8709d72).

The entry said the count record of the copy kernel HLE is a CPU read that does not finish the batches recorded with a lease. The indexed copy branch of BufferCopy.cpp calls Graphics::FinishLeaseWork() before it reads that record, so the claim is removed. The other reads listed in the entry are unchanged. The entry is also shortened to under 1000 characters.

One commit, docs(libSceAgcDriver): copy kernel count record is read after the lease finish.

Overlap: tools/pr_overlap.py lists open PRs that change docs/dev/debt/libSceAgcDriver.md (for example #13471, #13474, #13484, #13499, #13373 and others). Each of them changes other entries. None edits the corrected entry (checked against the diff of each). #12840 shows the entry only as unchanged context. Permalinks in the commit body are pinned to the audited SHA.

Tested

Docs only. Not built, no runtime tests.

Run on branch docs/debt-D12-1 (head 256fc34e23a533ef86aba3fe9e93033a990b29c3, base 50843f45d95b60e5772f4396431f9a39b8709d72):

  • python3 tools/check_conventions.py --base upstream/main: "All conventions checks passed."
  • git diff --check upstream/main: clean.
  • python3 tools/env_reference.py --check: fails with the same single line as on a clean upstream/main run (identical output, the known baseline failure of APS5_PAD_SPEAKER_FALLBACK_DB).

NOT RUN:

  • Build and runtime tests: not applicable, the change touches only a Markdown debt document.
  • tools/pr_precheck.py test_quality_heuristics: reported as failed for docs-only PRs (harness limitation per RULES.md, the check points at a .md file). Raw failure line: /usr/bin/python3: can't open file '/marc/agent-work/D12/work/precheck/head-256fc34e23a5-693d8407/tools/pr_test_quality.py': [Errno 2] No such file or directory
  • Windows, macOS, real devices, hardware GPU, console: not applicable to a documentation change.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5089631523 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/13599). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-30T19:02:39Z. --- ### What Documentation correction in `docs/dev/debt/libSceAgcDriver.md`, entry "CPU reads behind an address-based build" (second half of the file, audited at upstream/main `50843f45d95b60e5772f4396431f9a39b8709d72`). The entry said the count record of the copy kernel HLE is a CPU read that does not finish the batches recorded with a lease. The indexed copy branch of `BufferCopy.cpp` calls `Graphics::FinishLeaseWork()` before it reads that record, so the claim is removed. The other reads listed in the entry are unchanged. The entry is also shortened to under 1000 characters. One commit, `docs(libSceAgcDriver): copy kernel count record is read after the lease finish`. Overlap: `tools/pr_overlap.py` lists open PRs that change `docs/dev/debt/libSceAgcDriver.md` (for example #13471, #13474, #13484, #13499, #13373 and others). Each of them changes other entries. None edits the corrected entry (checked against the diff of each). #12840 shows the entry only as unchanged context. Permalinks in the commit body are pinned to the audited SHA. ### Tested Docs only. Not built, no runtime tests. Run on branch `docs/debt-D12-1` (head `256fc34e23a533ef86aba3fe9e93033a990b29c3`, base `50843f45d95b60e5772f4396431f9a39b8709d72`): - `python3 tools/check_conventions.py --base upstream/main`: "All conventions checks passed." - `git diff --check upstream/main`: clean. - `python3 tools/env_reference.py --check`: fails with the same single line as on a clean upstream/main run (identical output, the known baseline failure of `APS5_PAD_SPEAKER_FALLBACK_DB`). NOT RUN: - Build and runtime tests: not applicable, the change touches only a Markdown debt document. - `tools/pr_precheck.py` `test_quality_heuristics`: reported as failed for docs-only PRs (harness limitation per RULES.md, the check points at a `.md` file). Raw failure line: `/usr/bin/python3: can't open file '/marc/agent-work/D12/work/precheck/head-256fc34e23a5-693d8407/tools/pr_test_quality.py': [Errno 2] No such file or directory` - Windows, macOS, real devices, hardware GPU, console: not applicable to a documentation change. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
MarcZX10 commented 2026-11-02 04:58:24 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-02T04:58:24Z.

Review: COMMENTED


Reviewed — reply answered, the count record is read without a lease finish

oneandonlydean's 2026-10-30 reply shows that the 8-byte copy count record is read without FinishLeaseWork, and the code at this head confirms it, with one correction to the reply's call list.

What I ran

Live head 256fc34e23a533ef86aba3fe9e93033a990b29c3 (matches the batch file). Read the comment with gh api, the check rollup with gh pr view --json statusCheckRollup, the base doc diff with git diff 73f4f7e… 256fc34… -- docs/dev/debt/libSceAgcDriver.md, and the sources with git -C /marc/AnyPS5 show 256fc34…:<path>. Nothing was built or run.

Results

Check Result Note
eligibility SUCCESS hosted
conventions SUCCESS hosted
intake, labels SUCCESS hosted
linux, windows, relinker, relinker-asan, write-watch, register-context SKIPPED hosted, doc-only change

Findings

The reply (2026-10-30T19:32:01Z) asks to restore the count-record read to the entry. The code supports the claim.

  • FinishLeaseWork() is called in copyBuffer only in the indexed branch (core/libs/prx/libSceAgcDriver/Execution/src/Driver/Memory/BufferCopy.cpp line 196-197).
  • The non-indexed branch (lines 218-229) reads the 8-byte count and period with no lease finish. copyBuffer is called from Dispatch.cpp line 162 only when indirectArguments == 0.
  • The base doc (73f4f7e) named "the count record of the copy kernel HLE" in the CPU-reads entry; doc line 181 at head no longer does.

Two corrections:

  • The reply says the only driver calls to FinishLeaseWork are line 197 and IndirectDispatch.cpp. VulkanDevice.cpp line 5182 also calls it, in the indirect-argument read, not on the copyBuffer path.
  • If the old "guarded only by its shape check" wording returns, note that lines 222-226 check accessibility, pending writes and labels before the read. The shape check is at line 232, after it.

Sources

Not verified

  • Whether the count record can see stale guest memory on hardware, or whether any title reads it there; the reply's trace is code reading only.
  • Nothing was built or run.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5732254893 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/13599#pullrequestreview-5732254893). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-02T04:58:24Z. **Review:** COMMENTED --- # Reviewed — reply answered, the count record is read without a lease finish oneandonlydean's 2026-10-30 reply shows that the 8-byte copy count record is read without `FinishLeaseWork`, and the code at this head confirms it, with one correction to the reply's call list. ## What I ran Live head `256fc34e23a533ef86aba3fe9e93033a990b29c3` (matches the batch file). Read the comment with `gh api`, the check rollup with `gh pr view --json statusCheckRollup`, the base doc diff with `git diff 73f4f7e… 256fc34… -- docs/dev/debt/libSceAgcDriver.md`, and the sources with `git -C /marc/AnyPS5 show 256fc34…:<path>`. Nothing was built or run. ## Results | Check | Result | Note | |---|---|---| | eligibility | SUCCESS | hosted | | conventions | SUCCESS | hosted | | intake, labels | SUCCESS | hosted | | linux, windows, relinker, relinker-asan, write-watch, register-context | SKIPPED | hosted, doc-only change | ## Findings The reply (2026-10-30T19:32:01Z) asks to restore the count-record read to the entry. The code supports the claim. - `FinishLeaseWork()` is called in `copyBuffer` only in the indexed branch (`core/libs/prx/libSceAgcDriver/Execution/src/Driver/Memory/BufferCopy.cpp` line 196-197). - The non-indexed branch (lines 218-229) reads the 8-byte count and period with no lease finish. `copyBuffer` is called from `Dispatch.cpp` line 162 only when `indirectArguments == 0`. - The base doc (73f4f7e) named "the count record of the copy kernel HLE" in the CPU-reads entry; doc line 181 at head no longer does. Two corrections: - The reply says the only driver calls to `FinishLeaseWork` are line 197 and `IndirectDispatch.cpp`. `VulkanDevice.cpp` line 5182 also calls it, in the indirect-argument read, not on the `copyBuffer` path. - If the old "guarded only by its shape check" wording returns, note that lines 222-226 check accessibility, pending writes and labels before the read. The shape check is at line 232, after it. ## Sources - https://github.com/boykopovar/AnyPS5/blob/256fc34e23a533ef86aba3fe9e93033a990b29c3/core/libs/prx/libSceAgcDriver/Execution/src/Driver/Memory/BufferCopy.cpp#L196-L229 - https://github.com/boykopovar/AnyPS5/blob/256fc34e23a533ef86aba3fe9e93033a990b29c3/core/libs/prx/libSceAgcDriver/Execution/src/Driver/Dispatch/Dispatch.cpp#L162 - https://github.com/boykopovar/AnyPS5/blob/256fc34e23a533ef86aba3fe9e93033a990b29c3/core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp#L5176-L5182 - https://github.com/boykopovar/AnyPS5/blob/256fc34e23a533ef86aba3fe9e93033a990b29c3/docs/dev/debt/libSceAgcDriver.md#L181 ## Not verified - Whether the count record can see stale guest memory on hardware, or whether any title reads it there; the reply's trace is code reading only. - Nothing was built or run.
gabichuuuuu commented 2026-11-10 17:48:18 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by gabichuuuuu on 2026-11-10T17:48:18Z.

Review: COMMENTED


Read 5790189039 against main.

Correctness. The entry now lists only what is still unguarded, and the code agrees. Graphics::FinishLeaseWork is called before the indirect dispatch argument read (IndirectDispatch.cpp:77) and also before the indexed copy-record read (BufferCopy.cpp:197), so dropping the copy-kernel clause is correct. The reads without it are still Pm4::ReadDrawCount and Pm4::ReadDrawArguments at Draw.cpp:537-539 and :1125-1127, and the awaitsTitle and orderReleased checks at Submission.cpp:255 and :654. The names the entry cites exist (Pm4.cpp:941 and :951). No other claim in the entry changed.

Not run here; this is from reading the code.

AI-assisted: yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5846640509 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/13599#pullrequestreview-5846640509). Originally posted by [gabichuuuuu](https://github.com/gabichuuuuu) on 2026-11-10T17:48:18Z. **Review:** COMMENTED --- Read `5790189039` against `main`. **Correctness.** The entry now lists only what is still unguarded, and the code agrees. `Graphics::FinishLeaseWork` is called before the indirect dispatch argument read (`IndirectDispatch.cpp:77`) and also before the indexed copy-record read (`BufferCopy.cpp:197`), so dropping the copy-kernel clause is correct. The reads without it are still `Pm4::ReadDrawCount` and `Pm4::ReadDrawArguments` at `Draw.cpp:537-539` and `:1125-1127`, and the `awaitsTitle` and `orderReleased` checks at `Submission.cpp:255` and `:654`. The names the entry cites exist (`Pm4.cpp:941` and `:951`). No other claim in the entry changed. Not run here; this is from reading the code. AI-assisted: yes.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!13599
No description provided.