fix(agc): import selected texture layers within registered ranges #6820
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/6820"
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 Zenodeon on 2026-10-16T13:18:39Z.
What
A partially used texture array can fall back to CPU staging even when its active physical layer is importable. The whole-descriptor
HostImportForlookup fails when unused slices cross separately owned allocations. Retry the lookup for one contiguous selection of complete physical layers, then use the existing recorded GPU upload/detile path. Unsupported selections retain the existing fallback.Prerequisites are now on main through merged #6718, including the attributed #6202 integration. Depends on: none. This branch is based on main
d6eafa54d0464258574fd2f71889754d05a5bc93and contains only the three selected-import commits: regression, implementation and Linux write-watch policy variants. Current head:fa76baa139. Incremental review against the tested main revision.For the observed two-layer descriptors, the active 8,847,360-byte layer fits a 10 MiB import run, while the full 17,694,720-byte descriptor does not. The existing upload implementation retains import/image lifetime, records selected pending-read ranges and preserves unrelated image contents. No public API or shader-semantic changes, skipped rendering, fabricated completion, title checks or input configuration changes.
Overlap rechecked before publication. #6718 implements selected CPU fallback uploads; this enables the GPU-import route. #6197 joins import windows for a whole surface and changes the whole-range lookup contract; this change leaves that contract alone and uses an already valid selected-layer run. #6202 supplies scoped refresh. No other open PR found implementing this selected-run retry. Prerequisite authorship is retained.
The allocation-history repair is already on main through merged #6718: collection memo hits now also require the allocation-registry generation to match. An ordering epoch and unwatch serial alone could reuse a proof from an earlier allocation at the same address. This fixes the inherited array regressions and the selected-import failure reproduced in the watched-import policy. The selected-run upload implementation remains unchanged; this PR adds Linux
watchandunwatchregression variants using the existing override, without changing the default probe or production import policy.Tested
Latest rebase validation — 2026-10-22. #6718 has merged. Replayed only this PR's three own commits onto main
d6eafa54d0464258574fd2f71889754d05a5bc93; current headfa76baa139.git range-diffconfirms all three patches remain equivalent. Dropped the old dependency and merge history while preserving original authorship. Prior merge resolutions were checked: main already retains scopedclearHandOvereligibility and rangedFlushPending, plus both test families, so none of those resolutions is lost.Fresh Release builds on Windows 11 build 26200, Intel Core i7-13700, NVIDIA GeForce RTX 4070 / driver 610.88, GCC 15.2, SPIR-V Tools enabled. Main: 17/17 focused tests pass, zero skips, 41.55 s. Candidate: 18/18 pass, zero skips, 15.17 s, including selected GPU imports, both array-layer modes, collection/hint allocation-history cases, write-watch coverage, storage lifetime/failure/write-back, CPU snapshots and graphics. Every individual test finishes below 30 seconds.
Both runs use
ANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1,VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validationand the same GPU. Loader logs confirm Khronos 1.4.304 loads, with no missing-layer diagnostics. The logs contain identical existing validation-error messages (VUID-VkDeviceCreateInfo-pNext-pNext, structure 1000574000 unknown to this older layer); there are no new VUID errors, and zero total errors is not claimed.Diff and conventions checks against the actual main target pass. The required
origin/mainconventions check was also run; that fork baseline reports inherited upstream findings (272 findings, 43 errors), while the three-commit diff against the tested canonical main passes. No new gameplay, performance, Linux or other-vendor result is claimed. Older measurements below retain their original source pins.Earlier reviewer follow-up validation — 2026-10-20. Based on upstream
main5f7e30233e62ae5fdb7a6e3257698bc2e550bcc2; current head8de7f9a7d443d0007e5454fc4e32fa6b01f8a4ec. The requested Windows hint-memo addition and regression are folded into the existing allocation-generation fix commitc19dcecfec8954233d0f22da969422c8eed7ac4f, preserving authorship and the existing commit count.UntrackedHintreads the allocation generation before its walk and stores/comparesmappinginthreadHintMemo. #6820 is restacked on updated #6718; its three incremental commits remain patch-equivalent.Before the hint repair,
agc_hint_mapping_history_cachedfails witha cached hint walk hid a CPU store across allocation replacement, while_uncachedpasses. Main with the identical test-only fixture reproduces that result. After repair, both pass; the fixture also verifies unchanged hints, unchanged allocation replacement without invented CPU writes, and guest-byte preservation.Fresh Release builds on Windows 11 build 26200, Intel Core i7-13700, NVIDIA GeForce RTX 4070 / driver 610.88, GCC 15.2, SPIR-V Tools enabled. This branch: 18/18 pass, zero skips, 19.46 s. #6718: 17/17 pass, zero skips, 14.58 s. Main's shared suite: 10/10 pass, zero skips, 11.43 s, plus its matching
APS5_NO_HOST_IMPORT=1array control 1/1 pass, 0.89 s. The separate main hint negative-control failure above is expected, not counted as a passing main test.All matched GPU runs use
ANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1,VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validationand the same GPU. Loader logs confirm Khronos 1.4.304 actually loads, with no missing-layer diagnostics. Comparing main's shared tests plus its matching no-import control against the candidate finds identical validation-error messages: two instances of the existingVUID-VkDeviceCreateInfo-pNext-pNextfor structure 1000574000 unknown to this older layer. No new VUID errors; zero total validation errors is not claimed.Conventions against the frozen canonical main revision and diff checks pass. The required
origin/maincheck was attempted and still fails with WindowsWinError 206because that fork baseline is stale. These are focused correctness results; no fresh gameplay, performance or Linux/vendor retest is claimed. Historical evidence and the previously documented full-suite Windows build limitation below remain applicable to their named revisions.Earlier conflict-resolution validation — 2026-10-20. Rebased onto upstream
main43cd8f4c47f4c81185c4ca14b84240e0748e3459. Current head:5126feba8ceabdd6b83aaf5277cd2f8a75dd53f2. Rebased directly onto updated #6718 headc778381786adc976f53e7761551751eb0fbae955, including its #6202 prerequisite and the conflict resolution with merged #6772. All three incremental selected-import commits remain patch-equivalent to the previous head. Original authorship is retained.Fresh Release focused targets rebuilt on Windows 11 build 26200, Intel Core i7-13700, NVIDIA GeForce RTX 4070 / driver 610.88, GCC 15.2, SPIR-V Tools enabled. Main: 10/10 pass, zero skips, 15.41 s; its array fixture also passes 1/1 in 1.77 s with
APS5_NO_HOST_IMPORT=1to match the added CPU-only array configuration. PR: 16/16 pass, zero skips, 19.21 s. Both useANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1,VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validationand the same GPU. Logs confirm the Khronos 1.4.304 layer actually loads, with no missing-layer diagnostics. Comparing the shared tests and the matched no-import configuration finds no new VUID error signatures: main's ordinary suite plus its no-import control produce the same two unknown-extension-structure device-create errors as the candidate (VUID-VkDeviceCreateInfo-pNext-pNext, structure 1000574000 unknown to this older layer). Zero total validation errors is not claimed.Upstream Windows test-build limitation: unmodified main's newly merged
agc_driver_image_array_window_past_layer_limit_testsdoes not compile with the supported Windows GCC:ImageArrayWindowPastLayerLimit.cpp:33: requested alignment '65536' exceeds object file maximum 8192. The focused passing suites exclude that dedicated GPU test; the shared graphics binary does runRunTextureTilingTests, including main's array-window layout checks. No unrelated fixture change is included in this rebase. Full-suite Windows success is not claimed.Conventions against canonical
upstream/mainand diff checks pass; the stale forkorigin/mainchecker still hits Windows command-line length limits. No fresh gameplay/performance measurement, raw evidence upload, or Linux/vendor retest is claimed.Earlier rebase validation — 2026-10-20 (main
661f8b717, historical). Rebased onto upstreammain661f8b717through updated #6718 head6ef3a78d872bd2057bd61c564db2b79c79e3d270. Current head:b20fb6dec778a6d1e3f79711a1f8a82fe7173a18. All three incremental selected-import commits are patch-equivalent to the previous head; original authorship and the Linux policy variants are retained. The inherited #6202 integration preserves main's newer array-layout checks and lookup lifetime management.Windows 11 build 26200, Intel Core i7-13700, NVIDIA GeForce RTX 4070 / driver 610.88, GCC 15.2 / Release / SPIR-V Tools. Fresh focused targets rebuilt for main and the PR. Main: 10/10 pass, zero skips, 11.98 s. PR: 16/16 pass, zero skips, 14.35 s, including selected imports, both array-layer modes and all four allocation-history cache/control cases. Both use
ANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1,VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validationand the same GPU. Loader logs confirm the Khronos 1.4.304 layer actually loads; neither log reports a missing requested layer. No new VUID errors compared with main. Both include the sameVUID-VkDeviceCreateInfo-pNext-pNextfor an extension structure unknown to that older layer; zero total VUIDs is not claimed.The final runs load rebuilt unpatched libraries, with older DLL copies beside the test executables moved aside. Conventions against canonical
upstream/mainand diff checks pass. The requiredorigin/maincheck was attempted but its stale fork baseline hits Windows command-line length limits; the canonical target baseline succeeds. No new gameplay/performance measurement, raw-trace upload or Linux/vendor retest is claimed. Earlier hardware reports and game measurements remain evidence only for their explicitly named revisions.Previous rebase validation — 2026-10-19 (historical). Rebased onto upstream
main6b8228b2bfecb895010e379362c6d0bb288c2d47. Current head:93180e82805e1d1dc51e3a9eecdcc49263fffdc0. Original authorship is retained.This branch is based directly on rebased #6718 head
1505305e1, including its attributed #6202 prerequisite. #6367 is already merged and its duplicate commit is dropped. All three incremental selected-import commits are patch-equivalent to the previous head, including both Linux write-watch policy variants. The current incremental review is #6718 to this branch.Earlier validation and investigation (historical revisions):
Review follow-up: final source
99926bd42, based on upstream55b968a23, GCC 15.2, Release with SPIR-V Tools and bundled dependencies:Linux: Ubuntu 26.04.1/WSL 2, kernel
6.18.54.1-microsoft-standard-WSL2, Mesa 26.0.8 lavapipe/llvmpipe, LLVM 21.1.8. Production write tracking is available. Windows: 10.0.26200, NVIDIA RTX 4070, driver 591.86.The reviewer reported that compared imports passed on lavapipe while watched imports failed on native NVIDIA. Using the existing
APS5_WRITE_WATCH_IMPORTSoverride reproduces the exact watched-path assertion here. The new registered tests areagc_storage_selected_import_watchandagc_storage_selected_import_unwatch; the original automatically probed test and all original assertions remain intact.Isolated controls, changing only one implementation at a time:
a valid selected layer did not record its GPU importThese are real Vulkan uploads/readbacks and CPU stores through the existing test, with first/last slices, registered/unregistered unused neighbors, preexisting/lazy imports, neighboring GPU-result preservation and retirement checks. The inherited array failures are covered by #6718's separately verified repair; no expectation was relaxed.
Limit: the forced-policy runs exercise the watched-import code path on software Vulkan. They do not establish that lavapipe should use forced watch generally, or qualify the reviewer's native Linux NVIDIA driver. That native retest remains pending. This update adds no new gameplay or frame-rate claim, residency/shader change, local input configuration, game assets or evidence-bundle upload.
Windows 10.0.26200, Intel Core i7-13700, 32 GiB RAM, NVIDIA GeForce RTX 4070 12 GiB / driver 591.86. GCC 15.2, Release
-O3 -DNDEBUG, SPIR-V Tools enabled. Complete 126-library snapshots retain source/dependency revisions, flags and SHA256 hashes.Historical publication-head validation: complete Release libraries and focused targets rebuilt at
5b4f9b93bb4d9c24a3fb3e83118bec524606e44a; 23/23 tests pass in 27.36 seconds, zero skips. Conventions and diff checks pass. No shader experiment, residency implementation or diagnostic instrumentation is included in this source head.The new synthetic regression fails before the fix at
a valid selected layer did not record its GPU importand passes afterward. Eight cases cover first/last layers, registered/unregistered unused neighbors, existing/lazy imports, exact queued read ranges, preserved neighboring GPU results and guest bytes, subsequent genuine CPU writes, and allocation retirement while a GPU read is pending. Existing focused tests cover CPU fallback, aliasing, clears, CPU snapshots, split write-back and retirement. Each test has a 30-second limit.git range-diffconfirms both new commits are patch-equivalent before/after publication rebase.The preserved playable integration passes 22/22 resource tests with residency off and on. Its separately attributed TheAggie shader experiment has a known flat-input interpolation semantic-test failure, retained without weakening the guard; the experiment is excluded from this PR source. The publishable source graphics/shader-semantic test passes.
The following gameplay measurements are of equivalent preserved integration runtimes, not bare current
mainor this newly rebased publication head. Reference3f8d2989aand candidatec2d3d922bhold #6718, #1191 residency, the write-watch repair and TheAggie's shader revision45944fbbe0dcconstant. Their source difference is this regression/fix only. No dependency or shader gain is credited to this PR. The residency, write-watch repair, shader experiment and diagnostic hooks are excluded from the new implementation commits.SuperTuxKart PPSA69421: Abyss, Tux, easy, four karts, 1920x1080, stationary starting-grid camera. Three alternating baseline/candidate pairs, 35-second cache warm-up per arm, separate restarts, 60-second lead-in and 120-second measurement window. Identical configuration/input hashes and 126-library hashes verified; no input, competing GPU run or harness redirection of acceptance game logs. Only residency selection and
APS5_TRACE_SECONDS=60:120are enabled beyond normal workload/cache/input setup.Median paired throughput gain is 8.05%, below the 20% target. The game remains around 12 FPS; no smooth-play, 30-FPS, black-rendering or repeatable-20%-gain claim.
All six frame windows completed and every counted present reached the display-buffer presentation path. Long detailed worker event timelines overflowed; their dropped-event fields are preserved below, and they are not used as complete profiling evidence. Separate complete short diagnostics show the two repeating CPU-staged uploads use GPU imports, steady-state CPU-staged upload counters reach zero, and synchronous fallback GPU roots disappear from the measured candidate window. In the timing capture the reference has 12.59 ms recorded GPU batches plus 1.79 ms synchronous batches per present; candidate recorded batches take 12.31 ms. GPU child timings are nested and are not added again. The recorded-only GPU figures in acceptance summary lines omit synchronous fallback work.
Captured candidate views preserve underwater scenery and the kart. Gameplay on the current review-repair head, extended stability, finite-race completion, cross-title validation and native Linux NVIDIA/AMD/Intel hardware remain pending. Earlier race/stability passes on other runtimes are not credited to this new change. Local W/Enter controls and --use-gamepad=1 remain outside the PR.
Full traces, digests, screenshots, manifests and test logs remain local at the author's request; no evidence bundle or game assets/binaries uploaded. Original acceptance summary lines are included below with local paths redacted. The PR remains ready for review at the author's request; dependencies and remaining validation are still outstanding.
Original acceptance summary lines, pairs 1–3 (reference then candidate)
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)Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-16T15:29:58Z.
Review: COMMENTED
First Linux run, since the description lists Linux as pending. The new test fails on NVIDIA under Linux, and two array-layer tests from the carried #6718 commits fail on both devices.
Machine: NVIDIA GeForce RTX 3070, driver 595.99.02, Vulkan 1.4.329, plus lavapipe (Mesa 26.0.3, LLVM 21.1.8) on the same machine. Ubuntu 26.04 (kernel 7.0.0-38), i7-8700, GCC 15.2, Release,
BUILD_TESTING=ON. Head5b4f9b93bmerged ontomainbc400bede, clean merge.-j1 --timeout 60, 3 runs per device.GPUs tested: NVIDIA GeForce RTX 3070 (595.99.02), lavapipe (Mesa 26.0.3, LLVM 21.1.8), Ubuntu 26.04
4dc4def0e(test only)agc_storage_selected_importagc_driver_array_layer_targetagc_driver_array_layer_target_cpuagc_storage_selected_importon the 3070 stops witha valid selected layer did not record its GPU import(Recorder.cpp, thePendingReadOverlapscheck afterRefreshLayers(selected, 1)). The two devices differ in the write-watch probe. The 3070 reportshost imports resolve write protection: no ... imported ranges stay watched, while lavapipe reportshost imports resolve write protection: yes ... imported ranges are compared. In 2 of the 3 failing runs the 3070 also logsstorage image ...: guest memory changed while GPU results were pending; keeping the CPU's blocksjust before the failure. Lavapipe never logs that.the unused array slices unexpectedly have complete write history. ThatRequireis inUncommittedUnusedLayers(ArrayLayerTarget.cpp), added by4a506dad6from the #6718 stack. It runs only whenGuestMemory::WriteWatched()is true. It already fails at4dc4def0e, before this PR's fix. On unchangedmainbc400bede,agc_driver_array_layer_targetpasses here.ctest -R "^agc|shader|recompiler" -E "agc_display_buffer_dcc|agc_driver_flip|agc_driver_lds_atomics64|display|flip" -j1 --timeout 60: 617 tests, 4 failures. Those are the three above, plusagc_driver_store_over_untracked, which also fails onmainhere (#6347). Onmainalone the same suite has only that one failure.I could not run #6718 alone on this
main, because it does not merge cleanly ontobc400bede. So the array-layer failures are from the stack as carried here.Not checked: Windows, AMD/Intel, SuperTuxKart.
Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
Imported from boykopovar/AnyPS5. Originally posted by blawesom on 2026-10-16T19:08:27Z.
Pre-review verification found a test failure — the full local suite on this head (Linux, CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release,
BUILD_TESTING=ON, AMD RX 9070 XT / RADV) failsagc_driver_array_layer_targetandagc_driver_array_layer_target_cpuwith:AGC graphics: the unused array slices unexpectedly have complete write historyThis is the same assertion that fails on #6718 (same test family, overlapping code — the pr-overlap bot flagged the pair), so it looks like the expectation contradicting current
main's storage-image write-history behavior rather than either PR's own changes: on this machine the unused slices do have complete write history againstmain's newer tracking. Everything else passes on this head (only the knownmainregressionagc_driver_tessellation, #4727, besides these two), and conventions are green — so the PR's own changes verify clean; it's the carried test's expectation that needs reconciling withmain(ormain's tracking is over-reporting for this case). Whichever of the two PRs lands the test family will need that resolved.Imported from boykopovar/AnyPS5. Originally posted by Zenodeon on 2026-10-17T21:49:06Z.
Thanks for the Linux verification. Updated head
99926bd42is rebased onto55b968a23and carries the repaired #6718 dependency, retaining prerequisite attribution.I reproduced
a valid selected layer did not record its GPU importon Linux/lavapipe using the existingAPS5_WRITE_WATCH_IMPORTS=watchoverride. Removing only #6718's allocation-generation memo repair makes that watched case fail while auto-probed/compared imports pass. Restoring the repair passes both policies. This matches the reported policy distinction, although it is not a native NVIDIA retest.Two Linux variants now cover that distinction:
agc_storage_selected_import_watchandagc_storage_selected_import_unwatch. All original pending-read, neighboring GPU-result, CPU-write and retirement assertions remain intact. As a separate control, removing the selected-import lookup makes all three policy variants fail, so the original GPU-import fix remains necessary.Final focused validation, GCC 15.2 / Release / SPIR-V Tools:
The forced-policy runs exercise the code path; they do not establish general watched-import support on lavapipe or qualify the native Linux NVIDIA driver. Confirmation on the reported RTX 3070 setup remains pending. No new gameplay-performance claim or evidence-bundle upload. AI-assisted implementation and validation.
Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-18T00:05:14Z.
Review: COMMENTED
The native retest on the RTX 3070 you asked for: head
99926bd42passes, and the default (auto-probed) test now passes on this driver too.Machine: Ubuntu 26.04, i7-8700, GCC 15.2, Release,
BUILD_TESTING=ON. NVIDIA GeForce RTX 3070 (driver 595.99.02) and lavapipe (Mesa 26.0.3, LLVM 21.1.8) on the same host. PR merged ontomain5de7a46e0(clean).ANYPS5_NO_SHADER_CACHE=1,-j1 --timeout 30.Tests:
agc_storage_selected_import(+_watch,_unwatch),agc_collect_mapping_history_*(4),agc_driver_array_layer_targetand_cpu, 9 in total.99926bd42a2f69d7f6(allocation-generation memo repair) revertedFull
^agcsuite with this PR (677 tests, without display/flip/lds_atomics64): 677/677 on both devices. That ismain's 669 plus the 8 new ones, with the same skips asmain(1 on the 3070, 44 on lavapipe).On the 3070 the probe picks the watched path on its own:
host imports resolve write protection: no (0 of 4 scratch pages written after a GPU read, 0 after a GPU write, 4 after the import); imported ranges stay watched. That is the path whereagc_storage_selected_importfailed on5b4f9b93b; it now printsSelected physical-layer GPU imports passed.With
a2f69d7f6reverted:agc_storage_selected_importand_watchfail witha valid selected layer did not record its GPU import, the three cachedagc_collect_mapping_history_*modes witha cached collect hid a CPU store across allocation replacement, and both array-layer tests withthe unused array slices unexpectedly have complete write history._unwatchand_uncachedpass.agc_storage_selected_importpasses, because the probe picks compared imports there. Only_watchcatches it. So the forced variant is what gives lavapipe CI the NVIDIA failure, as you describe.Not run: Windows, AMD, any title.
GPUs tested: NVIDIA GeForce RTX 3070 (595.99.02) and lavapipe (Mesa 26.0.3), Ubuntu 26.04
Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
Pull request closed