Skip to content

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

Draft
Scramblrrrr wants to merge 3 commits into
boykopovar:mainfrom
Scramblrrrr:codex/partial-host-import-window-main
Draft

Scramblrrrr wants to merge 3 commits into
boykopovar:mainfrom
Scramblrrrr:codex/partial-host-import-window-main

Conversation

@Scramblrrrr

@Scramblrrrr Scramblrrrr commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

What

A small committed access in a large registered allocation can lose host import because its 64 MiB import window also includes inaccessible pages. Main rejects the entire window even when the actual GPU access is wholly committed. The synthetic Vulkan case reserves 128 MiB, commits 64 KiB and fills 4 KiB: main refuses the fill; this branch imports the committed prefix and preserves the GPU-written pattern.

windowRun now checks commitment after its usual cell selection and overlap growth. For a partially accessible window it selects the aligned committed span containing the whole requested access. It keeps the original refusal path if the span cannot cover the access or narrowing would cut an overlapping import. Existing held-import, registry-owner, budget and device-import checks still apply. Whole-run callers and registrations no larger than the window retain their existing policy.

Related: #6442 caches rejected windows, #6097 changes probe/hold accounting, #6182 retires sibling windows on unmap, #6457 combines adjacent registered blocks, #5372 joins crossed registrations. This is the single-registration/partially committed window case; no dependency on those branches. Coordination: 007 investigation.

Tested

Windows 11 Pro, NVIDIA RTX 5070 Ti, driver 617.42, MinGW GCC 15.2. Release, SPIRV-Tools OFF. Clean main 93e54ce plus this branch; no other title fixes.

  • 7/7 pass, no skips, 6.95 s after restoring and rebuilding the fixed production source: agc_driver_graphics, agc_driver_host_import_windows, agc_host_import_unmap, agc_host_import_retirement, agc_sparse_run_import, agc_sparse_run_import_copied, agc_host_import_second_mapping.
  • Meaningful negative: replace only GuestBufferMemory.cpp with main93e54cedd, keep both final fixtures, rebuild. Both new cases fail (1.10 s): a committed access was refused because its import window includes uncommitted pages; host import windows: cannot fill the committed prefix. Restored source/rebuilt: 7/7 above.
  • Mock fixture covers repeat reuse, real-hole rejection, separate committed islands, held-prefix refusal without a recorder, then growth in the next build. Real Vulkan fixture requires imported coverage and verifies the CPU-visible GPU fill pattern.
  • Conventions and diff checks pass. Full upstream CI not run.
  • Independent Linux cross-test by SleglJan: head 955e7c3c7 on main 93e54cedd, Arch Linux container, GCC 16.2.1, Mesa 26.2.4 lavapipe/LLVM 23.1.1, Release. Ten host-import/graphics/BDA tests: nine pass, sparse-import control skips. Restoring only main's production file makes both new assertions fail; the other eight keep their pass/skip result. userfaultfd is unavailable, so this container uses the memory-comparison tracking fallback. No hardware GPU or title result.
  • Independent AMD Windows cross-test by keravyn-ops: head 955e7c3c7, Radeon 780M, AMD 25.10.20.01, Windows 11 26100, GCC 15.2 Release. Host-import windows passes (0.44 s), graphics passes (5.14 s).

Investigated during PPSA11386 bring-up. No title FPS improvement or title unblock claimed: the title runtime test of this candidate is pending. Keeping this draft until that cross-test and review of commitment-query cost. Raw title assets, requests, descriptors and logs stay local.

Checklist

  • Based on current main; no other open PR implements the same functions (related work listed above; collaborator independently checked overlap)
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw; no new stubs
  • No notes, investigation .md files or images added to the repository
  • New third-party code is a submodule built from source (none added)
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Unblocks: none confirmed; investigation for PPSA11386, discussion 007 First Light (PPSA11386) #5714
  • GPUs tested: NVIDIA GeForce RTX 5070 Ti, driver 617.42, Windows 11 Pro
  • AI-assisted: yes (Codex)

@Scramblrrrr

Copy link
Copy Markdown
Contributor Author

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: #5714 (comment) . 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.

@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

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.

Pull request Shared files not compared
PR 1191 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 2434 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 4448 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
core/libs/prx/libSceAgcDriver/tests/BdaResources.cpp
PR 4449 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 5021 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
core/libs/prx/libSceAgcDriver/tests/BdaResources.cpp
PR 5372 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
core/libs/prx/libSceAgcDriver/tests/BdaResources.cpp
PR 6146 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 6182 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 6185 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 6186 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 6197 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
core/libs/prx/libSceAgcDriver/tests/BdaResources.cpp
PR 6292 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 6412 core/libs/prx/libSceAgcDriver/tests/BdaResources.cpp
PR 6481 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 6548 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 6615 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 6628 core/libs/prx/libSceAgcDriver/tests/BdaResources.cpp
PR 6636 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
core/libs/prx/libSceAgcDriver/tests/BdaResources.cpp
PR 6682 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 6913 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 6947 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 6951 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
core/libs/prx/libSceAgcDriver/tests/BdaResources.cpp
PR 7201 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
core/libs/prx/libSceAgcDriver/tests/BdaResources.cpp
PR 7233 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 7261 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 7292 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
core/libs/prx/libSceAgcDriver/tests/BdaResources.cpp
PR 7371 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 7446 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 7457 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 7465 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
core/libs/prx/libSceAgcDriver/tests/BdaResources.cpp
core/libs/prx/libSceAgcDriver/tests/execution/HostImportWindows.cpp
PR 7466 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
core/libs/prx/libSceAgcDriver/tests/execution/HostImportWindows.cpp
PR 7514 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 7618 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 7622 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 7629 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 7642 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 7647 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
core/libs/prx/libSceAgcDriver/tests/BdaResources.cpp
PR 7717 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 7844 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 7849 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 7919 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 7961 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
core/libs/prx/libSceAgcDriver/tests/BdaResources.cpp
PR 8016 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 8091 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
core/libs/prx/libSceAgcDriver/tests/BdaResources.cpp
PR 8104 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 8126 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 8279 core/libs/prx/libSceAgcDriver/tests/BdaResources.cpp
PR 8336 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 8380 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
core/libs/prx/libSceAgcDriver/tests/BdaResources.cpp
PR 8527 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 8622 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
core/libs/prx/libSceAgcDriver/tests/BdaResources.cpp
PR 8658 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
core/libs/prx/libSceAgcDriver/tests/BdaResources.cpp
PR 8667 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 8672 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 8762 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
core/libs/prx/libSceAgcDriver/tests/BdaResources.cpp
PR 8874 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
core/libs/prx/libSceAgcDriver/tests/BdaResources.cpp
PR 8895 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 8896 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 8926 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
core/libs/prx/libSceAgcDriver/tests/BdaResources.cpp
PR 8963 core/libs/prx/libSceAgcDriver/tests/BdaResources.cpp
PR 8971 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
core/libs/prx/libSceAgcDriver/tests/BdaResources.cpp
PR 9011 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 9012 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp

@SleglJan

Copy link
Copy Markdown
Contributor

Linux cross-test of 955e7c3 on main 93e54ce. 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

Copy link
Copy Markdown
Contributor

AMD / Windows run of this PR at 955e7c3: 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

Copy link
Copy Markdown
Contributor Author

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.

@github-actions github-actions Bot added the unblocks title Names a title ID on the Unblocks line label Oct 18, 2026
@github-actions github-actions Bot removed the unblocks title Names a title ID on the Unblocks line label Oct 20, 2026
@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 21, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc* needs rebase Conflicts with main, rebase needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants