Repository navigation
fix(agc): release a resident multisample depth before a GPU buffer may write over it - #11369
Conversation
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed exact head a65bb53c25c5bad83b638deed03fa0caeca2f7b6.
The production change appears to retire or publish a resident native depth surface before the GPU can write into an overlapping guest buffer, and the test covers unrelated, depth-plane, HTILE, and already-written cases. I found one portability issue in the new Device(importHost=true) fixture that can prevent the added cases from running on otherwise usable Vulkan devices.
At NativeMultisampleDepth.cpp, the fixture enables VkPhysicalDeviceBufferDeviceAddressFeatures::bufferDeviceAddress = VK_TRUE whenever both extension names are enumerated. Extension presence does not establish support for this optional feature. The Vulkan feature structure must be queried with vkGetPhysicalDeviceFeatures2, and only a supported feature may be enabled at device creation. If a device exposes both extension names but reports bufferDeviceAddress == VK_FALSE, this fixture fails vkCreateDevice rather than skipping only the host-import cases. Please query the feature and gate the import-host device/test path on its support (while retaining the existing extension checks), then rerun the focused test on the author GPU and a Vulkan configuration without BDA if available.
I did not run the AGC test locally: this environment has no /dev/dri GPU device. Current hosted eligibility, conventions, intake, labels, and report checks pass; product and GPU build jobs are skipped by the repository path policy. The reported Windows/RX 9070 XT test remains author-provided evidence.
|
@MarcZX10 Fixed in 7ab89a4. When both extension names are present, the fixture now queries Rerun on 7ab89a4, same RX 9070 XT machine,
|
MarcZX10
left a comment
There was a problem hiding this comment.
Re-reviewed exact head 7ab89a42bdceca2d1f33f63282e9708d3d9a0800 against current main 4e43321bd6ceccdc1ae28568bbbc35d9a6446464. The new vkGetPhysicalDeviceFeatures2 query now gates bufferDeviceAddress; unsupported devices create without the optional extensions and the test skips host-import cases. The author reports the focused test passed on the RX 9070 XT and the forced-off path skipped all six combinations. I found no remaining issue with that feature query.
Two merge-readiness items remain:
tools/check_main_sync.pyreports this branch is 2 commits ahead and 84 behind current main (merge baseb27cc8416f820e40ce187f165d34138e24373dd7). The merge preview with main is clean and main has not changed the PR's touched paths since that base, but the repository requires branches to stay current. Please rebase/sync to current main and rerun the focused Vulkan test and conventions on the resulting exact head.- Open #10920 also modifies the
Devicesetup inNativeMultisampleDepth.cppto enableVK_KHR_portability_subset. A three-way merge preview of the current heads reports a content conflict in that file, in the same setup region this PR now changes for BDA. Please coordinate integration order and preserve both the portability-subset setup and this feature-gated host-import setup; addDepends on: #10920if that PR must land first.
On this host, check_conventions.py and git diff --check pass for the current PR head, and the main merge preview is clean. I could not run the Vulkan test locally because /dev/dri is absent. Hosted eligibility, conventions, labels and report pass; product/GPU build jobs are skipped by path policy.
|
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
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.
|
MarcZX10
left a comment
There was a problem hiding this comment.
The BDA feature gate fix and the reported RX 9070 XT/forced-off test results remain useful; this exact head is still 7ab89a42bdceca2d1f33f63282e9708d3d9a0800. Current main is now 5b5d24cb22, leaving the branch 87 commits behind. The merge preview is clean, but docs/dev/debt/libSceAgcDriver.md changed on main since the branch base, so the rebase must retain those descriptor notes along with this PR’s debt. Please rebase and rerun the focused Vulkan test and conventions on the resulting head. The open #10920 integration conflict in NativeMultisampleDepth.cpp remains: coordinate the portability-subset setup and BDA feature setup, and record Depends on if order is required. Current conventions and diff checks pass on the existing head; product/GPU jobs are skipped by path policy.
7ab89a4 to
8e4361a
Compare
|
Rebased: the head is now 8e4361a on Rerun on that exact head, same RX 9070 XT machine,
On #10920: the two edits are independent and need no ordering. #10920 lets |
|
An NVIDIA run, to go with the RX 9070 XT. Windows 11 Pro 26200, Intel Core i5-14600K, NVIDIA GeForce RTX 5070 Ti (driver 610.88), WinLibs GCC 15.2.0 r7, Release. Head
I did not run the new test against Full |
|
I rechecked the exact current heads. This PR's merge base is I also ran a three-way merge preview of current #10920 and #11369: it reports a content conflict in |
8e4361a to
462a19f
Compare
|
Synced: the head is now 462a19f on Rerun on that exact head (submodules updated to
On #10920, the integration plan is unchanged and no ordering is needed. Whichever PR lands second keeps Thanks @SeaSunPT for the NVIDIA run. |
|
@QRMOE, two cross-PR issues. Neither is a bug against main alone. I found both by reading the code at 462a19f and merging trees with 1. The production line duplicates open #6498. #6498 (also carried by #10492 and #10497) adds The two PRs merge without conflicts. Their only shared file is the debt md, so neither the overlap bot nor pr_overlap.py lists #6498. In the merged tree, Suggested fix: name #6498 in the overlap note and the checklist, and agree with its author on an order. Whichever lands second drops the duplicate call and the read-only sentence. 2. The new Written case fails once the #9950 stack lands. NativeMultisampleDepth.cpp:1156 expects "sample-preserving guest publication". Only DepthSurface.cpp:1896 throws that string. #10469, #10492 and #10497 replace that check with Suggested fix: list the stack as overlapping. Whichever lands second then switches this line to AI-assisted: yes (Claude Code). |
…y write over it Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ts them Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
462a19f to
946de28
Compare
|
@thuanquang Thanks, both points hold; I checked them against the code and ran the second one.
|
|
@QRMOE Thanks for retaining the lower-level guard and regression in either landing order. I independently checked your final Windows11 Enterprise26200, GCC15.2r7 Release; RTX5080/NVIDIA621.01 and AMD Radeon Graphics(gfx1036)/26.10.1. Required Vulkan, shader cache disabled, inserted Khronos1.4.363 and actual adapters verified.
22 processes total:16 pass,6 intended control failures; max2.265 s, no skips/timeouts or validation warnings/errors/VUIDs. Each positive regression explicitly ran D16(124)/D32(126),2/4/8 samples, depth-plane and HTILE writes, unrelated-owner preservation and unchanged-byte checks; host import required. The aggregate checked=24 counter is separate from those buffer-write cases. Full verbose logs, exact source/build/artifact pins and limits. Full native/relinker/real fixture builds and conventions pass; pre/post hashes match. Main's newer fixture setup was retained; peer regression/production deltas are unchanged. This is a pinned-main composition, with no title, Linux, full-suite or approval claim. The agreed #6498 integration contract remains: keep your |
|
@Amoenus Agreed, thanks: the test drives |
jotitadev
left a comment
There was a problem hiding this comment.
Linux NVIDIA and lavapipe run. The runs so far are Windows only (RX 9070 XT, RTX 5070 Ti).
Setup: Ubuntu 26.04, GCC 15.2, Release. RTX 3070 (NVIDIA 595.99.02) and lavapipe (Mesa 26.0.3, LLVM 21.1.8), each selected with VK_DRIVER_FILES. Head 946de281e merged with --no-commit onto main b7105f728 (clean; it also merges cleanly onto 8df2c3ed0). Focused runs use ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation (Khronos layer 1.4.341). VK_LOADER_DEBUG=layer shows the layer inserted, and no log has the missing-layer message.
- Control (
main+ only this PR'sNativeMultisampleDepth.cpp):agc_driver_native_multisample_depthfails on both devices witha buffer the GPU may write left an unwritten native depth surface resident over it, soCheckBufferWritesreaches the host-import path on both. - With the PR:
agc_driver_native_multisample_depthpasses 3/3 on both devices.- 3070:
Native multisampled depth cases checked=24 unavailable=0, with the "GPU buffer write over the depth or HTILE released the unwritten surface and refused the written one" line for every sample count. - lavapipe:
checked=16 unavailable=8.
- 3070:
- Focused set (
^agc_driver_native_multisample_depth,^agc_driver_multisample,guest_buffer, 16 tests): 16/16 3/3 on the 3070. On lavapipe it is 15/16 3/3; the failure isagc_driver_multisample_retirement, which fails the same way onmainon this host. 0VUID-on either device. ^agcsuite (without display/flip/lds_atomics64,-j1 --timeout 30): 3070 1042/1042; lavapipe 1041/1042, with the samemultisample_retirementfailure asmain.- Builds clean on Linux, so the
sizeofasserts inShaderDiskCache.cppandPipelineJournal.cpphold.public_headerspasses withmain8df2c3ed0.
GPUs tested: NVIDIA RTX 3070 (Linux), lavapipe
Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
Dismissing a stale review: the requested changes were addressed after it (new head) and the merge queue blocks on it. Please request changes again if anything is still open.
|
@QRMOE thanks. At |
The case asserted that a valid but unimplemented guest publication of a written native depth throws. Tests keep to implemented behaviour, so it is removed; the unwritten depth-plane and HTILE cases remain. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@oneandonlydean Done in 609f4f1:
Rerun on the final head 609f4f1, RX 9070 XT, AMD 26.6.2, Windows 11 26200, Vulkan SDK 1.4.363.0, with
Cases that ran:
AI-assisted: yes (Claude Code). |
|
Rechecked |
What
A GPU buffer a shader may write could land on the memory of a resident native multisampled depth surface without the surface being released first. Guest, DMA, texture, storage-image, index and vertex reads already go through
RequireNoResidentDepthRead_nid_no_patchbefore they touch that memory; a writable storage buffer did not. When the buffer was a host import, the GPU wrote straight into guest memory, the surface's guarded generation moved, and the next access to the surface (for example a read that asked for guest publication) stopped onguest writes over native multisample depth are not implemented.GuestBufferMemory::UploadFinishnow callsRequireNoResidentDepthRead_nid_no_patchfor each range inWrites(), next to the existingFlushDepthPlanescall and before the GPU runs. This is the order a console sees: the buffer's stores land on top of whatever the depth surface left in memory.mainthat is still thesample-preserving guest publicationrefusal, now raised at the buffer upload instead of at a later access; with feat(agc): publish a written native multisample D32 depth surface to its guest planes on access #9950 it publishes the samples first.Buffers bound read-only are not covered; a new debt entry says so.
Tested
Windows 11 Home 26200, Ryzen 7 9800X3D, AMD Radeon RX 9070 XT (AMD 32.0.31021.1015, Vulkan 1.4.349), WinLibs GCC 15.2.0 r7, Release. The regression test and the validation comparison below were run on this branch as pushed (a65bb53, on
mainb27cc84); the selected-test run was on the same commit onmainefd368f, before a rebase with no conflicts.agc_driver_native_multisample_depthgainsCheckBufferWrites: a fresh D16 and D32 surface at 2, 4 and 8 samples, on a device created withVK_EXT_external_memory_hostand buffer device addresses, so the written range is bound as a host import (the test requiresHostImportCovers; without the extension it prints a skip line). Two cases per format and sample count:main: fails witha buffer the GPU may write left an unwritten native depth surface resident over it. With this PR: passes.ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation,ctest --test-dir build -R "^agc_driver_native_multisample_depth" -V: neither log containswas not found but was requested by env var VK_INSTANCE_LAYERS;VUID-occurrences are 0 onmainand 0 with this PR. Themainrun stops at the new check, so it covers less of the test than the PR run.tools/select_tests.pyselected 1490 of 2398 tests for this diff,-j4,ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1: 8 failures, and the same 8 fail onmainon this machine:select_tests,nid_database_cache,agc_host_import_cut_lifetime,agc_driver_depth_plane_partial_store,agc_driver_sample_order_grid_reference,agc_driver_frame_capture_eop,agc_driver_frame_replay_shader,agc_driver_frame_replay_shader_host.main29ce6d8 with fix(libScePad): return an error for unsupported port probes #10935, fix(agc): keep buffer owners when a staged address space dissolves #10304, feat(agc): publish a written native multisample D32 depth surface to its guest planes on access #9950 and fix(shader): keep pixel helper lanes out of guest lane masks #11199 applied locally. Same title, inputs and other libraries in every run, frame dumps checked:guest writes over native multisample depth are not implemented(these runs carried temporary diagnostics, removed since). In four of them a temporary write watch showed the last writes to the 4x D32 128x64 surface at 0x20008d0000 wereMarkPossiblyWrittenstamps over 0x20008d0000+0x30000 fromGuestBufferMemory::MarkDirectWritesandGuestBufferMemory::WriteBack, after the surface's draws; the access that then stopped was the guest publication request of a later read.VK_ERROR_OUT_OF_DEVICE_MEMORY. Both are separate from this change and not investigated here. Gameplay was not reached.main18ef6be), same machine and validation-layer environment,ctest --test-dir build -R "^agc_driver_native_multisample_depth$" -V: this branch passes; the same tree withGuestBufferMemory.cppfrommainfails witha buffer the GPU may write left an unwritten native depth surface resident over it; this branch merged with fix(agc): refuse writable buffer feedback with native depth #10497 (8a0dcd5, which carries fix(agc): reclaim published native depth owners safely #10469 and fix(agc): publish native depth before cached buffer recording #10492) passes. 0VUID-occurrences and no missing-layer line in any of the three logs.GuestBufferMemory.cppfrom the basemain18ef6be fails witha buffer the GPU may write left an unwritten native depth surface resident over it. The buffer-write cases ran for formats 124 and 126 at 2, 4 and 8 samples (checked=24 unavailable=0); 0VUID-lines.tools/check_conventions.py --base origin/mainpasses.tools/pr_overlap.py --branch fix/agc-msaa-depth-buffer-write: test(agc): enable VK_KHR_portability_subset in the tests that create their own device #10920 edits the same two lines of the test's ownDevicesetup (it adds the portability subset). Not listed by the tool, since the only shared file is the debt file:ShaderResources::requireGuestBuffers(), which callsRequireNoMultisampleTargetfor every guest buffer, read-only or writable, right beforeUploadFinish; in production that also covers this PR's line, but this PR's test drivesGuestBufferMemory::Uploaddirectly, so theUploadFinishguard and its test stay in either landing order. Once fix(agc): refuse buffer aliases of native MSAA targets #6498 is in, the read-only sentence of this PR's debt entry is dropped.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