Skip to content

perf(shader): select the record of a T# whose offset the CPU evaluates - #6243

Merged
oneandonlydean merged 18 commits into
boykopovar:mainfrom
EagleBearerYS:perf/shader-direct-cpu-evaluable-images
Oct 18, 2026
Merged

oneandonlydean merged 18 commits into
boykopovar:mainfrom
EagleBearerYS:perf/shader-direct-cpu-evaluable-images

Conversation

@EagleBearerYS

@EagleBearerYS EagleBearerYS commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

What

Since #757, a T# loaded from a buffer heap at a runtime offset is an image table column. Every capture then snapshots the whole heap, up to 65,536 records, even when user data or an SRT read fixes the offset. That covers #5188's case, a T# read from a constant buffer at a user-data offset: #757 made it a one-column table instead of an ordinary image.

In Resident Evil Village (PPSA01556) narrowing never applies to these tables, and the cost is large. With APS5_PROFILE_DRAW=1 at the title:

  • 445 snapshots per 10 s at 5.4 ms each, so 2.4 s of every 10 s;
  • narrowing applied to 0 of 34,294 snapshots;
  • about 100k words read per capture.

With image tables switched off (APS5_NO_IMAGE_TABLES=1), the title runs about 16x faster. That's not a fix, though: 26 shaders read a T# chosen per lane and then get a null image.

With this change, a column whose T# words and offset are runtime values the SRT walker evaluates is selected:

  • the offset is kept as a descriptor source and the shader indexes entry 0;
  • the snapshot reads only the record at the evaluated offset, with the heap base moved to that record.

The column keeps a table's semantics:

  • An invalid T#, an unmapped record or an offset that carries past 32 bits is poison that faults only when a lane selects it.
  • An offset the walker can't read faults the table instead of throwing.
  • The record's mode is picked per entry, so no pipeline variant is added.
  • A dispatch that writes the record faults it as written.

A column stays a whole table in two cases:

  • its offset is chosen per lane;
  • the shader may write the memory the offset is read from: the buffer it's read from (by V#), or any memory when the read or a write goes through a pointer or a GPU-only descriptor.

When the shader also uses such a T# for an operation a table can't express (an image store, an image atomic, or a packed or BY2/BY4 load), the T# is bound directly instead, through #5188's path, for every operation of that shader on it. A T# keyed per lane keeps the table: its image stores are table operations since #6402, and its atomics and packed or BY2/BY4 loads still fault, as on main.

A selected record's descriptor index is uniform for the whole draw or dispatch, so it isn't decorated NonUniform. A column deselected because its key may be written also drops the key domains narrowed from that key.

Samplers need no change: an S# whose words the walker evaluates is already bound directly on main, so no sampler column has an offset the CPU evaluates. A test pins that. The disk cache format becomes 37, above the 36 that #1193 gave main. Merging main e49ec59 into this branch conflicted only on that line, and the merges of main 8856f18 and 4186f06 had no conflicts. The merge of main 55f82fe takes #7101's bulk scan of key buffers, and its two skips for an inaccessible key page give this PR's NarrowSkip::Unmapped reason. The merge of main f1af6c5 keeps both sides' tests in tests/ShaderMemory.cpp, with #7325's verifyChainedTableOffset after this PR's selected-record tests. The last commit adapts the selection to 682b07e, which came with 4186f06: main now poisons an image whose dword 3 wasn't captured, and a record selected past the end of its heap reads nothing there, so it was poisoned instead of selecting a null image. Dwords past the end of the buffer now count as read zeros, which is what a scalar buffer load returns there; every other path keeps main's rule.

The second commit names why narrowing is skipped in the [image-table] profile line, with selected records counted apart. The third covers the selected records and their fallbacks, and each later commit adds one of the changes above, with its test after it:

  • agc_shader_memory and agc_shader_bindless: invalid, unmapped, past-the-heap, past-the-cap and carried records, a written key buffer and a per-lane key;
  • agc_driver_image_table: a dispatch samples selected records exactly as direct bindings do, and faults on a store over its record;
  • agc_shader_disk_cache: the round trip.

After the merges, docs(agc) drops the disk cache's format version from ARCHITECTURE.md, which said 36, so the line no longer goes stale or conflicts on each bump. After the merge of main 55f82fe, test(agc) expects an image store through a T# keyed per lane to be a supported table operation, as #6402 makes it.

Not changed here:

  • On columns that remain whole tables, packed and BY2/BY4 operations still read zeros and fault, as on main, and image stores take main's path since feat(agc): store to images selected through image tables #6402.
  • The record is chosen when the capture is taken, as a direct image's T# is. A pending GPU write on the key is waited for, and a key written through an alias the write guard can't see keeps the old record, as for any direct image. A key base in the table header, with a one-key window, could widen the window at capture time instead. That changes the shader ABI, and is left for a follow-up.

Related: #757 and #5188 (both merged).

