Skip to content

fix(agc): check whole storage views for native surface overlap - #10368

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
Ondra97:codex/fix-storage-native-overlap-span
Oct 26, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
Ondra97:codex/fix-storage-native-overlap-span

Conversation

@Ondra97

@Ondra97 Ondra97 commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

What

A storage-image lookup without a precomputed surface size checked only its first byte against native multisample owners. A native depth surface inside a larger cached view was missed, so the cache could return stale guest bytes and keep the overlapping native owner active.

Resolve the viewed surface's complete size before the overlap check and use that range before either the native-depth storage path or a cached storage lookup. The regression seeds a cached linear view, creates an unwritten native multisample depth surface inside it, checks a disjoint view ending at the depth boundary, then requires the complete view to retire the intersecting owner without changing guest bytes.

Tested

Current-main refresh: upstream main e05ba6feebd000cfc316c1d1f00e37e030aa3d8b, submitted head d1dc3a5920b5017e1b958151eca93479187fb75f. Windows 11 Pro 10.0.26300, AMD Ryzen 9 7900X, 31.7 GiB RAM, WinLibs MinGW-w64 GCC 15.2.0 r7, Ninja, Release, BUILD_TESTING=ON, ANYPS5_ENABLE_SPIRV_TOOLS=ON, pinned bundled dependencies. NVIDIA GeForce RTX 4070 Ti SUPER, driver 617.42 / 32.0.16.1742; Khronos validation 1.4.363.

  • Full production relinker and libraries, patched-library fixture, graphics and focused GPU fixtures built successfully on the submitted head (cmake --build <build> --target relinker libs patched_libraries_tests agc_driver_graphics_tests agc_driver_native_multisample_depth_tests agc_driver_sample_multisample_target_tests agc_driver_depth_storage_dispatch_tests agc_driver_native_depth_bda_clear_tests --parallel 8).
  • Paired focused runs on this machine/GPU: clean main 9/9, submitted head 9/9, zero failures or skips. Both used ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1, VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, ctest -j 1 -V, and confirmed actual instance/device layer insertion. Neither log contains a missing requested validation layer, VUID-, or validation error/warning. Candidate selection: ^(patched_libraries|agc_driver_(graphics|native_multisample_depth|sample_multisample_target|depth_storage_dispatch|native_depth_(bda_clear|retirement|clears|clear_refusals)))$. Main selection: ^(patched_libraries|agc_driver_(graphics|native_multisample_depth|sample_multisample_target|depth_storage_dispatch|native_depth_(bda_clear|retirement|clears|clear_refusals)))$.
  • Conventions, strict current-main synchronization, whitespace, test registration and overlap checks completed. The existing prerequisite long-debt-entry warning is retained where reported; no convention errors. This is focused runtime validation, not the complete CTest suite or a new title run.

The one original feature patch remains limited to two files. The conflict placed two independent fixtures at the same insertion point; main's CheckDepthAttachmentAlias and this PR's byte-identical CheckStorageAliasRetirement are now separate functions, and both run in the default native-depth case. The production patch still only resolves viewedBytes before the existing native-MSAA guard and cached/native-depth lookup. No prerequisite was added and shader instruction semantics are unchanged.

The new regression executes on the selected GPU: an adjacent view ending exactly at the native-depth boundary retains that owner, while a larger cached storage span retires only the intersecting unwritten owner and preserves the guest bytes. Depth-storage dispatch and native-depth BDA clear checks are included in the paired selection alongside the shared native-depth/library/graphics cases. Earlier 47-check mixed-integration evidence below remains historical; it is not claimed for the rebased head.

Earlier submitted-revision evidence (historical)

Windows 11 Pro build 26300, WinLibs GCC 15.2.0, Release, NVIDIA GeForce RTX 4070 Ti SUPER, NVIDIA 617.42.

Overlap review: 31 shared-file PR diffs checked. #10049 adds overwrite coverage while retaining the one-byte fallback; this fix uses the complete span and needs a small textual merge with that call-site change. #10064 changes committed 3D slabs. The native-depth fixture additions in #6808/#9950 cover other behavior. None implements this full-span check.
Independent validation of the published commit: Published head 87bdf5445d747ddc76f0cedcb31579e9900aa9c1: full Windows Release build and native multisample depth, depth-storage dispatch, native-depth BDA clear/retirement/clear/refusal checks and patched-library validation pass on a clean tracked tree without overlays (7/7, zero skips). Vulkan is required, shader caches are disabled, and loader logs confirm actual Khronos instance/device validation layers; no VUIDs. Hardware and toolchain are the Windows/NVIDIA configuration listed above. This independently validates the published commit in addition to the earlier integration runs. The complete CTest suite was not run.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: NVIDIA GeForce RTX 4070 Ti SUPER, NVIDIA 617.42, Windows 11 Pro build 26300
  • AI-assisted: yes

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed current head 87bdf54. Resolving viewedBytes before RequireNoMultisampleTarget closes the first-byte-only gap for callers that have not precomputed a surface size, and the check now precedes both native-depth storage handling and cached lookup. The regression exercises an overlapping cached range and an adjacent disjoint range ending exactly at the native depth boundary, then checks owner retirement and byte preservation. The author reports 47 focused Windows GPU checks with Vulkan required, shader cache disabled and validation layers confirmed, no new VUIDs; I did not run the GPU test locally. Hosted eligibility, conventions, intake, labels and report pass; product jobs are skipped by path policy. git diff --check upstream/main...upstream/pr/10368 passes. I found no blocking issue.

@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

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.

Pull request Conflicting files (lines on main) Same exports Same new files
PR 8105 core/libs/prx/libSceAgcDriver/tests/execution/NativeMultisampleDepth.cpp L706-707
PR 9533 core/libs/prx/libSceAgcDriver/tests/execution/NativeMultisampleDepth.cpp L706-707
PR 9717 core/libs/prx/libSceAgcDriver/tests/execution/NativeMultisampleDepth.cpp L706-707
PR 9742 core/libs/prx/libSceAgcDriver/tests/execution/NativeMultisampleDepth.cpp L706-707
PR 10049 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp L1192-1193

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 6192 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 6194 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 6223 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 6300 core/libs/prx/libSceAgcDriver/tests/execution/NativeMultisampleDepth.cpp
PR 6412 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 6481 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 6808 core/libs/prx/libSceAgcDriver/tests/execution/NativeMultisampleDepth.cpp
PR 7484 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 7642 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 7689 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 8998 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 9176 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 9287 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 9289 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 9508 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 9592 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 9674 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 9852 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 9950 core/libs/prx/libSceAgcDriver/tests/execution/NativeMultisampleDepth.cpp
PR 10193 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 10442 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp

@oneandonlydean oneandonlydean self-assigned this Oct 23, 2026
@github-actions github-actions Bot added the agc libSceAgc* label Oct 23, 2026
@BKlaasWerkman

Copy link
Copy Markdown
Contributor

Intel run, a second vendor next to the RTX 4070 Ti SUPER.

Setup: Intel Arc Graphics (Meteor Lake, 0x7d55, Windows driver 101.9150), Windows 11 Pro 10.0.26300, WinLibs GCC 15.2.0 r7, Release. Head 87bdf54 was merged into main ec5b89a (clean merge). Environment: ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1 and VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation (1.4.363). The run uses ctest -R 'native_multisample_depth|native_depth' -j1 -V.

  • Results. This PR passes 5 of 5 and main passes 5 of 5. Neither log has a VUID- line or was not found but was requested.
  • The new case runs on this device. agc_driver_native_multisample_depth prints cached storage span retires only intersecting native depth owners, which main doesn't have. Its other lines are the same as on main, apart from the storage upload log lines of the new case.

AI-assisted: yes (Claude Code)

@Ondra97
Ondra97 force-pushed the codex/fix-storage-native-overlap-span branch from 87bdf54 to d1dc3a5 Compare October 25, 2026 14:09
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 25, 2026
@babyhuey

babyhuey commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Linux run of this head d1dc3a5920b, merged onto main a7a2eece499 (clean merge, local only), with the selection CI's skipped Linux product job uses: anyps5-build CI image (Ubuntu 24.04, GCC 13, Release, BUILD_TESTING=ON), lavapipe with ANYPS5_REQUIRE_VULKAN=1 GALLIUM_OVERRIDE_CPU_CAPS=avx. The tree was configured fresh after the merge, then select_tests.py select / ninja -f select.ninja selected / --target libs / select_tests.py ctest --timeout 120.

  • Selected 1442 tests: all pass.

Edited: the first version of this comment reported 23 failures and said they also fail on main, describing them as lavapipe-only AGC tests. The description was wrong. My container ran with Docker's default seccomp profile, which blocks userfaultfd, so the write-watch tests failed on main and on this PR alike. With --security-opt seccomp=unconfined, main passes all 2,274 tests and this head passes every selected test, so those tests are now actually covered.

AI-assisted: yes (Claude Code)

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

Labels

agc libSceAgc*

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants