Skip to content

test(agc): skip vouched lookups where host imports report GPU reads as writes - #7916

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
DavidAmsellem:test/agc-vouched-lookups-import-probe
Oct 20, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
DavidAmsellem:test/agc-vouched-lookups-import-probe

Conversation

@DavidAmsellem

@DavidAmsellem DavidAmsellem commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

What

agc_driver_image_table_vouched_lookups fails on every RADV device reported in #7766 (RDNA4, RDNA3, RDNA2 iGPU, Vega). It passes on lavapipe and NVIDIA. The cause is in the test's assumption, not in the vouch path (full trace in this comment):

  • The test forces APS5_WRITE_WATCH_IMPORTS=watch and keeps its table in a private block, which reaches the GPU as a host pointer import.
  • On RADV, the import and a GPU read of the imported range each resolve the write protection. The driver's own probe reports 4 of 4 scratch pages written after a GPU read, 4 after the import and therefore compares those imports. The forced watch keeps trusting the watch anyway.
  • So after the first dispatch, the dirty-page collect moves the table's generation. ShaderMemory::Vouched sees it changed, ResourceMaterializer::Unwritten() fails, and supplyWords is never called. The column is reused by comparison instead, so the second assertion still passes. The cached variant ends with shared.size() == 0, and the third assertion sees zero vouch counters.

Two things that do not fix it: importing the block before the table is stamped (the GPU read alone moves the generation), and allocating the block through GuestArena on Linux (still private, still a host pointer import).

The change is in the test only. Before --vouched-lookups runs, it calls ProbeImportWriteProtection on the test device. It skips (77) with the probe's numbers when a GPU read of a host import reports writes, or when the probe fails. A write reported at the import alone does not skip: NVIDIA reports one there, but none after a GPU read, and the fixture passes on it (thanks to @simonbbby for catching the first version's wider gate). The skip is worded as a device limitation, so tools/check_skips.py --job linux accepts it. PrepareImportWatch can't be used for this: with the forced watch it returns Watch without probing, and on lavapipe the probe answers Unwatch because of GPU writes, which this test never makes to the table. Devices without host imports are unchanged. Windows keeps its own gate from #7929, which this branch is rebased on; the Linux gate sits next to it. The other modes of the same binary are untouched.

On RADV, the vouched path is then not exercised by this test. It still runs on lavapipe (CI) and NVIDIA. Covering it on RADV would need the block to go through the dma-buf import, which the probe reports as watched on this machine. That would be a separate change.

Tested

Linux Mint 22.3 (Ubuntu 24.04 base), kernel 7.0.0-38, GCC 13.3, Release, on main 85029a00f and on this branch, then again after rebasing onto main dbac9fa15 (same results, with the validation layer). Command: ctest --test-dir build -R "image_table_(vouch|cache)" -V with ANYPS5_REQUIRE_VULKAN=1, run 3 times per device.

main this PR
RADV vouched_lookups Failed 3/3 Skipped 3/3 (the device reports 4 of 4 host-imported pages written after a GPU read)
lavapipe vouched_lookups Passed 3/3 Passed 3/3
vouch_queued_draws, image_table_cache, image_table_cache_bounds Passed on both Passed on both

Validation: ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, layer 1.3.275 (loaded; checked with VK_LOADER_DEBUG=layer), no "was not found but was requested" line. On both devices, main and this PR log only VUID-VkDeviceCreateInfo-pNext-pNext from device creation, and the PR adds no new VUID-. It logs fewer on RADV because the test now skips earlier.

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: Fixes agc_driver_image_table_vouched_lookups fails on RADV since the image-table reuse v3 merge (#6454, 23629c284) #7766
  • Unblocks: none
  • GPUs tested: AMD Radeon RX 7900 XT (RADV NAVI31, gfx1100), Mesa 25.2.8, Linux Mint 22.3 / kernel 7.0.0-38; llvmpipe (LLVM 20.1.2, lavapipe), Mesa 25.2.8, same OS
  • AI-assisted: yes

🤖 Generated with Claude Code

@simonbbby

Copy link
Copy Markdown
Contributor

Two findings on exact head 7220d35b77985454693538c78175493e5aa201a5, compared with its exact main parent 85029a00f526a80318dfd1ead199cf021a99236b.

Ubuntu 24.04, Ryzen 9 9950X, GCC 13.3, Release. NVIDIA RTX 3090 / 595.99.02, gfx1036 iGPU / RADV RAPHAEL_MENDOCINO / Mesa 25.2.8, and lavapipe. Each driver was selected with its ICD; loader output confirms the actual device. ANYPS5_REQUIRE_VULKAN=1, shader cache and pipeline journal disabled, and the registered APS5_WRITE_WATCH_IMPORTS=watch setting retained.

The new gate also removes passing NVIDIA coverage. Fresh --vouched-lookups processes, three per cell:

Device Main parent This head Temporary adjustment below
RTX 3090 3 pass 3 skip (77) 3 pass
gfx1036 RADV 3 fail, zero vouch counters 3 skip (77) 3 skip (77)
lavapipe 3 pass 3 pass 3 pass

The NVIDIA skip prints 4 of 4 pages written at the import and 0 after a GPU read; RADV prints 4 and 4. So an import-time dirty count by itself is not evidence that this fixture cannot vouch on NVIDIA. Removing only the import-time predicate restores the entire existing test, including its mutation/refusal and re-vouch assertions:

if (probe.failure == nullptr && probe.writtenAfterSubmit == 0) return true;

The actual RADV and NVIDIA JUnit skips fail the Linux skip checker. python3 tools/check_skips.py pr-radv.xml --job linux exits 1 with error: agc_driver_image_table_vouched_lookups skipped. The output is present in the JUnit; the wording host imports on this device report does not match DEVICE_LIMITATION. Changing only that prefix to skipped, the device reports ... makes the RADV skip accepted. This is separate from the NVIDIA gate issue.

With those two temporary line changes, the four-test image_table_(vouch|cache) scope passes on NVIDIA and lavapipe, and passes with just the intended vouch skip on RADV. Each non-skipped case passed three executions per device; the actual JUnit skip checker passes for all three. The other three cases also pass on the unmodified parent and head.

The original file is restored byte-for-byte and rebuilt, and the checkout is clean. Repeating the restored head reproduces NVIDIA/RADV 77/77/77 and lavapipe 0/0/0, confirming the predicate control rather than a production or device-selection change. No production fix, title result, Windows/macOS result or validation-layer check is claimed. The adjusted predicate is verified on these devices only; logs, JUnit and the two-line control are retained.

@github-actions github-actions Bot added the agc libSceAgc* label Oct 19, 2026
@DavidAmsellem

Copy link
Copy Markdown
Contributor Author

@simonbbby thank you, both are right. Fixed in dfacadf46:

  • The gate is now probe.failure == nullptr && probe.writtenAfterSubmit == 0. Your NVIDIA numbers (4 at the import, 0 after a GPU read) are consistent with my RADV trace: the stamp moving after the GPU read alone was what broke the vouch here, and the import count was a condition I should not have added.
  • Both skip messages now start skipped, the device reports ....

Re-run on the RX 7900 XT (RADV NAVI31, Mesa 25.2.8) and lavapipe, 3 times each, ANYPS5_REQUIRE_VULKAN=1, ctest -R "image_table_(vouch|cache)" --output-junit:

Device vouched_lookups other three tools/check_skips.py --job linux
RADV Skipped 3/3: the device reports 4 of 4 host-imported pages written after a GPU read, ... Passed exit 0, "1 test(s) skipped, all expected"
lavapipe Passed 3/3 Passed exit 0

I have no NVIDIA GPU, so the NVIDIA cell rests on your run with the same predicate.

AI-assisted: yes

@savvaniss

Copy link
Copy Markdown
Contributor

AMD and Intel Windows data: with this PR, the UHD 770 still fails agc_driver_image_table_vouched_lookups, apparently for the same reason, through the Windows path. The RX 9070 XT passes with and without it.

Windows 11 Pro 26300, WinLibs GCC 15.2.0 r7, Release, ANYPS5_NO_SHADER_CACHE=1, serial CTest, --repeat until-fail:3. Intel UHD Graphics 770 (8086:a780), driver 32.0.101.7088. AMD Radeon RX 9070 XT (1002:7550), driver 32.0.31041.1004, with VkCache emptied first. This head dfacadf46 merged into main cded26c68, against main cded26c68 alone. Tests: vouched_lookups, vouch_queued_draws, image_table_cache and image_table_cache_bounds.

×3 UHD 770 RX 9070 XT
main vouched_lookups fails: a cached dispatch over an unwritten table was not validated by its table's vouch (0 vouched, 0 refused, 0 columns read, 0 reused); the other 3 pass 4 of 4 pass
This head the same failure; the other 3 pass 4 of 4 pass

The two devices' write-watch lines match the split:

  • UHD 770: [write-watch] Windows direct host imports use comparisons (no second queue to settle imports on)
  • RX 9070 XT: host imports of write-watched memory keep the write watch: yes (... 0 after a full GPU read ...); direct host imports of private memory are settled and stay watched

On Windows, decideImportWatch doesn't read APS5_WRITE_WATCH_IMPORTS. It watches private imports only when the context has a settle queue and ProbeImportWriteProtection passes. The UHD 770 has no second queue, so the table's import is compared and never vouched for, the same chain as on RADV. ImportsStayWatchedThroughReads returns true on _WIN32, so the test still runs there. A Windows branch could skip when settleQueue is null, or when the probe fails the watchPrivateImports condition. That would turn this failure into a skip, and the RX 9070 XT would keep running the vouched path.

AI-assisted: yes (Claude Code)

…s writes

On RADV, importing host memory and reading it from the GPU marks the
pages as written in the write watch. The test forces
APS5_WRITE_WATCH_IMPORTS=watch, so the vouch refuses the table and
supplyWords is never called. Probe host-import write protection on
Linux, as the Windows path already does, and skip when a GPU read
reports writes or the probe fails.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@DavidAmsellem
DavidAmsellem force-pushed the test/agc-vouched-lookups-import-probe branch from dfacadf to 3440a17 Compare October 19, 2026 17:18
@DavidAmsellem

Copy link
Copy Markdown
Contributor Author

@savvaniss thank you, your reading of decideImportWatch is right: this PR returned true on _WIN32, so it left the UHD 770 case uncovered. Since your run, #7929 has merged with a Windows gate for the same test, and your main cded26c68 predates it. On a device without a settle queue, ProbeImportWriteProtection fails at the settle queue, so that gate should turn your UHD 770 failure into a skip.

I have rebased this PR onto main dbac9fa15. It now adds only the Linux gate next to the #7929 Windows block, and it gets the context from device->graphicsContext(), as that block does. The Linux condition is unchanged (writtenAfterSubmit == 0).

AMD Radeon RX 7900 XT (RADV NAVI31), Mesa 25.2.8, Linux Mint 22.3 (Ubuntu 24.04 base), kernel 7.0.0-38, GCC 13.3, Release, full build. ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, ×3:

RADV lavapipe
vouched_lookups Skipped (the device reports 4 of 4 host-imported pages written after a GPU read) Passed
vouch_queued_draws, image_table_cache, image_table_cache_bounds Passed Passed

No new VUID- errors. The only one in either log is VkDeviceCreateInfo-pNext-pNext, from my older validation layer, which does not know maintenance8. tools/check_skips.py --job linux accepts the skip, and tools/check_conventions.py passes.

If you rerun on current main with this PR merged, I would expect the UHD 770 to skip and the RX 9070 XT to keep passing, but I have not tested Windows.

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* fix error Closes an issue (Fixes #N)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

agc_driver_image_table_vouched_lookups fails on RADV since the image-table reuse v3 merge (#6454, 23629c284)

4 participants