Skip to content

fix(agc): validate storage-eviction view cleanup on Radeon - #74

Draft
JJenkx wants to merge 1 commit into
mainfrom
validation/texture-cache-5997-d92
Draft

JJenkx wants to merge 1 commit into
mainfrom
validation/texture-cache-5997-d92

Conversation

@JJenkx

@JJenkx JJenkx commented Oct 15, 2026 •

Copy link
Copy Markdown
Owner

What

Storage-cache eviction can leave a sampled view owning the entire evicted Vulkan image until a later sampled lookup or diagnostic query cleans it up. This current-main port of upstream #5997 drains that existing cleanup after eviction, outside the storage mutex. Recorder and caller ownership still keep live images available. Ondra97's original author is preserved.

This draft adds Linux/Radeon and Lavapipe validation of the existing implementation, including an 8 GB RX 6650 XT. It is a fork validation branch for boykopovar#5997.

Tested

Main d92a8dad390af1807cc91622b924252141816a5a, public head 0c3c750447812f956234f59b01b5dfd1ac905a3f. The full Linux Release project build passed on test head f620afc1b2c19482543eb748d004e7443c669aaf, whose only tree difference from the public head is the private SPIRV-Tools teardown repair gitlink. The public branch retains the official pin; its independent vendor build is unverified.

  • Twelve targeted CTests passed, zero skips, on RX 6650 XT / RADV Mesa 26.2.4 (2.66 s) and Lavapipe (5.15 s): sampled/storage cache budgets, memory accounting, resource-cache admission/oversized admission/clear, image-table/cache/bounds/reuse, one-slice aliasing and write-back overhang.
  • Negative control: keeping the PR's tests but rebuilding main's ShaderResources.cpp makes both central Radeon cases fail: the sampled texture cache kept the view of an evicted storage image, and the rejected descriptor sets retained an evicted storage image.
  • Restoring the implementation makes the complete twelve-test Radeon selection pass again. The recorder regression reads the retained image's original pixel after eviction, then verifies resource/view/image expiration after completion. The externally held view also survives eviction.
  • Conventions, whitespace and clean merge against current main pass.

These checks establish an ownership correction. The single native pair below provides preliminary memory and timing data; a repeatable title-level effect and a fix for Saros's GPU fault remain unestablished. Saros's separate startup integration and remaining device loss are recorded in #73.

Integration with draw-ahead

The public integration branch combines this patch with boykopovar#6188 head 0eb0d8903b0b, at public head 5880ec71fabda15131dca372b76e3bb2dc6d1965. Its private build head 9d90044337436e8af5714ec9e14b00dc65bb9cab differs only by the teardown gitlink. The full Linux Release build and all 23 selected cache, image-table, draw-ahead, draw-cache, graphics and recorder tests pass on Radeon and Lavapipe (4.05 s each), zero skips. A native idle-scene pair is recorded below; interactive gameplay remains unverified. The earlier four-run Astro FPS report belongs to the draw-ahead-only revision.

Native Astro pair

Astro PPSA21564 -lvl hub_crashsite, Ryzen 7950X / RX 6650 XT / RADV. The baseline is the latest boykopovar#6188 draw-ahead revision on main d92a8dad plus the common private teardown repair (a6a10e581f2c). The candidate adds only this cache-cleanup patch (9d9004433743). Both use pipeline 1, 4096 cache entries, the same compatible warmed shader cache, a 3072×1728 native window, no input, Firefox active during measurement, and APS5_TRACE_SECONDS=300:60. Both completed the trace and 280/410-second captures of the same idle camera, with different idle poses. Both ended at the planned 425-second timeout (exit 124), restored the kernel limit, and logged no fatal shader or Vulkan error.

Order Build Presents / time FPS p50 frame ms GPU ms/present
B1 Draw-ahead + cleanup 281 / 60.143 s 4.672 202.826 171.800
A1 Draw-ahead alone 264 / 60.036 s 4.397 220.380 175.225

