fix(agc): import committed spans of partially accessible windows #6918

Merged
Scramblrrrr merged 4594 commits from upstream-pr/6918 into main 2026-11-17 20:56:05 +00:00
Scramblrrrr commented 2026-10-16 18:27:09 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Scramblrrrr on 2026-10-16T18:27:09Z.


What

A GPU access wholly inside the committed part of a large registration can lose host import because its selected window also includes inaccessible pages. Main rejects the window; the regression reserves 128 MiB, commits 64 KiB and verifies a GPU fill of the committed prefix.

After the existing window selection and overlap growth, windowRun selects the aligned committed span that contains the entire requested access. It still refuses an access crossing a hole, an alignment that cannot cover the access, or narrowing that would cut an overlapping import. Whole-run callers and registrations no larger than the window keep their existing policy. No new exports, stubs, title checks or configuration switches.

Tested

Refreshed head 8b0d85f9a0e35a72b867d8346b814ffb2bd4ceb7, based on main d2608978dac8a5ea35433db80200219e80f85fc6. This preserves maintainer refresh 009618161a and all current-main tests.

Windows 11 Pro 26200, NVIDIA GeForce RTX 5070 Ti, NVIDIA 617.42 (Windows driver 32.0.16.1742), WinLibs GCC 15.2.0 r7, Release, SPIRV-Tools OFF:

  • agc_driver_graphics and agc_driver_host_import_windows, three consecutive runs on main and on this head: 6/6 pass per head, no skips.
  • Actual Khronos validation 1.4.363 is loaded: five instance-layer insertions per baseline run, six per candidate run. Every positive log has zero VUID/SYNC-HAZARD identifiers and no missing requested layer message.
  • Paired production-only negative: retain final fixtures and replace only GuestBufferMemory.cpp with pinned main. Both tests fail at their intended assertions: the committed access is refused, and the GPU cannot fill the committed prefix. Restore the exact positive source and rebuild only the provider: 2/2 pass. Source bytes are restored and both fixture executable SHA256 hashes remain unchanged. No validation errors in the negative or restored run.
  • Commands: serial ctest --test-dir build-depth-current -R '^agc_driver_(graphics|host_import_windows)$' -j1 -V, with ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 ANYPS5_GPU=NVIDIA VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_LOADER_DEBUG=layer, and VK_LAYER_PATH pointing to that layer.
  • Conventions and diff checks pass. This is a focused validation result, not a full-suite or title compatibility claim.

The outstanding query-path review is complete: importAllocation returns an existing covering import through findImport before it reaches windowRun. This change's commitment query is therefore on import selection/creation or reconciliation, not every stable reuse. The regression verifies reuse of the same narrowed buffer and rejects real holes; no title speedup is claimed and no query timing has been inferred from whole-test duration.

Independent evidence remains attributed to its original head:

  • domx4q, Linux/RTX 4090: head 009618161a merged into main e4caa07950, Arch Linux/GCC 16.2.1, NVIDIA 620.70.06, Khronos 1.4.363.1; both focused tests pass on baseline and change, no skips or VUIDs, actual layer insertion verified.
  • Earlier AMD/Windows 780M and Linux/lavapipe functional reports remain in this PR's conversation at head 955e7c3c7; those are not measurements of this refresh.

