Skip to content

fix(agc): hand out repeated low test mappings under ASan - #21249

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
edubox:fix/agc-low-memory-asan
Nov 27, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
edubox:fix/agc-low-memory-asan

Conversation

@edubox

@edubox edubox commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

What

agc_gcn_color_target and the EQAA execution test map their blocks below 1 TiB so the PS4 40-bit address space holds them. Their helpers took the first free hint (0x60000000 with ASan, 1 << 32 otherwise) and, on the next call, tried that same hint again and then stepped by 4 GiB.

Under ASan every address at or above 0x7fff8000 belongs to its shadow, so only the first block fits: the second call walked the 4 GiB hints into the shadow and returned null. That is the 2026-11-15 Sanitizers failure in agc_gcn_color_target (cannot allocate multisampled array slice test memory below 1 TiB), and GcnEqaaColorTarget.cpp carries the same pattern for its second LowBlock.

Both helpers now keep the next free hint and step by the page-rounded block size while ANYPS5_ENABLE_ASAN is set, so consecutive blocks pack into the gap below the shadow; without ASan they keep the 4 GiB stride.

Tested

Linux x86-64 (CachyOS), GCC 16.2.1, Release.

  • agc_gcn_color_target_tests in an -DANYPS5_ENABLE_ASAN=ON build: fails with that exact message before the change and passes after it, from the same build directory.
  • A standalone ASan program with the two hint loops, same sizes as the tests: the old loop returns 0x60000000 and then null, the new one returns three consecutive mappings.
  • Normal build: agc_gcn_color_target (CPU only) and agc_driver_gcn_eqaa_color_target (Vulkan, NVIDIA GeForce RTX 4080 SUPER, driver 615.78.8.0) pass.

python3 tools/check_conventions.py --base origin/main: 0 errors. python3 tools/pr_overlap.py --branch fix/agc-low-memory-asan --jobs 32: no overlap with the open pull requests.

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 and the licence notice of code adapted from upstream (see AGENTS.md)
  • 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 4080 SUPER, driver 615.78.8.0, Linux (CachyOS, x86-64) for the Vulkan execution test; the sanitizer run is CPU only
  • AI-assisted: yes

The low-memory helpers of agc_gcn_color_target and the EQAA execution test
mapped their block at the first hint that was free and, on the next call,
retried that same hint and then stepped by 4 GiB. With ASan every address at or
above 0x7fff8000 belongs to its shadow, so the first block at 0x60000000
succeeded and every later attempt failed: the 2026-11-15 Sanitizers run stopped
in agc_gcn_color_target with "cannot allocate multisampled array slice test
memory below 1 TiB".

Both helpers now keep the next free hint and step by the page-rounded block
size while ASan is enabled, so consecutive blocks pack into the gap below its
shadow. Without ASan the 4 GiB stride is kept.

@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 — looks good

The reviewed changes safely advance the low-memory mapping hint by each page-rounded allocation size, allowing consecutive mappings to fit below the GCN 40-bit address limit under ASan.

What I ran

Reviewed head d17aed4439ac4dd3e8de9545e9f5f064b5170453. I read the prepared description, commits, manifest and diff, plus the full text of both changed files. I did not run tests or build commands; the checks described in the PR are author-reported.

Results

Check Result Note
Code review passed Both changed helpers inspected
Build and tests not run PR reports local runs
Other changed files not applicable Both reviewed files were read

Findings

Blocking

None.

Non-blocking

None.

Not verified

I did not run the reported sanitizer or normal builds, GPU execution test, conventions check, or PR overlap check. No files were excluded by rule in the supplied manifest.

To get this to a good state

Nothing is required.

@github-actions github-actions Bot added the agc libSceAgc* label Nov 16, 2026
@maskym

maskym commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