The candidate is 6.25% faster in this one pair. Run-to-run variation, desktop GPU activity and idle phase remain uncontrolled, so this is not an established stable speed gain.

Memory medians from six samples per run during seconds 300–360 (MiB):

Build Process RSS Requested GPU buffers, all regions Resident VRAM Resident GTT
Draw-ahead + cleanup 18185.42 20333.90 5370.64 14961.54
Draw-ahead alone 18458.22 20549.52 6082.75 14466.77

The candidate has about 216 MiB less median requested GPU allocation and 273 MiB less process RSS in this pair. Its 712 MiB lower resident VRAM is partly offset by 495 MiB higher resident GTT; the entire VRAM difference must not be described as freed allocation. These are the title's DRM-client figures, deduplicated by device and client ID, following the kernel accounting definitions. RSS and GPU totals overlap and must not be added together. A single pair does not establish a repeatable memory reduction.

Detailed CPU events overflowed around seven seconds into both traces; aggregate frame/GPU counters cover the measured minutes. Exact official summary lines, in execution order:

{"commit":"9d9004433743","dirty":false,"env":{"APS5_DRAW_CACHE_ENTRIES":"4096","APS5_HOST_IMPORT_MIB":"16384","APS5_PAD_INPUT_FILE":"<path>","APS5_PIPELINED_DRAWS":"1","APS5_TRACE_SECONDS":"300:60"},"gpu":"AMD Radeon RX 6650 XT (RADV NAVI23)","driver":"radv Mesa 26.2.4-arch1.1","os":"Linux 7.2.9-arch1-1","resolution":"3840x2160","window":{"spec":"seconds 300:60","first_present":2016,"ms":60142.989},"presents":281,"frame_ms":{"p50":202.826,"p90":261.436,"p99":320.966,"max":335.408},"gpu_busy_ms_per_present":171.800,"worker_busy_pct":{"queue worker 0x0":98.984,"queue worker 0x48":97.608,"queue worker 0x40":99.686,"queue worker 0x46":6.489},"top_phases_ms_per_frame":{"Driver.Packet":646.793,"Driver.Packet.memory_wait":390.260,"Driver.Packet.draw":116.171,"Driver.Draw":115.266,"Driver.Draw.draw_and_resource_release":87.851,"Graphics.Draw":85.667,"Driver.Packet.prepare_memory":80.283,"Graphics.Draw.draw_and_resource_release":72.847},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":7.293,"events_lost":1941126,"totals_full":false}},"trace":"aps5-trace-9d9004433743-1739042.json.gz"}
{"commit":"a6a10e581f2c","dirty":false,"env":{"APS5_DRAW_CACHE_ENTRIES":"4096","APS5_HOST_IMPORT_MIB":"16384","APS5_PAD_INPUT_FILE":"<path>","APS5_PIPELINED_DRAWS":"1","APS5_TRACE_SECONDS":"300:60"},"gpu":"AMD Radeon RX 6650 XT (RADV NAVI23)","driver":"radv Mesa 26.2.4-arch1.1","os":"Linux 7.2.9-arch1-1","resolution":"3840x2160","window":{"spec":"seconds 300:60","first_present":2026,"ms":60035.594},"presents":264,"frame_ms":{"p50":220.380,"p90":272.110,"p99":336.107,"max":349.674},"gpu_busy_ms_per_present":175.225,"worker_busy_pct":{"queue worker 0x0":99.045,"queue worker 0x40":99.737,"queue worker 0x48":97.598,"queue worker 0x46":6.237},"top_phases_ms_per_frame":{"Driver.Packet":686.777,"Driver.Packet.memory_wait":411.372,"Driver.Packet.draw":124.984,"Driver.Draw":123.963,"Driver.Draw.draw_and_resource_release":93.573,"Graphics.Draw":91.328,"Driver.Packet.prepare_memory":87.734,"Graphics.Draw.draw_and_resource_release":77.177},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":6.983,"events_lost":1981713,"totals_full":false}},"trace":"aps5-trace-a6a10e581f2c-1905676.json.gz"}

Checklist

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants