Repository navigation
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Heads-up — the two new tests fail on our RADV and on lavapipe. Head
Deterministic (not flaky), and it fails the same with and without the Khronos validation layer. The assertion: Two things that might help narrow it: our RADV reports AI-assisted: yes |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks, that was a real bug. The test reads with
I have only an RTX 4080 here: the sparse path passes, and so does the full copy with the sparse path forced off. If you can rerun AI-assisted: yes. |
|
Ran the Tested section's Setup: Arch Linux (kernel 7.3.4), GCC 16.2.1, Release, NVIDIA GeForce RTX 4090 (vendor
Failures on
No new AI-assisted: yes (Claude Code) |
|
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.
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks for running it on Linux. The test was wrong there, not the copy.
On the RTX 4080 under Windows both registrations pass with the sparse copy ( AI-assisted: yes. |
|
@bagodees a heads-up: #22778 also changes how |
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — changes requested
Changes are required before merge: compute the bound slice count from committed ranges without treating gaps before the last range as backed.
What I ran
- Reviewed head
3eca88d569daed6a6ee1999b0412da8183dda28dfrom the prepared diff and reader. No build or tests were run. - Read:
VulkanDevice.cpp,Context.hpp,DepthSurface.hpp,Texture.hpp,DepthSurface.cpp,Texture.cpp,DepthPlaneSampling.cpp, andGuestMemory.cpp; also revieweddescription.md,commits.md,manifest.json, anddiff.patch. - Excluded by the bundle:
VulkanDevice.cppandTexture.cppfull texts (the changed hunks were read through the reader).files.jsonwas unavailable in the reader; the manifest lists all eight changed files and says six full texts are included.
Results
| Check | Result | Note |
|---|---|---|
| Diff and targeted source review | passed | Found one concrete edge case |
| Build and tests | not run | No execution environment available |
| Other changed-file behavior | not verified | Full audit not completed |
Findings
Blocking
core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp:171—backedPlaneLayersderives the backing prefix fromranges.back().second. If committed guest memory has a gap and a later committed range, this counts every intervening layer as backed. The sparse image then binds those gap layers and stages them withReadCommitted, despite their pages being uncommitted. Compute the maximum backed prefix from contiguous committed bytes starting ataddress(while still accounting for depth surface slices), and add coverage for a committed range after a gap.
Non-blocking
None.
Not verified
- Build, tests, validation-layer runs, and physical-console behavior were not run. The author reports NVIDIA/Windows tests in the description; those are not runs performed for this review.
- The sparse path was inspected, but this review did not exhaustively verify Vulkan sparse binding behavior across drivers.
To get this to a good state
Fix the gap handling in backedPlaneLayers and add a regression case with committed pages after an uncommitted gap. Then rerun the relevant depth-plane sampling tests.
…uncommitted gap Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@MarcZX10 Thanks for the close read. Binding the layers in a gap is intended, and the suggested change would lose data, so I kept it and added the case you asked for.
On the RTX 4080 under Windows, AI-assisted: yes. |
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — comments
The sparse copy bounds memory use to the last backed layer, but the changes leave a correctness and resource-lifetime issue in the sparse image path.
What I ran
Reviewed head 73e3c65537860540c57c3720c92731f01e8a8d1f using repo_read.py to inspect the prepared diff and targeted source ranges. No commands or tests were run during this review.
Results
| Check | Result | Note |
|---|---|---|
| Diff and changed code | passed | Core paths inspected |
| Automated tests | not run | No local test execution |
| Full changed-file review | not run | VulkanDevice.cpp and Texture.cpp were inspected only at relevant ranges |
Findings
Blocking
None verified.
Non-blocking
-
The sparse image is created with
arrayLayers = layers, butPlanSparseLevelsis called witharrayLayers = max(backed, 1). The resulting bind plan allocates sparse binds only for the backed prefix, while the image's remaining array layers are intentionally nonresident. This appears consistent with the stated design, but depends on sparse residency semantics and the strict-nonresident feature; physical-device behavior was not tested here. Seecore/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp:2646. -
The
GuestBlocktest destructor removes allocation tracking and unmaps/releases reserved memory before unregistering write-watch ranges. If unregistering consults or accesses the memory range, that order could be problematic; I did not inspect the unregister implementation. Seecore/libs/prx/libSceAgcDriver/tests/execution/DepthPlaneSampling.cpp:151.
Not verified
- Full texts of
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppandcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppwere excluded from the review bundle; only the relevant changed and neighboring ranges were read throughrepo_read.py. - Other changed files were not read in full. The manifest lists
Context.hpp,DepthSurface.hpp,Texture.hpp,DepthSurface.cpp,DepthPlaneSampling.cpp, and the debt note as included; targeted sections ofDepthSurface.cppandDepthPlaneSampling.cppand the relevant declaration/implementation ranges in the excluded files were inspected. - Tests and behavior on AMD/Mesa, other Vulkan drivers, and the target game were not run or confirmed by this reviewer. The description reports author-run results on an RTX 4080/Windows 11 and an RTX 4090/Arch Linux on an earlier revision.
To get this to a good state
Nothing is required. The points above are optional context for follow-up validation.
|
Passes on AMD RDNA4 with the Khronos validation layer: 3/3 head runs, 0 What this run adds.
Code.
Why this GPU takes the fallback.
Negative control.
GPU. Head
Validation.
Host:
AI-assisted: yes |
Checked at 73e3c65. Counting gap layers inside the backed prefix is safe and intended. The sparse copy binds a prefix of layers (below resident), so a committed range after a gap needs every layer up to it bound; a contiguous-only prefix would drop that later committed data. Staging a gap layer reads through ReadCommitted, whose copyCommitted (GuestMemory.cpp:3745 to 3752) zero-fills the destination and copies only CommittedRanges, so no uncommitted page is read. The cost is binding a few extra layers in that layout. The author explained this and added the gap case on 21 Nov, and MarcZX10's own later review of 73e3c65 lists no blocking findings. The request was on 3eca88d.
|
This passed review on 73e3c65, but it now conflicts with main in DepthSurface.cpp, DepthPlaneSampling.cpp. Please merge main into the branch and push; it goes back to the merge queue on the new head. |
ligmaSec
left a comment
There was a problem hiding this comment.
A shared mip tail can bind the layers that Refresh skips. If the driver reports imageMipTailFirstLod == 0 with VK_SPARSE_IMAGE_FORMAT_SINGLE_MIPTAIL_BIT, PlanSparseLevels binds the one opaque tail for every declared array layer even when passed a smaller layer count. DepthPlaneCopy still sets resident to the smaller count, and Refresh skips all layers at or above it. Those layers have bound, uninitialized depth texels, so residencyNonResidentStrict cannot supply zeroes for them. Could DepthPlaneCopy fall back to a fully initialized copy when its only mip shares a tail across layers, and cover that requirements shape in the sparse-plan test? Vulkan sparse mip tail rules
Source review of 73e3c65537. The current integration has conflicts in the depth copy and its test.
AI-assisted: yes.
What
A depth plane sampled as a 2D array was copied into an image with memory for every slice from 0 to
LAST_ARRAY, whatever backs them. Uncharted: Legacy of Thieves Collection (PPSA05684) samples its 2560x1440 D32 depth plane as a 2D array whoseLAST_ARRAYvaries by frame; in 11 of 57 cold runs it reached 896 to 1792. Each such sample allocated one copy of 14 to 28 GB plus a staging buffer of the same size, both placed in host memory after the device refused them. Only slice 0 has a depth surface, and 1792 slices of that plane (about 26 GB) is more than the console's memory, so most of the declared range cannot be backed.When slices past some point have neither a depth surface nor committed guest memory, the copy is now a sparse image of every declared slice that binds memory only up to the last slice that has either. The staging buffer covers only those slices. Unbound slices read zero, as uncommitted guest memory is read here, so loads, samples and size queries return what the fully bound copy returned. This needs sparse residency for the copy's format,
residencyNonResidentStrictand enough array layers for a sparse image; otherwise, and for cubes and thick layouts, the copy binds every slice as before. A copy is made again when a later sample finds more backed slices than it binds.SparseImageSupported,SparseRequirementsandBindSparseLevelsmove out of the sampled-texture path inTexture.cppso the copy can use them, andPlanSparseLevelstakes the aspect, since these copies are depth images.ContextgainsresidencyNonResidentStrict.Tested
Windows 11 Pro (26300), NVIDIA GeForce RTX 4080 (driver 621.01), WinLibs GCC 15.2 UCRT, Release, on
main89b0eef7ab. The driver change is in3e12a17b7e;3eca88d569changes only the test. The RTX 4080 reports sparse residency for D32, D16 and R16_UINT 2D images (up to 2048 layers) andresidencyNonResidentStrict.agc_driver_depth_plane_sampling(UnbackedTailCase): a 128x128 D32 2D array withLAST_ARRAY255 in a guest block of its own, whose first 2 slices are committed and whose other 254 are reserved and uncommitted (PROT_NONEon Linux, reserved arena memory on Windows), so the OS reports them unreadable on every host. At3e12a17b7ethe case sat at the end of the shared 8 MiB block instead, which fails wherever readable memory follows that block, as on the Linux run below. At3eca88d569, slices 0, 1, 2 and 255 are read withimage_load: the drawn value, the filled value, 0 and 0. Where the device can make the copy sparse it must hold less than 16 slices; here it holds 262144 bytes, against 33554432 onmain. Where it cannot, it must hold every slice. With the sparse path forced off, the case passes with every slice bound (33554432 bytes).3e12a17b7e:ctest -R "depth|sparse"(111 tests;agc_depth_range_remap,guest_ces_sparse_profiles*andwindows_sparse_loadexcluded) withANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1,VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation(SDK 1.4.363),VK_LOADER_DEBUG=layer, on the change and onmain. Every test that ran passed on both, apart from tests that skip themselves on this machine (agc_driver_native_depth_driver_queued_fill,agc_driver_sparse_dma_buf_import,agc_host_import_sparse) on both.agc_driver_texture_sparse_levelsandagc_driver_sparse_buffer_holeswere then built and run on both and pass. The new case fails onmain(shown by the first revision of this PR; onmainit does not build now, as it usesDepthPlaneCopyCanBeSparse). Every log shows the layer inserted, nowas not foundline and noVUID-.agc_depth_range_remap_tests.exeis removed by Windows Defender right after linking on this machine, onmaintoo, so it was not run.3eca88d569: bothagc_driver_depth_plane_samplingregistrations with the same environment, on the sparse path (262144 bytes) and with it forced off (33554432 bytes): pass, layer inserted, noVUID-.ctest -R depthat3e12a17b7eon Arch Linux with an RTX 4090 (driver 620.70.06): noVUID-, and bothagc_driver_depth_plane_samplingregistrations failed in the old placement of the case, with values that change between runs (one is the ASCII textTabl), which points to readable memory after the 8 MiB block rather than the copy.3eca88d569is not yet run there.tools/check_conventions.py --base upstream/mainandgit diff --checkpass.Not tested: AMD and Mesa drivers at the current head. tablefrogpillow's RADV and lavapipe runs were of the first revision (
a07e947ce5), whose shortened copy left loads past it out of bounds. Where these drivers lack sparse residency for depth formats, the copy binds every slice, as onmain.tools/pr_overlap.pyreports #18185 on neighbouring lines ofDepthSurfaceTexture(it adds fields to each slice) and #10894, #19697 and #20041 on the offsets table ofDepthPlaneSampling.cpp; neither implements this change.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)