Windows + NVIDIA result for head d17aed4439, merged alone into main e069a7562f (the PR's Tested section names no Windows run).

Host: Windows 11 26300, Intel i7-12700K, NVIDIA GeForce RTX 2070 SUPER, WinLibs GCC 15.2.0 (x86_64-ucrt-posix-seh, r6), Release, BUILD_TESTING=ON, Ninja. main itself fails to compile one test on Windows at this commit (UploadCacheReadOnlyFlush.cpp:177, setenv; #19899 fixes it), so both trees were built with ninja -k 0.

Validation-layer protocol on main and on this PR (ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1, VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation 1.4.366, VK_LOADER_DEBUG=error,warn,layer, ctest -R '^(agc|guest_video_out|video_out|pad_sdl)' --parallel 4 -V):

Tree Passed Layer inserted was not found but was requested VUID- set
main 2050/2054 1856 0 none
this PR 2050/2054 1856 0 identical

agc_driver_upload_cache_read_only_flush is Not Run on both trees because of the main build break above. No new validation errors and no new failures. The failures on this PR's tree (agc_driver_stencil_plane_memory, agc_driver_store_over_untracked, agc_driver_msaa_dcc_unwatch) also fail on main here; rerun alone on this PR's tree they pass 0 of 3 times.

The tests this PR adds or changes (agc_driver_gcn_eqaa_color_target, agc_gcn_color_target) pass in the full validation-layer run. Not run on a PS5.

AI-assisted: yes (Claude Code), the runs and the numbers above are from this machine.

@rafaconvaitis

Copy link
Copy Markdown
Contributor

Windows + AMD run; I found no AMD run in the description or in the comments. Head d17aed4439 merged alone onto main 9a50e1014e with git merge --no-ff (clean merge).

Setup: Windows 11 25H2 (build 26200), AMD Radeon 760M integrated graphics (1002:15bf, Vulkan device name Radeon 5), AMD Software 26.11.2 (driver 32.0.32029.2010, Vulkan 1.4.359), selected with ANYPS5_GPU=Radeon, WinLibs GCC 15.2.0 r7 UCRT, Release, BUILD_TESTING=ON, Khronos validation layer 1.4.363 (LunarG SDK 1.4.363.1). Only the focused test targets were built; the other execution tests were left out with ANYPS5_AGC_EXECUTION_TESTS.

ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_LOADER_DEBUG=layer, ctest -R '^(agc_driver_gcn_eqaa_color_target)$' -V -j 1, 3 runs per side.

test main this PR
agc_driver_gcn_eqaa_color_target passes 3/3 passes 3/3
  • This PR changes tests only, so there is no negative control to run.
  • VUID- lines: 0 in the main and PR logs. Every run logs Selected GPU name=Radeon 5 vendor=0x1002 device=0x15bf and Insert instance layer "VK_LAYER_KHRONOS_validation", and none logs was not found but was requested.

AI-assisted: yes (build and runs scripted with an AI assistant, on the hardware above).

@domx4q

domx4q commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

Ran the two GCN color target tests from the description on NVIDIA's proprietary Linux driver with the Khronos validation layer; the description's Vulkan run is on NVIDIA Linux but names no validation-layer run, and the comments have Windows runs only.

Setup: Arch Linux (kernel 7.3.4), GCC 16.2.1, Release (no ASan), NVIDIA GeForce RTX 4090 (vendor 0x10de, device 0x2684, Ada), proprietary driver 620.70.06, Vulkan 1.4.357, Khronos validation layer 1.4.363.1. Head d17aed4439 merged onto main 40206fe50d with --no-ff, clean merge. Main baseline is a Release build of 40206fe50d on the same machine.

WAYLAND_DISPLAY=wayland-1 XDG_RUNTIME_DIR=/run/user/1000 DISPLAY=:0 ANYPS5_REQUIRE_DISPLAY=1 \
ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_LOADER_DEBUG=layer \
ctest --test-dir build -R '^agc_(gcn_color_target|driver_gcn_eqaa_color_target)$' -V
main 40206fe50d this PR
Result 2/2 passed 2/2 passed
Insert instance layer "VK_LAYER_KHRONOS_validation" 1 1
was not found but was requested by env var VK_INSTANCE_LAYERS 0 0
VUID- none none

agc_driver_gcn_eqaa_color_target selects the RTX 4090 on both sides and prints GCN EQAA color target tests passed; agc_gcn_color_target is CPU-only. This is a non-ASan build, so it only shows that the new mapping loop does not change the Vulkan run; the ASan failure the PR fixes is not reproduced here.

No new VUID- errors; both focused tests pass on Ada.

AI-assisted: yes (Claude Code)

@Colewiz7

Copy link
Copy Markdown
Contributor

Head d17aed4439 merged onto main 23786c4e4f as 07888bec0d, no conflict. Linux 7.3.4, GCC 16.2.1 Release, Mesa 26.2.6 RADV, RX 7900 XT (gfx1100) and 7800X3D iGPU (gfx1036).

No new failures and no new validation messages on either GPU.

RX 7900 XT iGPU
tests run (6299 on the 7900 XT, the 2028 GPU ones on the iGPU), new failures vs main none none
-R '^agc' (1960 tests) with the layer, new failures vs main none none
VUID- / SYNC-HAZARD lines 0 / 0 0 / 0

Layer runs used VK_LAYER_KHRONOS_validation 1.4.363.1 with VK_LOADER_DEBUG=layer and ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1; the loader inserted the layer in every run, and the set of distinct validation messages matches main.

AI-assisted: yes

This was referenced Nov 21, 2026
@kiwe147

kiwe147 commented Nov 21, 2026

Copy link
Copy Markdown

Tested head d17aed4439, applied with git apply on main fd4aeed483 together with the other 29 PRs of one batch (#18156, #21208, #22013, #22795, #23226, #23385, #24324, #24533, #24582, #24690, #24693, #17553, #19619, #20085, #21081, #19682, #22123, #22529, #22572, #22662, #23479, #23787, #24568, #15330, #21630, #21713, #22040, #23490, #24394). All applied without conflicts and the whole tree built.

Setup: Windows 11 Pro 10.0.26200, Ryzen 7 9800X3D, WinLibs GCC 15.2.0 r7, Release, BUILD_TESTING=ON. GPUs: NVIDIA GeForce RTX 3080 (driver 621.24) and the AMD Radeon iGPU of the CPU (gfx1036, driver 32.0.21036.18). No validation layer. iGPU run: ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 ANYPS5_GPU="AMD Radeon", agc_/video tests only.

tests RTX 3080 iGPU
agc_driver_eqaa_color_target, agc_driver_gcn_eqaa_color_target, agc_driver_srgb8_color_target and 3 more (6 tests, matched by name to the test file this PR changes) all pass all pass

Whole batch: the full ctest -j 12 (6540 tests) on the RTX 3080 has 5 failing tests; the 4 that also fail on main fd4aeed483 are agc_driver_stencil_plane_memory, agc_driver_msaa_dcc_unwatch, agc_storage_write_back_host_retile, and pr_overlap_names, which needs a newer Python than my 3.10. Intermittent in this run (pass when rerun alone, or known flaky): agc_driver_store_over_untracked. Traced to other PRs of the batch, each by reverting it and testing again: #17553 (guest_memory); none is in this PR's area. The 2143 agc_/video tests on the iGPU have 2 failing: agc_driver_stencil_plane_memory, agc_driver_store_over_untracked (agc_driver_stencil_plane_memory also fails on main).

This is one combined tree, not a run of this PR alone.

AI-assisted: yes (Claude Code)

@oneandonlydean
oneandonlydean merged commit cf703ad into boykopovar:main Nov 27, 2026
14 checks passed
@edubox
edubox deleted the fix/agc-low-memory-asan branch November 27, 2026 07:31
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.

8 participants