Skip to content

test(agc): clamp the array window test's layer to the slices its view covers - #8969

Merged
adriadam10 merged 1 commit into
boykopovar:mainfrom
Chuk49:test/agc-array-window-view-clamp
Oct 24, 2026
Merged

adriadam10 merged 1 commit into
boykopovar:mainfrom
Chuk49:test/agc-array-window-view-clamp

Conversation

@Chuk49

@Chuk49 Chuk49 commented Oct 21, 2026

Copy link
Copy Markdown

What

agc_driver_image_array_window_past_layer_limit (from #6772) fails on RADV, 3 of 3 runs:

AGC graphics: image_sample_lz on a window of a 1D array past maxImageArrayLayers: thread 7 component 0 is 107.000000/255, expected 147/255

The failure is in the test's expectation, not in the driver.

The second Run(*device, 0) views slices 0 through 8102 of the 1D array. On a device whose maxImageArrayLayers is 2048 (NVIDIA, lavapipe), ArrayLayerWindow refuses that view and the test accepts the refusal. RADV's limit is higher than 8102: the driver creates the full array (layers=8103 in the log) and the dispatch runs.

The expected texel still clamps the layer coordinate to Layers - 1, which only fits the three-slice window of the first run. Thread 7 samples layer 5.0. The view covers it, so the hardware returns layer 5, which is (5·8+0)·9+3 mod 256 = 107. The test expected layer 2 instead: (2·8+0)·9+3 = 147.

The expectation now clamps to the slices the view covers, LastArray - baseArray:

  • For the first run (base 8100) that is still 2, so the expected values do not change.
  • On devices that refuse the second run, nothing changes.

On RADV, neither run reaches ArrayLayerWindow's past-limit branch: the first run is served by the viewed-slice window. So that branch is still covered only on devices with a lower limit.

Tested

Arch Linux (Omarchy), kernel 7.2.5, GCC 16.2.1, Release, BUILD_TESTING=ON, ANYPS5_ENABLE_SPIRV_TOOLS=ON, base main 71401e331.

ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ctest --test-dir build -j1 -V -R 'image_array_window|array_layer|layer_limit'. That is 2 tests: agc_driver_image_array_window_past_layer_limit and agc_driver_array_layer_target. Three runs each:

Run 1 Run 2 Run 3
main 1/2 1/2 1/2
this PR 2/2 2/2 2/2
  • main: agc_driver_image_array_window_past_layer_limit fails every time, with the message above.
  • This PR: the log shows both runs executing. The first is sampled array view ... slices 8100..8102 served from its viewed slices; the second is a layers=8103 texture.
  • Validation: the loader inserted VK_LAYER_KHRONOS_validation in both tests of every run (VK_LOADER_DEBUG=layer). No log contains was not found but was requested by env var VK_INSTANCE_LAYERS, and neither side logs a VUID- line.

Not run on a device with maxImageArrayLayers 2048. The change cannot alter that path: the refusal is caught before the expectation is checked.

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: AMD Radeon 8060S (Strix Halo, RDNA 3.5), RADV STRIX_HALO, Mesa 26.2.2, Arch Linux
  • AI-assisted: yes

… covers

The second run views slices 0 through 8102. A device whose
maxImageArrayLayers is above 8102, such as RADV, accepts that view
instead of refusing it, and then samples the layer the coordinate
selects. The expected texel still clamped the layer to the three-slice
window of the first run, so a sample at layer 5 read 107/255 where the
test wanted layer 2's 147/255.

@jotitadev jotitadev 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.

A run on a device with maxImageArrayLayers 2048, the case the description notes was not covered.

Machine: Ubuntu 26.04, i7-8700, GCC 15.2, Release, BUILD_TESTING=ON. NVIDIA GeForce RTX 3070 (driver 595.99.02, maxImageArrayLayers 2048) and lavapipe (Mesa 26.0.3, LLVM 21.1.8, also 2048). Head 0ad445efd applied onto main 0c6a5bd59 (3-way, clean). ANYPS5_NO_SHADER_CACHE=1, -j1 --timeout 60.

agc_driver_image_array_window_past_layer_limit RTX 3070 lavapipe
main pass pass
this PR pass pass

On both devices the test passes on main and with this PR: the limit is 2048, so the second Run is refused and the first is served from its viewed slices (-V shows a window of a 1D array past maxImageArrayLayers was sampled and loaded from its viewed layers). The expectation change only moves the clamp for the covered-slice window, which these devices do not reach, so there is no behaviour difference here. This confirms the change is safe on maxImageArrayLayers 2048 hardware; the red-to-green it fixes still needs a device with a higher limit (RADV), as the description says.

Not run: a device with a limit above 8102, Windows, the Khronos validation layer (not installed on this host).

GPUs tested: NVIDIA GeForce RTX 3070 (595.99.02, Linux) 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.

@adriadam10

Copy link
Copy Markdown
Collaborator

Checked the expectation change: with base 8100 the clamp is still 2 (expected values unchanged), and with base 0 on a device that accepts the 8103-slice view the clamp now follows the slices the view covers, matching the 107 RADV returns. Devices that refuse the view are unaffected, as confirmed by @jotitadev on RTX 3070 and lavapipe. The one red test in the Build run (agc_compute_pipeline_capture_run) is unrelated to this file and was fixed on main by #8968; merged.

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.

3 participants