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

Closed
opened 2026-10-19 06:47:52 +00:00 by blawesom · 5 comments
blawesom commented 2026-10-19 06:47:52 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by blawesom on 2026-10-19T06:47:52Z.


What

agc_driver_image_table_vouched_lookups fails on main on RADV with:

AGC graphics: image table vouched lookups: 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 zero counters suggest the cached dispatch never went through the vouch path at all on this device.

Bisect

  • 23c201722 ("perf(agc): validate a cached draw or dispatch by its shared table block's vouch", the test's introducing commit): passes on this machine
  • 23629c284~1 (before the #6454 merge): passes
  • 23629c284 (Merge pull request #6454 "perf(agc): share one image table per heap and write epoch through capture, compare, resolution and descriptors"): fails — same assertion, deterministic (3/3 solo, cold shader cache, MESA_SHADER_CACHE_DISABLE=true)

Environment

  • Linux (CachyOS), kernel 7.2.9, GCC 16.2.1, Release, BUILD_TESTING=ON
  • AMD RX 9070 XT, RADV Mesa 26.2.4
  • tests/agc_driver_image_table_cache_bounds_tests --vouched-lookups, ~0.5 s

Not the Mesa tessellation bug (#5444) and not the BDA anchor regression (#7584) — this one is separate and newer. Not checked whether NVIDIA is affected.

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5919210997 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/7766). Originally posted by [blawesom](https://github.com/blawesom) on 2026-10-19T06:47:52Z. --- ### What `agc_driver_image_table_vouched_lookups` fails on `main` on RADV with: AGC graphics: image table vouched lookups: 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 zero counters suggest the cached dispatch never went through the vouch path at all on this device. ### Bisect - `23c201722` ("perf(agc): validate a cached draw or dispatch by its shared table block's vouch", the test's introducing commit): passes on this machine - `23629c284~1` (before the #6454 merge): **passes** - `23629c284` (Merge pull request #6454 "perf(agc): share one image table per heap and write epoch through capture, compare, resolution and descriptors"): **fails** — same assertion, deterministic (3/3 solo, cold shader cache, `MESA_SHADER_CACHE_DISABLE=true`) ### Environment - Linux (CachyOS), kernel 7.2.9, GCC 16.2.1, Release, `BUILD_TESTING=ON` - AMD RX 9070 XT, RADV Mesa 26.2.4 - `tests/agc_driver_image_table_cache_bounds_tests --vouched-lookups`, ~0.5 s Not the Mesa tessellation bug (#5444) and not the BDA anchor regression (#7584) — this one is separate and newer. Not checked whether NVIDIA is affected. AI-assisted: yes
MarcZX10 commented 2026-10-19 06:52:12 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-19T06:52:12Z.


I traced the zero vouch count to the guard in Driver::validateVariant: VouchSharedRegions is only called when variant.shared is non-empty, vouch validation is enabled, legacy validation is off, and variant.runs.size() == regions.size(). Inside VouchSharedRegions, entries are also skipped before the counter increments if their region span is invalid or the weak block has expired / has an empty range. Could you capture those values on the failing third dispatch (shared.size(), runs.size(), regions.size(), plus how many shared entries have a live non-empty block and valid region bounds)? That would distinguish missing shared metadata from the count guard or expired block case. The current counters alone do not identify which condition prevented the vouch path.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6261478787 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/7766#issuecomment-6261478787). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-19T06:52:12Z. --- I traced the zero vouch count to the guard in `Driver::validateVariant`: `VouchSharedRegions` is only called when `variant.shared` is non-empty, vouch validation is enabled, legacy validation is off, and `variant.runs.size() == regions.size()`. Inside `VouchSharedRegions`, entries are also skipped before the counter increments if their region span is invalid or the weak block has expired / has an empty range. Could you capture those values on the failing third dispatch (`shared.size()`, `runs.size()`, `regions.size()`, plus how many shared entries have a live non-empty block and valid region bounds)? That would distinguish missing shared metadata from the count guard or expired block case. The current counters alone do not identify which condition prevented the vouch path.
simonbbby commented 2026-10-19 08:30:10 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by simonbbby on 2026-10-19T08:30:10Z.


@MarcZX10 I captured the requested values on the failing third dispatch, with a passing NVIDIA control.

Exact main 3fdd1f52e968c57d2b6890b11863f96aee0c11ce, Ubuntu 24.04, GCC 13.3, Release. RADV gfx1036 (Ryzen 9950X iGPU, Mesa 25.2.8) reproduces the same assertion; RTX 3090 / NVIDIA 595.99.02 passes. Built the real ImageTableCacheBounds execution fixture, ran --vouched-lookups in fresh processes with APS5_WRITE_WATCH_IMPORTS=watch, shader caches and the pipeline journal disabled, and the corresponding ICD restricted. Loader logs verify the selected vendor/device.

At Driver::validateVariant for hit = dispatch(WideSlots[1]):

Value Failing RADV Passing NVIDIA
variant.shared.size() 0 1
variant.runs.size() 32898 32898
regions.size() 32898 32898
vouchedValidation() true true
validateLegacy() false false
shared entries with a live block 0 1
shared entries with a live non-empty block 0 1
shared entries with valid region bounds 0 1

The NVIDIA entry is first=12, count=262144, offset=0, region=2, regions=32896. RADV has no entries, rather than entries whose weak blocks expired. The run/region count guard and enable/legacy settings agree, so they do not explain this failure.

I also traced insertion of the variant used by that hit. On the second dispatch, both have 32899 captured regions, of which 32898 are SRT regions. RADV's shaderMemory->SuppliedBlocks() is already empty and fresh->shared remains empty. NVIDIA has one supplied block; 32896 SRT regions alias its words, and AppendSharedWords creates the entry above. An entry log on ShaderMemory::supplyWords records no call on RADV before its failure; NVIDIA calls it on the second dispatch, passing the prechecks with paged=false and overlapping=false.

Thus the observed chain is missing supplied blocks at insertion → empty cached shared metadata → VouchSharedRegions skipped → zero vouch/refusal counters. It is upstream of the weak-block/range checks. I have not established why RADV bypasses the shared-supply callback, nor whether that omission is a correctness problem beyond the test's counter expectation.

All logging was local only. I restored all four source files byte-for-byte, rebuilt, and repeated the uninstrumented test: RADV fails 3/3 with the original assertion; NVIDIA passes 3/3. The instrumented run had the same vendor split. Clean source checkout; no proposed fix, title run, Windows run, validation-layer or performance claim.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6263029424 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/7766#issuecomment-6263029424). Originally posted by [simonbbby](https://github.com/simonbbby) on 2026-10-19T08:30:10Z. --- @MarcZX10 I captured the requested values on the failing third dispatch, with a passing NVIDIA control. Exact main `3fdd1f52e968c57d2b6890b11863f96aee0c11ce`, Ubuntu 24.04, GCC 13.3, Release. RADV gfx1036 (Ryzen 9950X iGPU, Mesa 25.2.8) reproduces the same assertion; RTX 3090 / NVIDIA 595.99.02 passes. Built the real `ImageTableCacheBounds` execution fixture, ran `--vouched-lookups` in fresh processes with `APS5_WRITE_WATCH_IMPORTS=watch`, shader caches and the pipeline journal disabled, and the corresponding ICD restricted. Loader logs verify the selected vendor/device. At `Driver::validateVariant` for `hit = dispatch(WideSlots[1])`: | Value | Failing RADV | Passing NVIDIA | |---|---:|---:| | `variant.shared.size()` | 0 | 1 | | `variant.runs.size()` | 32898 | 32898 | | `regions.size()` | 32898 | 32898 | | `vouchedValidation()` | true | true | | `validateLegacy()` | false | false | | shared entries with a live block | 0 | 1 | | shared entries with a live non-empty block | 0 | 1 | | shared entries with valid region bounds | 0 | 1 | The NVIDIA entry is `first=12, count=262144, offset=0, region=2, regions=32896`. RADV has **no entries**, rather than entries whose weak blocks expired. The run/region count guard and enable/legacy settings agree, so they do not explain this failure. I also traced insertion of the variant used by that hit. On the second dispatch, both have 32899 captured regions, of which 32898 are SRT regions. RADV's `shaderMemory->SuppliedBlocks()` is already empty and `fresh->shared` remains empty. NVIDIA has one supplied block; 32896 SRT regions alias its words, and `AppendSharedWords` creates the entry above. An entry log on `ShaderMemory::supplyWords` records no call on RADV before its failure; NVIDIA calls it on the second dispatch, passing the prechecks with `paged=false` and `overlapping=false`. Thus the observed chain is missing supplied blocks at insertion → empty cached `shared` metadata → `VouchSharedRegions` skipped → zero vouch/refusal counters. It is upstream of the weak-block/range checks. I have not established why RADV bypasses the shared-supply callback, nor whether that omission is a correctness problem beyond the test's counter expectation. All logging was local only. I restored all four source files byte-for-byte, rebuilt, and repeated the uninstrumented test: **RADV fails 3/3 with the original assertion; NVIDIA passes 3/3**. The instrumented run had the same vendor split. Clean source checkout; no proposed fix, title run, Windows run, validation-layer or performance claim.
root-over commented 2026-10-19 09:08:23 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by root-over on 2026-10-19T09:08:23Z.


Also fails on an older AMD generation, so it is not specific to RDNA 4: main 6b8228b2b, AMD Ryzen 5 5625U iGPU (Vega, RADV RENOIR), Mesa 26.0.8, Ubuntu, GCC 15.2.0, Release. Same message, (0 vouched, 0 refused, 0 columns read, 0 reused), 3/3. The same build passes with lavapipe on the same machine (VK_DRIVER_FILES=.../lvp_icd.json).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6263686050 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/7766#issuecomment-6263686050). Originally posted by [root-over](https://github.com/root-over) on 2026-10-19T09:08:23Z. --- Also fails on an older AMD generation, so it is not specific to RDNA 4: `main` `6b8228b2b`, AMD Ryzen 5 5625U iGPU (Vega, RADV RENOIR), Mesa 26.0.8, Ubuntu, GCC 15.2.0, Release. Same message, `(0 vouched, 0 refused, 0 columns read, 0 reused)`, 3/3. The same build passes with lavapipe on the same machine (`VK_DRIVER_FILES=.../lvp_icd.json`).
DavidAmsellem commented 2026-10-19 13:49:57 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by DavidAmsellem on 2026-10-19T13:49:57Z.


Following @simonbbby's trace one step further: I found why RADV never calls supplyWords. It is the write watch on the host-imported test block, not the vouch path.

main 5eba12d6b, AMD Radeon RX 7900 XT (RADV NAVI31, gfx1100), Mesa 25.2.8, Linux Mint 22.3 (Ubuntu 24.04 base), kernel 7.0.0-38, GCC 13.3, Release. Local logging only; tree restored afterwards, and the test still fails 3/3 under ctest on the clean tree.

Chain

supplyWords is only reached from ResourceMaterializer::Unwritten(), after runtime.unchangedSince(...) succeeds. On the second dispatch (same ctest environment, APS5_WRITE_WATCH_IMPORTS=watch):

RADV lavapipe
stampWrites on the wide table (first dispatch) generation 38 generation 2
host pointer import +0x210000 covering the table between the stamp and the vouch same place
ShaderMemory::Vouched on the table (second dispatch) collected 44, UnchangedSince = false collected 8, UnchangedSince = true
supplyWords not called called, paged=0 overlapping=0
column reuse by comparison (reused.compared) as unwritten (reused.unwritten)

That is why the second assertion still passes on RADV (reused == 1 counts both paths), and why the third dispatch then has shared.size() == 0 and zero vouch counters.

No unstamped store and no MarkWritten touches the table's 64 KiB blocks in that window. The only MarkWritten is the kernel's output page, in a different block. The generation moves through the dirty-page collect.

Cause

The driver's own probe already says this, but the test bypasses it. Without the variable, on this machine:

[write-watch] host imports resolve write protection: yes (4 of 4 scratch pages written after a GPU read, 4 after a GPU write, 4 after the import); imported ranges are compared

On lavapipe it is 0 of 4 … after a GPU read, 4 after a GPU write, 0 after the import. On RADV, importing a host pointer and reading it from the GPU both resolve the write protection, so a watched imported range looks CPU-written. The test forces APS5_WRITE_WATCH_IMPORTS=watch, which keeps trusting the watch on a device where the probe would unwatch it, so the vouch is right to refuse.

Two checks:

  • Forcing the import before the table is stamped (an extra Dispatch(block, 0) over the narrow table at the start of VouchedLookups) does not help. The stamp then lands after the import (generation 44), and the GPU read in the wide dispatch alone moves the range to 47 with UnchangedSince = false. The GPU read is enough by itself.
  • Allocating the block through GuestArena on Linux too, as on Windows, does not change anything. It is still private memory, so it is still a host pointer import.
APS5_WRITE_WATCH_IMPORTS RADV lavapipe
watch (the ctest setting) fails passes
unset (probe) fails fails

So the test only holds on devices whose host imports keep write protection through a GPU read. That also fits @root-over's Vega result and the NVIDIA pass. The dma-buf probe on the same RADV machine reports keep write protection: yes, so this looks specific to host pointer imports of private memory.

Possible fix (test only)

Instead of forcing watch, ask the device: PrepareImportWatch returns ImportWatch::Unwatch here, and other tests already branch on it. Skip with 77 when imported ranges are compared, or back the block with memory that goes through the dma-buf import. I have not changed the driver. I can't say whether real titles are affected, since their guest memory normally takes the dma-buf path.

On the bisect: on this machine the test already failed at its introducing commit 23c201722 (3/3, earlier today), unlike @blawesom's result. That is consistent with this cause, which depends on the device rather than on #6454.

GPUs tested: AMD Radeon RX 7900 XT (RADV NAVI31, gfx1100), Mesa 25.2.8, Linux Mint 22.3 / kernel 7.0.0-38; lavapipe (LLVM 20.1.2) as control.

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6268811693 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/7766#issuecomment-6268811693). Originally posted by [DavidAmsellem](https://github.com/DavidAmsellem) on 2026-10-19T13:49:57Z. --- Following @simonbbby's trace one step further: I found why RADV never calls `supplyWords`. It is the write watch on the host-imported test block, not the vouch path. `main` `5eba12d6b`, AMD Radeon RX 7900 XT (RADV NAVI31, gfx1100), Mesa 25.2.8, Linux Mint 22.3 (Ubuntu 24.04 base), kernel 7.0.0-38, GCC 13.3, Release. Local logging only; tree restored afterwards, and the test still fails 3/3 under `ctest` on the clean tree. ### Chain `supplyWords` is only reached from `ResourceMaterializer::Unwritten()`, after `runtime.unchangedSince(...)` succeeds. On the second dispatch (same `ctest` environment, `APS5_WRITE_WATCH_IMPORTS=watch`): | | RADV | lavapipe | |---|---|---| | `stampWrites` on the wide table (first dispatch) | generation 38 | generation 2 | | host pointer import `+0x210000` covering the table | between the stamp and the vouch | same place | | `ShaderMemory::Vouched` on the table (second dispatch) | collected 44, **`UnchangedSince` = false** | collected 8, `UnchangedSince` = true | | `supplyWords` | not called | called, `paged=0 overlapping=0` | | column reuse | by comparison (`reused.compared`) | as unwritten (`reused.unwritten`) | That is why the second assertion still passes on RADV (`reused == 1` counts both paths), and why the third dispatch then has `shared.size() == 0` and zero vouch counters. No unstamped store and no `MarkWritten` touches the table's 64 KiB blocks in that window. The only `MarkWritten` is the kernel's output page, in a different block. The generation moves through the dirty-page collect. ### Cause The driver's own probe already says this, but the test bypasses it. Without the variable, on this machine: ``` [write-watch] host imports resolve write protection: yes (4 of 4 scratch pages written after a GPU read, 4 after a GPU write, 4 after the import); imported ranges are compared ``` On lavapipe it is `0 of 4 … after a GPU read, 4 after a GPU write, 0 after the import`. On RADV, importing a host pointer and reading it from the GPU both resolve the write protection, so a watched imported range looks CPU-written. The test forces `APS5_WRITE_WATCH_IMPORTS=watch`, which keeps trusting the watch on a device where the probe would unwatch it, so the vouch is right to refuse. Two checks: - Forcing the import before the table is stamped (an extra `Dispatch(block, 0)` over the narrow table at the start of `VouchedLookups`) does not help. The stamp then lands after the import (generation 44), and the GPU read in the wide dispatch alone moves the range to 47 with `UnchangedSince` = false. The GPU read is enough by itself. - Allocating the block through `GuestArena` on Linux too, as on Windows, does not change anything. It is still private memory, so it is still a host pointer import. | `APS5_WRITE_WATCH_IMPORTS` | RADV | lavapipe | |---|---|---| | `watch` (the `ctest` setting) | fails | passes | | unset (`probe`) | fails | fails | So the test only holds on devices whose host imports keep write protection through a GPU read. That also fits @root-over's Vega result and the NVIDIA pass. The dma-buf probe on the same RADV machine reports `keep write protection: yes`, so this looks specific to host pointer imports of private memory. ### Possible fix (test only) Instead of forcing `watch`, ask the device: `PrepareImportWatch` returns `ImportWatch::Unwatch` here, and other tests already branch on it. Skip with 77 when imported ranges are compared, or back the block with memory that goes through the dma-buf import. I have not changed the driver. I can't say whether real titles are affected, since their guest memory normally takes the dma-buf path. On the bisect: on this machine the test already failed at its introducing commit `23c201722` (3/3, earlier today), unlike @blawesom's result. That is consistent with this cause, which depends on the device rather than on #6454. GPUs tested: AMD Radeon RX 7900 XT (RADV NAVI31, gfx1100), Mesa 25.2.8, Linux Mint 22.3 / kernel 7.0.0-38; lavapipe (LLVM 20.1.2) as control. AI-assisted: yes
thuanquang commented 2026-10-19 16:48:16 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by thuanquang on 2026-10-19T16:48:16Z.


An AMD proprietary driver data point: on main dbac9fa15 (which contains 23629c284), agc_driver_image_table_vouched_lookups passes 3 of 3 under ctest on an RX 6700 XT (gfx1031, RDNA 2), AMD's Windows driver 32.0.21045.5002, Windows 11 26200, with ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1 and the test's own APS5_WRITE_WATCH_IMPORTS=watch.

This doesn't separate RADV from Linux: if the cause is the write watch on the host-imported block, as @DavidAmsellem found, Windows takes a different write-watch path. I didn't capture shared.size() here.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6272395117 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/7766#issuecomment-6272395117). Originally posted by [thuanquang](https://github.com/thuanquang) on 2026-10-19T16:48:16Z. --- An AMD proprietary driver data point: on `main` `dbac9fa15` (which contains `23629c284`), `agc_driver_image_table_vouched_lookups` passes 3 of 3 under `ctest` on an RX 6700 XT (gfx1031, RDNA 2), AMD's Windows driver 32.0.21045.5002, Windows 11 26200, with `ANYPS5_REQUIRE_VULKAN=1`, `ANYPS5_NO_SHADER_CACHE=1` and the test's own `APS5_WRITE_WATCH_IMPORTS=watch`. This doesn't separate RADV from Linux: if the cause is the write watch on the host-imported block, as @DavidAmsellem found, Windows takes a different write-watch path. I didn't capture `shared.size()` here.
Sign in to join this conversation.
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5#7766
No description provided.