No 007 FPS gain or title unblock is claimed. Raw title code, captures and logs stay local. Related import-window work is coordinated in discussion #5714; this change addresses commitment within one registration, rather than joining registrations.

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 and the licence notice of code adapted from upstream (see AGENTS.md)
  • 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 confirmed; PPSA11386 investigation in #5714
  • GPUs tested: NVIDIA GeForce RTX 5070 Ti, NVIDIA 617.42, Windows 11 Pro 26200
  • AI-assisted: yes (Codex)
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4892622870 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6918). Originally posted by [Scramblrrrr](https://github.com/Scramblrrrr) on 2026-10-16T18:27:09Z. --- ### What A GPU access wholly inside the committed part of a large registration can lose host import because its selected window also includes inaccessible pages. Main rejects the window; the regression reserves 128 MiB, commits 64 KiB and verifies a GPU fill of the committed prefix. After the existing window selection and overlap growth, `windowRun` selects the aligned committed span that contains the entire requested access. It still refuses an access crossing a hole, an alignment that cannot cover the access, or narrowing that would cut an overlapping import. Whole-run callers and registrations no larger than the window keep their existing policy. No new exports, stubs, title checks or configuration switches. ### Tested <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> Refreshed head `8b0d85f9a0e35a72b867d8346b814ffb2bd4ceb7`, based on main `d2608978dac8a5ea35433db80200219e80f85fc6`. This preserves maintainer refresh `009618161a` and all current-main tests. Windows 11 Pro 26200, NVIDIA GeForce RTX 5070 Ti, NVIDIA 617.42 (Windows driver 32.0.16.1742), WinLibs GCC 15.2.0 r7, Release, SPIRV-Tools OFF: - `agc_driver_graphics` and `agc_driver_host_import_windows`, three consecutive runs on main and on this head: **6/6 pass per head, no skips**. - Actual Khronos validation 1.4.363 is loaded: five instance-layer insertions per baseline run, six per candidate run. Every positive log has zero VUID/SYNC-HAZARD identifiers and no missing requested layer message. - Paired production-only negative: retain final fixtures and replace only `GuestBufferMemory.cpp` with pinned main. Both tests fail at their intended assertions: the committed access is refused, and the GPU cannot fill the committed prefix. Restore the exact positive source and rebuild only the provider: **2/2 pass**. Source bytes are restored and both fixture executable SHA256 hashes remain unchanged. No validation errors in the negative or restored run. - Commands: serial `ctest --test-dir build-depth-current -R '^agc_driver_(graphics|host_import_windows)$' -j1 -V`, with `ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 ANYPS5_GPU=NVIDIA VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_LOADER_DEBUG=layer`, and `VK_LAYER_PATH` pointing to that layer. - Conventions and diff checks pass. This is a focused validation result, not a full-suite or title compatibility claim. The outstanding query-path review is complete: `importAllocation` returns an existing covering import through `findImport` before it reaches `windowRun`. This change's commitment query is therefore on import selection/creation or reconciliation, not every stable reuse. The regression verifies reuse of the same narrowed buffer and rejects real holes; no title speedup is claimed and no query timing has been inferred from whole-test duration. Independent evidence remains attributed to its original head: - [domx4q, Linux/RTX 4090](https://github.com/boykopovar/AnyPS5/pull/6918#issuecomment-6927781281): head `009618161a` merged into main `e4caa07950`, Arch Linux/GCC 16.2.1, NVIDIA 620.70.06, Khronos 1.4.363.1; both focused tests pass on baseline and change, no skips or VUIDs, actual layer insertion verified. - Earlier AMD/Windows 780M and Linux/lavapipe functional reports remain in this PR's conversation at head `955e7c3c7`; those are not measurements of this refresh. No 007 FPS gain or title unblock is claimed. Raw title code, captures and logs stay local. Related import-window work is coordinated in discussion #5714; this change addresses commitment within one registration, rather than joining registrations. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [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) and the licence notice of code adapted from upstream (see AGENTS.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 <!-- #PR, or none --> - [x] Fixes: none <!-- issue it closes as Fixes #N, or none --> - [x] Unblocks: none confirmed; PPSA11386 investigation in #5714 <!-- title ID and Game bring-up discussion, e.g. PPSA01325 #3232, or none --> - [x] GPUs tested: NVIDIA GeForce RTX 5070 Ti, NVIDIA 617.42, Windows 11 Pro 26200 <!-- for AGC, shader recompiler or VideoOut changes: vendor, model, driver and OS of each GPU the GPU tests ran on; otherwise n/a --> - [x] AI-assisted: yes (Codex) <!-- yes / no -->
Scramblrrrr commented 2026-10-16 18:43:22 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Scramblrrrr on 2026-10-16T18:43:22Z.


Title diagnostic qualification before a user-requested pause: the original dominant12.5MiB copied span was misclassified by an experimental sampler checking only its first4bytes. It crosses2MiB registrations, so it is not title evidence for this single-registration fix. Corrected findings: https://github.com/boykopovar/AnyPS5/discussions/5714#discussioncomment-18980596 . This PR's clean-main synthetic negative/positive and real Vulkan fill remain valid independently (7/7 restored, two new fixtures fail with only production restored to main).

This fix was included in title integrationc70803a19 with #5372 plus an opt-in16MiB window. That combined stack renders the offline menu at1.80194FPS, but no isolated benefit is attributed to this PR. Still draft; Linux and commitment-query-cost review remain pending. No new runs will start until the user resumes. AI-assisted: Codex.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6222359665 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6918#issuecomment-6222359665). Originally posted by [Scramblrrrr](https://github.com/Scramblrrrr) on 2026-10-16T18:43:22Z. --- Title diagnostic qualification before a user-requested pause: the original dominant12.5MiB copied span was misclassified by an experimental sampler checking only its first4bytes. It crosses2MiB registrations, so it is not title evidence for this single-registration fix. Corrected findings: https://github.com/boykopovar/AnyPS5/discussions/5714#discussioncomment-18980596 . This PR's clean-main synthetic negative/positive and real Vulkan fill remain valid independently (7/7 restored, two new fixtures fail with only production restored to main). This fix was included in title integrationc70803a19 with #5372 plus an opt-in16MiB window. That combined stack renders the offline menu at1.80194FPS, but no isolated benefit is attributed to this PR. Still draft; Linux and commitment-query-cost review remain pending. No new runs will start until the user resumes. AI-assisted: Codex.
SleglJan commented 2026-10-16 19:03:43 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by SleglJan on 2026-10-16T19:03:43Z.


Linux cross-test of 955e7c3c7 on main 93e54cedd. Setup: Arch Linux container, GCC 16.2.1, lavapipe (Mesa 26.2.4, LLVM 23.1.1), Release, BUILD_TESTING=ON. Test command: ctest -R 'host_import|driver_graphics|bda', 10 tests.

  • This head: 9 pass, 1 skipped (agc_host_import_sparse).
  • Same tests with only GuestBufferMemory.cpp taken from main: 2 fail, both at the new cases.
    • agc_driver_graphics fails with a committed access was refused because its import window includes uncommitted pages.
    • agc_driver_host_import_windows fails with host import windows: cannot fill the committed prefix.
    • The other 8 pass or skip as with this head.
  • userfaultfd is not permitted in this container, so the write watch falls back to comparing guest memory (logged by both failing tests in the second run; passing tests print no output).

Not run: a hardware GPU, the full suite, any title.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6222699038 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6918#issuecomment-6222699038). Originally posted by [SleglJan](https://github.com/SleglJan) on 2026-10-16T19:03:43Z. --- Linux cross-test of 955e7c3c7 on `main` 93e54cedd. Setup: Arch Linux container, GCC 16.2.1, lavapipe (Mesa 26.2.4, LLVM 23.1.1), Release, `BUILD_TESTING=ON`. Test command: `ctest -R 'host_import|driver_graphics|bda'`, 10 tests. - This head: 9 pass, 1 skipped (`agc_host_import_sparse`). - Same tests with only `GuestBufferMemory.cpp` taken from `main`: 2 fail, both at the new cases. - `agc_driver_graphics` fails with `a committed access was refused because its import window includes uncommitted pages`. - `agc_driver_host_import_windows` fails with `host import windows: cannot fill the committed prefix`. - The other 8 pass or skip as with this head. - userfaultfd is not permitted in this container, so the write watch falls back to comparing guest memory (logged by both failing tests in the second run; passing tests print no output). Not run: a hardware GPU, the full suite, any title. AI-assisted: yes (Claude Code)
keravyn-ops commented 2026-10-17 09:21:42 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by keravyn-ops on 2026-10-17T09:21:42Z.


AMD / Windows run of this PR at 955e7c3c7: Radeon 780M (RDNA 3, 0x15bf), AMD driver 25.10.20.01 (32.0.21020.1007), Windows 11 Home 10.0.26100, WinLibs GCC 15.2.0 r7, Release.

  • agc_driver_host_import_windows: pass (host import windows tests passed, 0.44 s)
  • agc_driver_graphics: pass (5.14 s)

AI-assisted: yes (runs made on the device above).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6232233536 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6918#issuecomment-6232233536). Originally posted by [keravyn-ops](https://github.com/keravyn-ops) on 2026-10-17T09:21:42Z. --- AMD / Windows run of this PR at 955e7c3c7: Radeon 780M (RDNA 3, 0x15bf), AMD driver 25.10.20.01 (32.0.21020.1007), Windows 11 Home 10.0.26100, WinLibs GCC 15.2.0 r7, Release. - `agc_driver_host_import_windows`: pass (`host import windows tests passed`, 0.44 s) - `agc_driver_graphics`: pass (5.14 s) AI-assisted: yes (runs made on the device above).
Scramblrrrr commented 2026-10-18 08:40:44 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Scramblrrrr on 2026-10-18T08:40:44Z.


Thanks @SleglJan and @keravyn-ops for the independent Linux red/green and AMD Windows runs. I have recorded both in the PR description. The Linux comparison isolates the intended production failure at both new assertions, with the container write-watch limitation retained; the AMD run covers actual host imports on Windows. This remains draft pending the import-query cost review. Our current 007 integration passes its selected host-import/graphics controls, but no isolated title FPS benefit is claimed for this fix. AI-assisted: Codex.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6247742091 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6918#issuecomment-6247742091). Originally posted by [Scramblrrrr](https://github.com/Scramblrrrr) on 2026-10-18T08:40:44Z. --- Thanks @SleglJan and @keravyn-ops for the independent Linux red/green and AMD Windows runs. I have recorded both in the PR description. The Linux comparison isolates the intended production failure at both new assertions, with the container write-watch limitation retained; the AMD run covers actual host imports on Windows. This remains draft pending the import-query cost review. Our current 007 integration passes its selected host-import/graphics controls, but no isolated title FPS benefit is claimed for this fix. AI-assisted: Codex.
Scramblrrrr commented 2026-10-22 07:38:15 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Scramblrrrr on 2026-10-22T07:38:15Z.


Refreshed onto main d6eafa54d, head028169644. New Windows paired proof on b36dea0ab (same AGC sources/fixtures; separate SystemService-only addition): both import/graphics fixtures pass, both fail with only GuestBufferMemory.cpp restored to main, both pass after exact positive restoration. Fixture EXE hashes unchanged; real Khronos1.4.363 layer loaded, no VUID/missing-layer errors in the positive controls. Body records exact setup, the current-main resident-mapping test retained alongside our prefix test, and the outstanding query-cost review. Prior AMD/Linux reports remain attributed to their tested heads. Draft/no FPS claim unchanged. AI-assisted: Codex.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6335421877 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6918#issuecomment-6335421877). Originally posted by [Scramblrrrr](https://github.com/Scramblrrrr) on 2026-10-22T07:38:15Z. --- Refreshed onto main d6eafa54d, head028169644. New Windows paired proof on b36dea0ab (same AGC sources/fixtures; separate SystemService-only addition): both import/graphics fixtures pass, both fail with only GuestBufferMemory.cpp restored to main, both pass after exact positive restoration. Fixture EXE hashes unchanged; real Khronos1.4.363 layer loaded, no VUID/missing-layer errors in the positive controls. Body records exact setup, the current-main resident-mapping test retained alongside our prefix test, and the outstanding query-cost review. Prior AMD/Linux reports remain attributed to their tested heads. Draft/no FPS claim unchanged. AI-assisted: Codex.
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!6918
No description provided.