What stays per draw is the handle reads, a bit test for each slot, and the bind of the table. The fs_key and the descriptor set of the texture slots go when the bits are all set and the handles did not change since the last draw of the same program (item 6's signature, for the texture slots alone).
The checks, as for the map:
draw_state_check=1 resolves each slot in full and counts each set bit that a full resolve contradicts. Each
contradiction names the event that the model missed.The steps:
pool_map_shadow was).
This shows that the events are complete before any draw uses them.Step 1 is in (tex_events_shadow). The events go into addr_gens, with a new space, ADDR_GENS_WRITE, for the
GPU side's writes, the writes to targets, surfaces made or freed and pending storage images. A kept texture's
generations are summed over every level and layer. Over the race route for 200 s, about 333 kept textures a present
were claimed current, and no check contradicted a claim. About 13 a present were checked with nothing changed, from
slots that ranges share. Two things it found:
rt_bytes, which vk_surf_guest_size gives) missed the draws to the smaller levels of a
downsample chain. The texture memo asks its pending results and pending storage images over that same range
(tex_memo_unpended, tex_memo_image_pending). Whether a result pending over a texture's other levels reaches a
draw is not checked yet.ADDR_GENS_READ_MAX). Step 2's
index of textures keeps a stamp for each texture, so the size of a texture costs nothing.A profile of the texture resolves before step 2 found two costs that the design did not need, now gone:
vk_uma_import_in took g_uma.lk at each take of the write tracking, 4.8% of the renderer thread (52201bebe).gpu_mem_granules_generation walked each 2 MiB granule of a texture at each quiet check, 3.4% (585d3bbeb).After them, the resolves are 8.5% of the renderer thread. The memo itself is about 3%. What step 2 could take out (the
memo's header and pending checks, the quiet check, the take's search) is about 5.3%, about 0.4 ms of a present. The
write tracking finds the CPU's writes when a check takes in the scans of its own range for the epoch (vk_ww_take),
and the epoch moves at each submission and wait. So no event is not no write until every watched page is taken in.
That is a wait for the scanner in the frame, or the intake that each check does now, which is most of what is left of
tex_memo_unwritten and quiet_own.
8. Render targets published only when memory needs them. A profile of 2026-11-23 of an Ounce game's race, on a
discrete GPU whose driver imports guest memory as dma-bufs (udmabuf), found vk_surf_publish at 21.5% of the GPU
thread, its largest phase. 18.1% came from one path: the import branch of rt_watch publishes every target drawn
over imported memory at each release. A counter of publishes by why (the render targets published a present line)
found 2 such publishes a present. One is a 6144x6144 RGBA8 surface of 151 MB that compute writes as a storage image,
published whole at each present. It costs the GPU thread 2.5 ms a present in the CPU's work for each page in
own_publish: gpu_mem_written_cpu stamps about 36,900 pages written, and vk_rt_before_publish_cpu looks up the
targets that alias them, under the page locks. It also copies 151 MB on the GPU a present, and its stamps make a
3072x3072x2 texture beside it load 36 MB of pieces again in each present. The CPU never asked for the surface.
A driver keeps a target's pixels in the image while only the GPU uses them. Memory gets them when something outside the GPU reads it, and a GPU reader of that address takes the image. yuzu and Ryujinx mark the range as modified by the GPU and download it when the CPU's access faults. The change:
tex_resolve already does, and
guest memory under it is not written.vk_rt_watch_hit), or for an engine that reads guest
memory directly. A target that the CPU read in the last few presents (cpu_asked) stays eager, so a game that
reads a small target each frame takes no fault each frame.uma.c). This needs a watch that does not move the pages into the alias pool. Over a host
pointer import, amdgpu takes the pages again at each submission and fails on a trapped one, so the publish stays
eager and in place there.The test vulkan_uma_region_trap shows that a dma-buf region takes a trap of the CPU's mapping with the driver's
submissions unaffected: on RADV, its mapping stayed with no access through 100 submissions that wrote it on the GPU,
and the CPU then read the last write. vk_uma_region_held tells such a region from a host pointer import. The
change is done when the GPU thread's time for each frame drops in the race, the texture memo misses for memory
written fall, the race's screenshots match at fixed frames, and the save thumbnail of commit 12f8977cd still holds
its picture. On that host this is the largest single item, so it comes before items 6 and 7.
Points 1 to 3 and 5 are in place for dma-buf regions (commit 73e87dc43). In the race, A/B/B/A against the commit before it, the frame rate went from 52 to 54 fps to 64 to 66, the GPU thread from 15.7 to 16.5 ms a present to 13.3 to 13.5, and the staging of bindings from 147 MB a present on the GPU and 36 MB on the CPU to under 17 MB and 0.2 MB. What is left:
Made from docs/dev/draw-cost.md at 69237645142c. GPL-3.0-or-later.