Tested

  • At the head, 8c6765b, which merges main f1af6c5 (with fix(recompiler): fold chained immediate addends of image-table record offsets #7325), on GitHub's runners (run):
    • Linux: the bindless, disk cache and image table tests pass 3 runs in a row, as do the ^agc tests (684, 0 failed). libc's precise_wait timing test failed in that run's suite; this PR doesn't touch libc.
    • Windows: the only failures are agc_driver_pm4_replay_tool and agc_shader_replay_tool, which fail the same way on that runner for an unrelated branch (run).
  • At 9dcf408, which merges main 55f82fe (with feat(agc): store to images selected through image tables #6402 and perf(recompiler): scan image-table key buffers in bulk #7101) and adds the test(agc) commit:
    • With the merge alone (4cb0512), agc_shader_bindless fails on Linux and Windows: "selected record direct operations: image_store through a T# keyed per lane left the image table or lost its unsupported mark" (run).
    • With the commit, the 17 bindless, image table, disk cache and shader-memory tests pass 3 runs in a row on Linux, as do the ^agc tests (681, 0 failed), and the libc and libkernel suites pass. On Windows the only failures are the same two replay tools (run).
  • At 090c0da, which merges main 4186f06:
    • Windows, the full Build workflow on my fork (run): 1,290 of 1,290 pass, 485 skipped, all expected by check_skips.py.
    • Linux, GitHub runner: ctest -R '^agc' runs 601 tests, 1 failed (agc_driver_preparation_scope_settle), 41 skipped (run), the same as main 2e5dd5a, ten commits earlier, on that runner (run).
    • The last commit: with the merge alone, agc_shader_bindless and agc_driver_image_table fail in every one of 3 runs on Linux, and agc_shader_bindless on Windows, whose runner has no GPU for the other. With it, both pass 5 runs in a row on both (run).
  • At a34ba0c, which merged main 8856f18 (pipelined draws on by default):
    • Windows, the full Build workflow on my fork (run): 1,265 of 1,265 pass, 473 skipped, all expected by check_skips.py. The workflow carried the runner-image CA-bundle fix (CI only, no source change).
    • Linux, GitHub runner: ctest -R '^agc' runs 589 tests, 0 failed, 42 skipped (run), the same counts as main 8856f18 on that runner (run).
  • At 0b09996, before that merge, in CI's Linux configuration: ^agc runs 589 tests, 0 failed, 42 skipped, as main e49ec59 does there, and the full suite fails only the five socket tests that machine can't run.
  • Windows (fork Build 38678651237, on 43855cb): the full suite, 1,252 of 1,252.
  • Linux, GitHub runner (verify job, on 8f28ea4):
    • the new tests need the change to build, and with it 10 runs pass;
    • the libc (73) and libkernel (140) suites pass.
      The only difference between 8f28ea4 and 43855cb is a test variable renamed because it clashed with the Windows far macro.
  • Linux, CI's configuration (Ubuntu 24.04.5, GCC 13.3, lavapipe), with a benchmark commit on top that isn't part of this PR:
    • configure, test registration, build and libs pass;
    • ctest runs 1,229 tests, and only the five socket tests that machine can't run fail (guest_datagram_* and guest_tcp), as on main there;
    • ^agc runs 576 tests with 0 failures.
  • Red check: with the selection disabled, the five updated checks, the two new ones and the new GPU test fail.
  • The later commits, each red without its fix:
    • agc_shader_bindless:
      • stores, atomics, PCK and BY2 through a T# whose record the CPU evaluates are planned direct;
      • a T# both sampled and stored is direct for both;
      • the same operations keyed per lane stay a faulting table;
      • a selected record's index carries no NonUniform in a two-wave workgroup;
      • a key a pointer store may write keeps no key domain;
      • an evaluable S# is a direct sampler (a pin).
    • agc_driver_image_table, on the GPU: 64 lanes image_store through a selected record, and the texels read back hold the value.
    • Linux, CI's configuration: every commit builds and passes the eight image-table and shader-memory tests. At the head, ctest runs 1,229 tests, and only the five socket tests that machine can't run fail.
    • GitHub runners (verify run 38716615293, against 43855cb): without these commits agc_shader_bindless fails on Linux and Windows, and agc_driver_image_table on Linux (the Windows runner has no GPU for it). With them, the 14 related tests pass 5 runs on both, and the libc and libkernel suites pass apart from main's intermittent guest_kqueue on Windows, which fails on both trees.
  • Microbenchmark (Linux): a Resident Evil Village-like capture goes from 32,768 keys, 262,161 words and 2.1-2.2 ms to 1 key, 26 words and 6-8 µs. The draw-cache compare goes from 77-81 µs to 0.05 µs.

Resident Evil Village (PPSA01556, 01.210.000) at the static main menu, on Windows 11 Home 10.0.26300, RTX 3070 Laptop (driver 617.42), Ryzen 9 5900HS, 15.4 GB RAM:

presents in the window frame p50 frame p90 capture_resources self time per draw (queue worker 0x0)
before 15 in 180.8 s 11,809 ms 13,169 ms 5,749 µs
after 49 in 181.2 s 3,662 ms 4,171 ms 1,698 µs
  • The stack: Resident Evil Village's test tree, main e34c479 plus the title's test commits, with this PR's three commits ported and no extra commit. That tree predates main's pointer and two-load table columns, so the port leaves out the offset-carry case and its test, and its disk cache format is 34. Every column that tree can plan behaves as in this PR.
  • The runs:
    • APS5_TRACE_SECONDS=1500:180 APS5_TRACE_EVENTS=1048576;
    • APS5_RE8_LAZY_PREPARE=1 APS5_NO_GPL=1, which the test tree needs to run the title on this PC;
    • a warm shader disk cache;
    • one Cross to skip the intro, then no input.
  • Departures from the Performance report form:
    • both builds are Tracy-enabled builds with no profiler connected;
    • the log went to a file, so that a crash would be seen.
  • The same scene:
    • draws per frame are the same: 13,174 and 13,166 over 14 frames;
    • the menu image is the same;
    • neither run logged a null image, an invalid runtime value or a FATAL.
  • Every phase fell: each of the eight largest phases fell 70-73% per frame.
  • Window focus: the game window was in the background for part of the before window and in the foreground for the after window. The dispatch-side stages, which this change doesn't touch, cost the same per frame in both:
    • Driver.Dispatch: 248 and 240 ms;
    • GpuMutex.wait.dispatch: 135 and 127 ms;
    • Vulkan.Dispatch.shader_resources: 90 and 94 ms.
  • Traces: the fork's pre-release, aps5-trace-a762c980a2ea-24852.json.gz (before) and aps5-trace-320af7a8feb1-21124.json.gz (after).

Before:

{"commit":"a762c980a2ea","dirty":false,"env":{"APS5_NO_GPL":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_RE8_LAZY_PREPARE":"1","APS5_TRACE_DIR":"<path>","APS5_TRACE_EVENTS":"1048576","APS5_TRACE_SECONDS":"1500:180"},"gpu":"NVIDIA GeForce RTX 3070 Laptop GPU","driver":"NVIDIA 617.42","os":"Windows 10.0.26300","resolution":"3840x2160","window":{"spec":"seconds 1500:180","first_present":875,"ms":180753.229},"presents":15,"frame_ms":{"p50":11809.09,"p90":13168.687,"p99":13975.212,"max":13975.212},"gpu_busy_ms_per_present":597.261,"worker_busy_pct":{"queue worker 0x0":99.957,"queue worker 0x38":0.034,"queue worker 0x20":98.635,"queue worker 0x28":99.604},"top_phases_ms_per_frame":{"Driver.Packet":35927.067,"Driver.Packet.memory_wait":23629.307,"Driver.Packet.draw":11731.423,"Driver.Draw":11728.805,"Shader.DrawStage":6719.182,"Driver.Draw.shader_compile_and_link":5654.378,"Shader.DrawStage.capture_resources":5554.289,"Driver.Draw.draw_and_resource_release":4505.873},"trace_dropped":false,"trace":"aps5-trace-a762c980a2ea-24852.json.gz"}

After:

{"commit":"320af7a8feb1","dirty":false,"env":{"APS5_NO_GPL":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_RE8_LAZY_PREPARE":"1","APS5_TRACE_DIR":"<path>","APS5_TRACE_EVENTS":"1048576","APS5_TRACE_SECONDS":"1500:180"},"gpu":"NVIDIA GeForce RTX 3070 Laptop GPU","driver":"NVIDIA 617.42","os":"Windows 10.0.26300","resolution":"3840x2160","window":{"spec":"seconds 1500:180","first_present":1074,"ms":181174.051},"presents":49,"frame_ms":{"p50":3661.649,"p90":4171.06,"p99":4280.652,"max":4280.652},"gpu_busy_ms_per_present":414.233,"worker_busy_pct":{"queue worker 0x0":99.891,"queue worker 0x38":0.221,"queue worker 0x20":96.478,"queue worker 0x28":98.551},"top_phases_ms_per_frame":{"Driver.Packet":10891.181,"Driver.Packet.memory_wait":6946.788,"Driver.Packet.draw":3399.883,"Driver.Draw":3398.48,"Shader.DrawStage":1929.28,"Shader.DrawStage.capture_resources":1621.917,"Driver.Draw.shader_compile_and_link":1587.204,"Driver.Draw.draw_and_resource_release":1215.804},"trace_dropped":false,"trace":"aps5-trace-320af7a8feb1-21124.json.gz"}

On main, unprofiled. A later pair on Resident Evil Village's test tree of main 0c4816f, with the fixes it needs to reach the menu, before and after this PR's head (090c0da). Same PC and driver, the same environment in both (APS5_HOST_IMPORT_MIB=6400 APS5_NO_GPL=1 APS5_TRACE_SUMMARY_EVERY=60, and the test tree's APS5_LAZY_SHADER_PREPARE=1, which it needs to run the title on this PC), no profiler connected, the game window in the foreground, at the static main menu:

menu fps frame p50 Driver.Packet per frame
before 0.028 (4 presents in the menu's first 143 s) 35.0-39.0 s 100.9-112.1 s
after 0.134 (median of the 60-s intervals 5-15 min after the menu stood, 0.129-0.139) 7.52 s 21.4-24.4 s
  • The before run ended 2.4 min after its menu stood, so it has no 5-15 min window; the 12.6 min before its menu, while the title and menu loaded, ran 0.025 fps. A before run over the same window as the after run hasn't been made.
  • The per-frame driver time agrees with the frame rate: about 4.5-5x.
  • Neither run logged a FATAL.
trace_digest of the before trace

seconds 1500:180 from present 875: 15 presents, frame p50 11809.1 / p90 13168.7 / p99 13975.2 / max 13975.2 ms, GPU busy 597.3 ms per present
NVIDIA GeForce RTX 3070 Laptop GPU, NVIDIA 617.42, Windows 10.0.26300, 3840x2160, commit a762c98, dropped: no

Slowest frames (largest slices inside each, inclusive)

  • present 877: 13975.2 ms at 24983 ms: Driver.WorkerWait (queue worker 0x38) 13971.6, Driver.WorkerWait.dequeue_order (queue worker 0x38) 13969.2, Driver.Packet (queue worker 0x0) 13955.8, Driver.Packet (queue worker 0x28) 13926.7
  • present 875: 13168.7 ms at 0 ms: Driver.Packet (queue worker 0x0) 13151.2, Driver.Packet (queue worker 0x28) 13121.8, Driver.Packet.memory_wait (queue worker 0x28) 13116.3, Driver.Packet (queue worker 0x20) 13001.0
  • present 884: 12363.2 ms at 108933 ms: Driver.WorkerWait (queue worker 0x38) 12358.2, Driver.WorkerWait.dequeue_order (queue worker 0x38) 12356.0, Driver.Packet (queue worker 0x0) 12342.7, Driver.Packet (queue worker 0x28) 12250.1

Threads (ms per frame)

thread busy wait untraced in slices < 20 us largest
queue worker 0x0 11002.3 (91 %) 1033.8 (9 %) 14.0 79.0 Driver.Packet 12031.4, Driver.Suspend 2.9
presenter 3.4 (0 %) 0.2 (0 %) 12046.7 0.1 Driver.Present 3.6
queue worker 0x38 4.3 (0 %) 10364.7 (86 %) 1681.2 0.6 Driver.Packet 3.9, Driver.WorkerWait.idle_and_completion_poll 0.2
queue worker 0x20 217.5 (2 %) 11824.1 (98 %) 8.6 4.7 Driver.Packet 11885.1, Driver.EndSubmission 0.1
queue worker 0x28 12.9 (0 %) 12034.3 (100 %) 3.1 0.1 Driver.Packet 11995.4, Driver.EndSubmission 7.0
gpu 597.6 (5 %) 0.0 (0 %) 11452.7 0.0 batch 597.6

Largest slices (ms per frame, inclusive, all threads): Driver.Packet 35915.9, Driver.Packet.memory_wait 23629.1, Driver.Packet.draw 11731.4, Driver.Draw 11728.8, Driver.WorkerWait 10567.6, Driver.WorkerWait.dequeue_order 10362.5, Shader.DrawStage 6715.2, Driver.Draw.shader_compile_and_link 5654.3

Longest waits

  • Driver.WorkerWait (queue worker 0x38) 13971.1 ms at 24988 ms, present 877
  • Driver.Packet.memory_wait (queue worker 0x28) 13790.7 ms at 25119 ms, present 877
  • Driver.Packet.memory_wait (queue worker 0x20) 13525.9 ms at 25056 ms, present 877
  • Driver.Packet.memory_wait (queue worker 0x28) 12933.3 ms at 187 ms, present 875
  • Driver.Packet.memory_wait (queue worker 0x20) 12704.7 ms at 101 ms, present 875
  • Driver.WorkerWait (queue worker 0x38) 12358.0 ms at 108938 ms, present 884
  • Driver.WorkerWait (queue worker 0x38) 12347.4 ms at 132763 ms, present 886
  • Driver.Packet.memory_wait (queue worker 0x28) 12138.4 ms at 132880 ms, present 886

Largest GPU batches (GPU ranges inside, and the CPU slices that recorded each, inclusive)

  • batch 531: 80.0 ms at 138007 ms, present 886: GPU no ranges; recorded by Driver.Packet (queue worker 0x0) 1768.9, Driver.Packet.draw (queue worker 0x0) 1768.5, Driver.Draw (queue worker 0x0) 1768.2, Driver.Draw.draw_and_resource_release (queue worker 0x0) 1038.4
  • batch 157: 79.8 ms at 44187 ms, present 878: GPU no ranges; recorded by Driver.Packet (queue worker 0x0) 1610.7, Driver.Packet.draw (queue worker 0x0) 1610.4, Driver.Draw (queue worker 0x0) 1610.2, Driver.Draw.draw_and_resource_release (queue worker 0x0) 943.8
  • batch 111: 75.1 ms at 30995 ms, present 877: GPU no ranges; recorded by Driver.Packet (queue worker 0x0) 1878.5, Driver.Packet.draw (queue worker 0x0) 1878.2, Driver.Draw (queue worker 0x0) 1877.9, Driver.Draw.draw_and_resource_release (queue worker 0x0) 1088.2
trace_digest of the after trace

seconds 1500:180 from present 1074: 49 presents, frame p50 3661.6 / p90 4171.1 / p99 4280.7 / max 4280.7 ms, GPU busy 414.2 ms per present
NVIDIA GeForce RTX 3070 Laptop GPU, NVIDIA 617.42, Windows 10.0.26300, 3840x2160, commit 320af7a, dropped: no

Slowest frames (largest slices inside each, inclusive)

  • present 1108: 4280.7 ms at 126325 ms: Driver.WorkerWait (queue worker 0x38) 4268.2, Driver.WorkerWait.dequeue_order (queue worker 0x38) 4265.5, Driver.Packet (queue worker 0x0) 4254.0, Driver.Packet (queue worker 0x28) 4219.2
  • present 1088: 4210.8 ms at 51814 ms: Driver.WorkerWait (queue worker 0x38) 4207.0, Driver.WorkerWait.dequeue_order (queue worker 0x38) 4204.5, Driver.Packet (queue worker 0x0) 4194.5, Driver.Packet (queue worker 0x28) 4157.6
  • present 1084: 4194.8 ms at 36619 ms: Driver.WorkerWait (queue worker 0x38) 4190.6, Driver.WorkerWait.dequeue_order (queue worker 0x38) 4187.0, Driver.Packet (queue worker 0x0) 4178.6, Driver.Packet (queue worker 0x28) 4157.8

Threads (ms per frame)

thread busy wait untraced in slices < 20 us largest
queue worker 0x0 3215.0 (87 %) 471.3 (13 %) 11.2 84.1 Driver.Packet 3677.5, Driver.Suspend 7.1
presenter 7.3 (0 %) 0.4 (0 %) 3689.7 0.1 Driver.Present 7.8
queue worker 0x38 8.2 (0 %) 3615.5 (98 %) 73.7 0.8 Driver.Packet 7.9, Driver.EndSubmission 0.2
queue worker 0x20 220.9 (6 %) 3473.0 (94 %) 3.5 4.9 Driver.Packet 3558.8, Driver.EndSubmission 7.9
queue worker 0x28 14.8 (0 %) 3681.4 (100 %) 1.2 0.2 Driver.Packet 3637.6, Driver.EndSubmission 6.2
gpu 413.6 (11 %) 0.0 (0 %) 3283.8 0.0 batch 413.6

Largest slices (ms per frame, inclusive, all threads): Driver.Packet 10881.8, Driver.Packet.memory_wait 6946.6, Driver.WorkerWait 3796.8, Driver.WorkerWait.dequeue_order 3613.1, Driver.Packet.draw 3399.9, Driver.Draw 3398.5, Shader.DrawStage 1925.3, Shader.DrawStage.capture_resources 1615.1

Longest waits

  • Driver.WorkerWait (queue worker 0x38) 4267.9 ms at 126338 ms, present 1108
  • Driver.WorkerWait (queue worker 0x38) 4207.0 ms at 51818 ms, present 1088
  • Driver.WorkerWait (queue worker 0x38) 4191.0 ms at 36624 ms, present 1084
  • Driver.WorkerWait (queue worker 0x38) 4185.5 ms at 17621 ms, present 1079
  • Driver.WorkerWait (queue worker 0x38) 4167.0 ms at 134611 ms, present 1110
  • Driver.WorkerWait (queue worker 0x38) 4090.8 ms at 104303 ms, present 1102
  • Driver.WorkerWait (queue worker 0x38) 4076.9 ms at 100209 ms, present 1101
  • Driver.Packet.memory_wait (queue worker 0x28) 4060.6 ms at 126492 ms, present 1108

Largest GPU batches (GPU ranges inside, and the CPU slices that recorded each, inclusive)

  • batch 1764: 56.0 ms at 145870 ms, present 1113: GPU no ranges; recorded by Driver.Packet (queue worker 0x0) 42.8, Driver.Packet.dispatch (queue worker 0x0) 42.7, Driver.Dispatch (queue worker 0x0) 42.7, GpuMutex.wait.dispatch (queue worker 0x0) 39.8
  • batch 2034: 53.8 ms at 167065 ms, present 1119: GPU no ranges; recorded by Driver.Packet (queue worker 0x0) 50.7, Driver.Packet.dispatch (queue worker 0x0) 50.7, Driver.Dispatch (queue worker 0x0) 50.6, GpuMutex.wait.dispatch (queue worker 0x0) 46.4
  • batch 404: 52.6 ms at 33006 ms, present 1083: GPU no ranges; recorded by Driver.Packet (queue worker 0x0) 59.3, Driver.Packet.dispatch (queue worker 0x0) 59.3, Driver.Dispatch (queue worker 0x0) 59.2, GpuMutex.wait.dispatch (queue worker 0x0) 54.4

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
  • Unblocks: PPSA01556 Resident Evil Village (PPSA01556) #5169 (the title and menus: image table snapshots)
  • GPUs tested: NVIDIA GeForce RTX 3070 Laptop GPU, driver 617.42, Windows 11 Home 10.0.26300 (the Resident Evil Village runs); Mesa lavapipe (mesa-vulkan-drivers 25.2.8), Ubuntu 24.04.5 (the Linux ctest suite)
  • AI-assisted: yes

Overlap (checked against main bc400be and the open PRs, 2026-10-16): #6232 also adds a TableColumn field (pointerHops), so the two conflict in TableColumn::operator==, the plan encoder's size and field-count asserts in ShaderDiskCache.cpp, and the test lists. Whichever merges second keeps both fields in the comparison, the encoder and the decoder, updates those asserts and sets FormatVersion above main's. #6488 (waterfall loops over per-lane T#s) adds two TableColumn fields, laneKey and implicitDerivatives, and conflicts in TableColumn::operator== and the test list in ShaderMemory.cpp. It also sets the field-count assert to 17 and FormatVersion to 37, as this PR does, so git merges those two lines without a conflict; whichever merges second raises them by hand (19 fields with both, and the next format version), and keeps all four fields in the encoder and the decoder. #6440 (reuse an image table column's records while its words are unchanged) adds its memo counters where this PR adds its narrowing and selection counters in ResourceMaterializer.cpp, changes the same [image-table] statistics line, and adds its test at the same place in ShaderMemory.cpp; keep both sets of counters, print both, and keep both tests. #6032, #6296 and #6858 each add EntryHeaderBytes on the line after FormatVersion; keep both lines. #6674 (uncompressed FMASK images) adds a debt line next to this PR's image-table line in docs/dev/debt/shader.md; keep both.

#6402 (Pipodi, merged: stores to images selected through image tables) makes an image_store through a T# keyed per lane a supported table operation. It merged without conflicts here, and the test(agc) commit after the merge of main 55f82fe changes the one expectation it broke: in agc_shader_bindless's selected record direct operations case, that store is now TableOperation::Supported, while atomics, PCK and BY2/BY4 keyed per lane still fault. A store whose record the CPU evaluates stays a direct binding here, and #6402's storage table takes the stores keyed per lane.

Since boykopovar#757, a T# loaded from a buffer heap at a runtime offset is an
image table column, and every capture snapshots the whole heap, up to
65,536 records, even when user data or an SRT read fixes the offset.
When the T#'s eight dwords and its offset are runtime values the SRT
walker evaluates, the column is now selected: the offset is kept as a
descriptor source, the shader indexes entry 0, and the snapshot reads
only the record at the evaluated offset, with the heap base moved to
that record.

The column keeps a table's semantics. An invalid T#, an unmapped record
or an offset that carries past 32 bits is poison that faults only when a
lane selects it; an offset the walker cannot read faults the table
instead of throwing; the record's mode is picked per entry, so no
pipeline variant is added; and a dispatch that writes the record faults
it as written by its dispatch. Dwords past the heap read zeros, as the
scalar loads would, and a record past the key cap is read rather than
poisoned.

A column stays a whole table when its offset is chosen per lane, or when
the shader may write the memory the offset is read from at run time: the
buffer it is read from (by V#), or any memory when the read or a write
goes through a pointer or a GPU-only descriptor. Samplers are unchanged:
an S# the walker evaluates is already a direct sampler. The plan stores
the selection, so the disk cache format is 36.

Five agc_shader_memory and agc_shader_bindless checks asserted the old
planning and now assert the selected record:
- "image table SRT key": a key read through the SRT narrowed a 4-key
  table to records 0 and 2. It now selects record 2 alone, captures no
  other record, and a changed key moves the capture without changing the
  module or its disk key.
- "image table key union" and "image table late key": two keys of one
  heap shared one column with two value key domains. Each key now
  selects its own record, as two one-record tables.
- "image table unkeyed access": a read keyed through the SRT shared a
  whole column with a read keyed per lane. The first now selects its
  record; the second keeps the whole, unnarrowed table.
- "uniform table image": the T# at a user data offset was one key of a
  full table. It is now the one selected record, and the record the user
  data does not select is not read.
A value key domain only arises for a key the walker evaluates, so it no
longer narrows an image column; key buffer domains (keys loaded per
lane) still do.
The [image-table] line under APS5_PROFILE_DRAW now splits the skipped
narrowings by reason: a value key that cannot be evaluated, a key
descriptor that is not a buffer, a key buffer with more positions than
APS5_IMAGE_TABLE_KEY_SCAN (with the most positions seen), pending GPU
writes over the key buffer, and an unmapped key page. Selected records
never narrow, so the line counts them apart.
agc_shader_memory and agc_shader_bindless: an invalid selected T# is
poisoned with its words without changing the artifact; a key past the
heap selects a null image without reading the heap; an unmapped selected
record is Unmapped poison and is not read; a key loaded from a constant
buffer at an SRT offset selects its record, and one that cannot be read
faults the table instead of throwing; a key loaded from a buffer the
shader writes keeps the whole table; a key chosen per lane keeps the
table; a record past the 65,536-key cap is selected; and a selected
record whose second load carries past 32 bits is OffsetCarry poison while
the record past the wrap is read.

agc_driver_image_table: a dispatch keyed from a constant buffer at an SRT
offset samples three records exactly as their direct bindings do, with
one module and one bound image; samples zeros for a key past the table;
does not fault for an invalid record under a clear EXEC; reports the
invalid record's address, words and reason when it selects it; and faults
when it stores over its selected record.

agc_shader_disk_cache: a selected column round-trips in the hand-built
plan, a fixture plans one and materializes it after a round trip, and a
selection past the sources is rejected.
@github-actions

github-actions Bot commented Oct 15, 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 6032 core/shader/recompiler/ShaderDiskCache.hpp L16
PR 6296 core/shader/recompiler/ShaderDiskCache.hpp L16
PR 6440 core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp L322, L350-352
PR 6674 docs/dev/debt/shader.md L36-38
PR 6858 core/shader/recompiler/ShaderDiskCache.hpp L16
PR 6924 core/shader/recompiler/ShaderDiskCache.hpp L16

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 907 core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
core/shader/recompiler/SpirvBackend/src/SpirvImageEmitter.cpp
PR 1341 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
PR 2434 docs/dev/debt/libSceAgcDriver.md
PR 3247 core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.cpp
PR 4448 docs/dev/debt/libSceAgcDriver.md
PR 4650 core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterState.hpp
docs/dev/debt/libSceAgcDriver.md
PR 5021 core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterState.hpp
core/shader/recompiler/SpirvBackend/src/SpirvImageEmitter.cpp
docs/dev/debt/shader.md
PR 5058 docs/dev/debt/libSceAgcDriver.md
PR 5371 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
core/shader/recompiler/SpirvBackend/src/SpirvImageEmitter.cpp
docs/dev/debt/shader.md
PR 5372 docs/dev/debt/libSceAgcDriver.md
PR 5426 docs/dev/debt/shader.md
PR 5499 docs/dev/debt/libSceAgcDriver.md
PR 5500 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/ShaderDiskCache.cpp
docs/dev/debt/shader.md
PR 5609 core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.cpp
PR 5925 core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.hpp
docs/dev/ARCHITECTURE.md
docs/dev/debt/libSceAgcDriver.md
PR 5941 docs/dev/debt/shader.md
PR 5958 core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
core/shader/recompiler/Optimization/src/ResourceTracker.cpp
core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/SpirvBackend/src/SpirvImageEmitter.cpp
docs/dev/debt/shader.md
PR 6009 docs/dev/debt/shader.md
PR 6044 docs/dev/ARCHITECTURE.md
PR 6054 docs/dev/debt/libSceAgcDriver.md
docs/dev/debt/shader.md
PR 6094 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
docs/dev/debt/shader.md
PR 6177 core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp
core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterState.hpp
PR 6194 docs/dev/debt/libSceAgcDriver.md
PR 6222 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterState.hpp
docs/dev/debt/libSceAgcDriver.md
docs/dev/debt/shader.md
PR 6223 docs/dev/debt/libSceAgcDriver.md
PR 6232 core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp
core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/libs/prx/libSceAgcDriver/tests/execution/ImageTable.cpp
core/shader/recompiler/IntermediateRepresentation/include/IntermediateRepresentation/IrMetadata/ControlFlowInfo.hpp
core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
core/shader/recompiler/Optimization/src/ResourceTracker.cpp
core/shader/recompiler/ShaderDiskCache.cpp
PR 6235 core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp
core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
docs/dev/debt/shader.md
PR 6273 docs/dev/debt/libSceAgcDriver.md
PR 6300 docs/dev/debt/libSceAgcDriver.md
PR 6317 docs/dev/debt/shader.md
PR 6412 core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp
core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.hpp
docs/dev/ARCHITECTURE.md
docs/dev/debt/libSceAgcDriver.md
docs/dev/debt/shader.md
PR 6416 core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterState.hpp
PR 6481 core/libs/prx/libSceAgcDriver/tests/execution/ImageTable.cpp
docs/dev/debt/libSceAgcDriver.md
PR 6488 core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp
core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/IntermediateRepresentation/include/IntermediateRepresentation/IrMetadata/ControlFlowInfo.hpp
core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
core/shader/recompiler/Optimization/src/ResourceTracker.cpp
core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.hpp
core/shader/recompiler/SpirvBackend/src/SpirvImageEmitter.cpp
docs/dev/debt/shader.md
PR 6492 docs/dev/debt/libSceAgcDriver.md
PR 6498 docs/dev/debt/libSceAgcDriver.md
PR 6503 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterState.hpp
docs/dev/ARCHITECTURE.md
PR 6539 core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.cpp
PR 6548 docs/dev/debt/libSceAgcDriver.md
PR 6563 docs/dev/debt/libSceAgcDriver.md
PR 6645 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 6727 docs/dev/debt/libSceAgcDriver.md
PR 6741 docs/dev/debt/libSceAgcDriver.md
PR 6767 core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterState.hpp
docs/dev/debt/shader.md
PR 6783 docs/dev/debt/libSceAgcDriver.md
PR 6786 docs/dev/debt/libSceAgcDriver.md
PR 6804 docs/dev/debt/libSceAgcDriver.md
PR 6808 docs/dev/debt/libSceAgcDriver.md
PR 6867 docs/dev/debt/libSceAgcDriver.md
PR 6879 core/shader/recompiler/ShaderDiskCache.cpp
PR 6931 docs/dev/ARCHITECTURE.md
PR 6941 core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp
core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.hpp
core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterState.hpp
docs/dev/debt/libSceAgcDriver.md
PR 6946 core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp
core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.hpp
docs/dev/ARCHITECTURE.md
docs/dev/debt/libSceAgcDriver.md
PR 6947 core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp
core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.hpp
core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterState.hpp
core/shader/recompiler/SpirvBackend/src/SpirvMemory/SpirvDescriptors.cpp
docs/dev/ARCHITECTURE.md
docs/dev/debt/libSceAgcDriver.md
PR 6973 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
docs/dev/debt/libSceAgcDriver.md
PR 6977 core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterState.hpp
docs/dev/debt/libSceAgcDriver.md
docs/dev/debt/shader.md
PR 6987 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
docs/dev/debt/libSceAgcDriver.md
PR 6989 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
docs/dev/debt/libSceAgcDriver.md
PR 6995 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
docs/dev/debt/libSceAgcDriver.md
PR 7002 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
docs/dev/debt/libSceAgcDriver.md
PR 7089 docs/dev/debt/libSceAgcDriver.md
PR 7154 docs/dev/debt/libSceAgcDriver.md
PR 7175 docs/dev/debt/libSceAgcDriver.md
PR 7178 docs/dev/debt/libSceAgcDriver.md
PR 7193 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
PR 7201 core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterState.hpp
PR 7223 core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp
core/libs/prx/libSceAgcDriver/tests/execution/ImageTable.cpp
core/shader/recompiler/IntermediateRepresentation/include/IntermediateRepresentation/IrMetadata/ControlFlowInfo.hpp
core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
core/shader/recompiler/Optimization/src/ResourceTracker.cpp
core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.hpp
core/shader/recompiler/SpirvBackend/src/SpirvImageEmitter.cpp
docs/dev/debt/shader.md
PR 7258 docs/dev/debt/libSceAgcDriver.md
PR 7332 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterState.hpp
core/shader/recompiler/SpirvBackend/src/SpirvImageEmitter.cpp
docs/dev/debt/libSceAgcDriver.md
docs/dev/debt/shader.md

… table cannot express its operation

An image table cannot store, update atomically or read PCK and BY2/BY4
through its records (boykopovar#757): those operations fault and read zeros. boykopovar#6243
turns a heap T# whose words and record offset the SRT walker evaluates
into a selected one-record table, which kept that limitation although
such a T# is one known descriptor, as boykopovar#5188's direct images were.

PlanTableColumns now binds such a T# directly, for every operation of the
shader on it, when any of them is a store, an atomic, a packed or a
BY2/BY4 access. A T# keyed per lane, or by a value the walker cannot
evaluate, keeps its table and its unsupported-operation fault. The disk
format moves to 37 so that plans cached by boykopovar#6243's builds are not reused.
…hose record the CPU evaluates

verifySelectedRecordDirectOperations plans image_store, image_atomic_add,
image_load_pck and image_load_by2 through a heap T# keyed by an SRT value,
which must be bound directly, and through a T# keyed per lane, which must
stay a table with its unsupported mark. A T# that is both sampled and
stored is bound directly for both, and one that is only sampled still
selects its record.

RunSelectedStoreTests stores through a record keyed by an SRT value on the
GPU and reads the texels back. Before the fix both failed: the T# was
planned through an image table, and the store faulted as an unsupported
operation.
…directly

A sampler column is planned only when DirectSampler cannot evaluate the
S#, so no sampler record is ever selected: an S# read from a heap at an
offset the SRT walker evaluates is a direct sampler, and one keyed per
lane is a sampler table.
…e record

A selected record is one map entry for the whole dispatch, so its
descriptor index is dynamically uniform. The emitter decorated it
NonUniform like any table index whenever the workgroup spans more than
one subgroup, and on every graphics stage, which makes drivers scalarize
the access. The element index, its access chain, the loaded image and the
sampled image of a selected record are no longer decorated; table
samplers and tables keyed per lane keep the decoration.
…iform

verifySelectedRecordUniformIndex compiles the program keyed by an SRT
value and the one keyed per lane with a two-wave workgroup. The selected
record's table index carries no NonUniform decoration and the per-lane
table's still does. Before the change the selected record's was decorated.
… key may be written

CheckTableStores deselects a selected column whose key the dispatch may
write: a key read through a pointer or a V# while the shader stores
through a pointer, or through a V# the shader writes. The column kept the
key domains narrowed from that same key buffer, which the domain rule
clears only when the domain's own V# is written, so a shader storing
through a pointer still narrowed its whole table on a key it may
overwrite. Deselection now clears them as well.
… domain

The key loaded from a constant buffer at an SRT offset has a key domain.
With a global_store_dword added, the column is deselected and keeps no
key domain. Before the fix it kept the domain.
Since 682b07e, an image whose dword 3 wasn't captured is poisoned
(OutsideSnapshot). A record selected past the end of its heap reads
nothing there, so it was poisoned instead of selecting a null image, and
agc_shader_bindless and agc_driver_image_table failed after the merge of
main. A scalar buffer load returns zeros past the end of the buffer, so
those dwords now count as read zeros, and the dwords the selection reads
count as captured. Every other path keeps main's rule.
@LeandroLP23

Copy link
Copy Markdown
Contributor

Small doc mismatch: this PR bumps FormatVersion in ShaderDiskCache.hpp to 37, but the docs/dev/ARCHITECTURE.md line it edits says FormatVersion 36. On main the same line already lags (33 there vs 36 in the code). Dropping the number, so it reads "The disk cache stores the table...", would keep the line from going stale on every bump. It would also stop the two PRs that touch it from conflicting on that line.

The line said FormatVersion 36 while the code is at 37, as main's says 33 against 36. Without the number it no longer goes stale on each bump or conflicts between PRs that bump it.
EagleBearerYS added a commit to EagleBearerYS/AnyPS5 that referenced this pull request Oct 16, 2026
@EagleBearerYS

Copy link
Copy Markdown
Contributor Author

Thanks, @LeandroLP23. The line now reads "The disk cache stores ...", without the number (ca174bc here, merged into #6454 too).

EagleBearerYS added a commit to EagleBearerYS/AnyPS5 that referenced this pull request Oct 17, 2026
@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 17, 2026
Main's boykopovar#7101 reads a key buffer's words in one call where this branch
names the reason a narrowing is skipped. Keep main's bulk read and
count both of its unmapped-page skips as unmapped.
Main's boykopovar#6402 runs image stores through an image table, so a T# keyed
per lane keeps its table with a supported image_store and an
unsupported mark for the other operations.
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 18, 2026
Main's boykopovar#7325 adds verifyChainedTableOffset to the image table tests
where this branch adds its selected-record tests. Keep both, with
main's call after this branch's.
@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 18, 2026
@oneandonlydean

Copy link
Copy Markdown
Collaborator

Thanks for this. Our review of 9dcf408 passed (the bindless, disk cache and image table tests pass with the change merged onto main), so this is close.

It now conflicts with main in core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp, after #7325 ("fold chained immediate addends of image-table record offsets") merged. Could you rebase onto current main? The other files merge cleanly.

One more thing to know: #6488 also uses cache FormatVersion 37. Whichever of the two merges second will need to move to 38, so we may ask for that bump after the rebase.

1 similar comment
@oneandonlydean

Copy link
Copy Markdown
Collaborator

Thanks for this. Our review of 9dcf408 passed (the bindless, disk cache and image table tests pass with the change merged onto main), so this is close.

It now conflicts with main in core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp, after #7325 ("fold chained immediate addends of image-table record offsets") merged. Could you rebase onto current main? The other files merge cleanly.

One more thing to know: #6488 also uses cache FormatVersion 37. Whichever of the two merges second will need to move to 38, so we may ask for that bump after the rebase.

@EagleBearerYS

Copy link
Copy Markdown
Contributor Author

@oneandonlydean main is merged in at 8c6765b (main f1af6c5), so the conflict with #7325 in tests/ShaderMemory.cpp is resolved. Both sides' tests stay, with #7325's verifyChainedTableOffset after this PR's selected-record tests, and the other files merged cleanly. I merged rather than rebased, so the head you reviewed, 9dcf408, is the merge's first parent and the change itself is unchanged. On GitHub's runners (run), the bindless, disk cache and image table tests pass 3 runs in a row on Linux, as do the ^agc tests. On Windows the only failures are agc_driver_pm4_replay_tool and agc_shader_replay_tool, which fail the same way on that runner for an unrelated branch today (run). The run shows as failed because of those two and libc's precise_wait timing test on Linux; this PR doesn't touch libc.

On the cache format: if #6488 lands first, the next merge of main here moves this PR to 38. #6455, next in your order, merges cleanly with current main, with every check passing (two skipped).

@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 18, 2026
@oneandonlydean
oneandonlydean merged commit 0e94c5d into boykopovar:main Oct 18, 2026
10 checks passed
oneandonlydean pushed a commit that referenced this pull request Oct 18, 2026
…image and pair limits

Since #6243, each read whose record offset the CPU evaluates gets its own
selected table column, so a shader that reads one heap at many such keys
plans one image per key. Past 64 keys that is refused with "image resource
limit exceeded", or with "sampled image/sampler pair limit exceeded" when
each read is sampled twice, where the shader planned within both limits
before.

After planning the table columns, the tracker now estimates the images
and sampled pairs that collecting the program would add, keyed as
AddImage and AddSampledPair key them, from the planned column sources
and the direct handles. If either is over its limit, it plans again with
the columns of one heap unselected, the heap with the most selected
columns first, until both fit or no heap is left. Those reads then share
one keyed column, as before #6243: the union of their key domains and the
largest key. A shader within both limits plans exactly as before, from
one planning pass.

The estimate counts images exactly. A direct sampler is told apart by its
handle's words and whether the sample adjusts, before the canonicalization
collecting it applies, so the pair count can only be too high and errs
toward merging.
adriadam10 pushed a commit that referenced this pull request Oct 19, 2026
#6243 now expects a per-lane table image store to be supported, since
main's #6402 runs image stores through image tables. This branch
carries #6243's test, so it takes the same expectation.
adriadam10 pushed a commit that referenced this pull request Oct 19, 2026
#6243's new head merges main f1af6c5, whose #7325 adds
verifyChainedTableOffset next to the selected-record tests this
branch carries from #6243. That test reads the record words from the
snapshot's shared word list; this branch keeps the words with each
table's snapshot, so the merge reads them from the table it checks.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc* docs shader core/shader

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants