fix(agc): fall back when a shared import alias is refused #14976
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/14976"
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 liskeee on 2026-11-02T07:19:54Z.
What
I make a refused single-range alias of shared guest memory record a failed host import and use the existing copied-buffer upload and write-back path. Previously, a resident direct-memory run extending outside the requested alias range could make dispatch preparation throw and abort the driver.
I add regressions for both overhanging edges, repeated refusal without a live import, successful retry with the complete range, and repeated compute dispatches with changed inputs, correct write-back and unchanged neighboring bytes. I document the remaining alias limitation and failure caching in technical debt.
Tested
I built and tested main (
66e1f7f993), main with the regression tests only, and this change on the same Windows 11 machine with an NVIDIA GeForce RTX 4080, driver 610.88, using Ninja Release, MinGW GCC andBUILD_TESTING=ON.I rebased this change onto main (
4569fe654a) and re-tested it with the same result: 15 passed, 0 failed, 1 Windows skip, zeroVUID-lines and zero missing-layer warnings. I keep the main baseline and main + regression tests results below as measured on66e1f7f993.I ran the same focused selection with validation enabled and the shader cache disabled:
I reproduced the resident-run bounds refusal in
agc_driver_host_import_failure_handles,agc_driver_partial_resident_aliasandagc_host_import_retireon main with the regression tests; all three pass with the fix. I count skips separately:agc_host_import_sparseskips on Windows because udmabuf imports are Linux-only.I checked all three logs: each contains zero
VUID-lines and zerowas not found but was requested by env var VK_INSTANCE_LAYERSwarnings. I found no new validation errors compared with main.I checked the committed change with
python -B tools/check_conventions.py --base origin/main(all checks passed) andgit diff --check origin/main..HEAD(passed).tools/pr_overlap.py --branch fix/agc-shared-import-alias-fallbackfinds one line conflict, with #10333 indocs/dev/debt/libSceAgcDriver.md. It could not compare 46 pull requests that conflict with main; I read the titles of those that touchGuestBufferMemory.cppor the host-import tests, and none of them handles this refusal.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)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by BunnyFl on 2026-11-02T11:42:46Z.
Review: APPROVED
Looks right to me, and it reproduces on AMD too.
A refused single-range alias now records
failedImport(), as the multi-range branch already did, so dispatch falls back to the copied-buffer upload and write-back instead of throwing out of preparation.Tested on Windows 11, WinLibs GCC 15.2.0, Release, AMD Radeon RX 9070 XT (driver 32.0.32015.7029), with
ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, at head61002db367(it currently conflicts withmainindocs/dev/debt/libSceAgcDriver.md, so I tested the head itself):agc_driver_host_import_failure_handles,agc_driver_partial_resident_aliasandagc_host_import_retire.agc_host_import_sparseskips on Windows. The log has noVUID-orSYNC-HAZARDline.throw;, the same three tests fail. That matches your NVIDIA table.agc_driver_alias_copy_labelandagc_driver_host_import_at_map/proofs/teardownweren't built in my run, so I didn't check them.Non-blocking: the
catchtakes anystd::runtime_errorfromGuestArenaMapAlias_nid_postfix, not only the "resident run of direct memory extends outside the range" refusal. A different mapping failure would now be cached as a failed import and fall back silently rather than surface. The multi-range path already behaves that way, so it's consistent, but matching the refusal specifically (or noting it in the debt entry) would keep other failures visible. The debt conflict needs a rebase before merge.Imported from boykopovar/AnyPS5. Originally posted by BunnyFl on 2026-11-02T20:53:06Z.
Review: APPROVED
Thanks, this addresses it. At
395e976d78,boundsRefusedis set only on the "resident run of direct memory extends outside the range" refusal inWindowsMappings::MapAlias, which happens in its first, read-only pass over the pages, before any mapping is changed. The single-rangecatchinGuestBufferMemory.cppnow falls back only when that flag is set and rethrows (throw;) otherwise, and the multi-range handling is unchanged.Tested on Windows 11, WinLibs GCC 15.2.0, with this head merged onto
main, after rebuilding every executable behind these tests: all 9agc_driver_host_import*tests pass, including the newagc_driver_host_import_alias_failure.