RUNTIME 2325: A rate-mapped pass's host step decodes GPU-written records on the GPU (its GPU route)

A render pass over a rasterization-rate map that executes an indirect command buffer the GPU
may write goes to the host step. There the host read every record, decoded it and drew each
command through the probe and the fan-out routes. On the consumer's RTX 3090 that step took
44.7 ms of a 65.8 ms frame, reading 781 records a frame. The only rule its executions broke was
the rate map's.

At a host step that fans the pass's triangles out, an execution whose records the GPU may write,
and which takes its merged GPU form once the rate map's rule is passed over (the cause.rs
decision), now takes its GPU route (render/executions/gpu_route.rs):
- The step records the form's prework: the head, the preprocess and the two merge passes. It
  copies each command's first corner and the merged draw's two VkDrawIndirectCommands to the
  host, submits that with a fence and waits, as it does for its probe.
- The host reads those words and no record. Each command that draws becomes one direct draw of
  its corners in the state's merged variant, with the merged header pushed
  (RenderLowering::merged_header).
- The probe and the routes take those draws as they take commands the host read: probed, then
  fanned out, boxed, in parts or region by region. A long corner draw is cut into piece-sized
  ranges, as an indexed command is.
- The host reads the records as before where the total reaches MERGED_CHUNK corners, where the
  prefix does not rise to the total, or where the prework did not complete.

RenderExecution::record_gpu's prework moves into RenderExecution::prework, which both paths
share. The replay loop takes a GPU route's corners beside the records the host read (Replayed,
StepCommand). The new counters are WorkCounts::rate_map_gpu_routes and
rate_map_gpu_route_wait_nanos.

Tests:
- New, tests::rate_mapped_gpu_route. Eight commands of a buffer that inherits the encoder's
  pipeline state: grids, one in two instances, one without indices, and the large, medium and
  wide triangles the probe flags. Each command is nearer than the one before, under LessEqual
  depth and half-alpha blending. It asserts no record read, one route, one probe and three
  flagged draws, and that the colour and Depth32Float bytes equal the encoder's own draws.
- Changed, tests::host_step_rules. Its empty command, through the route, counts as
  nothing_to_probe.

Also in this landing (the lane's later commits):
- d2728b735e: the step's commands are one vector of reads or of corners (no per-command enum of 3.3 KB); clippy.
- 51afad9359: HostReplayedIndirectCommands' cost names the GPU route's second round trip (the notice's text changes).

RUNTIME 2325: an unchanged artifact's rate-mapped host step now decodes GPU-written records on the GPU, and the
notice's text changes. Negative controls (m3-max-30703): the plan.rs lifts reverted fail
a_merged_draw_s_variant_fans_out (NotImplemented(RasterizationRateMap)); the route turned off fails
rate_mapped_gpu_route's counts ([8, 0, 1, 3] against [0, 1, 1, 3]).
This commit is contained in:
Anees Iqbal committed 2026-11-14 17:40:26 -08:00
1 parent 7222b5cb82
commit f40cc8595b
14 files changed
+1155 -149

No files matched your search

+5 -1
View File
@@ -2710,7 +2710,11 @@ bound.
later one that shares a resource the execution may reach (one made resident, the records), and
the first command of a threadgroup size or threadgroup lengths its pipeline state has not dispatched makes
that VkPipeline then, as does a render command's draw of a state the CPU set on none of the
commands. The commands run in the large-buffer form (their range-limited buffer slots at device
commands. In a rate-mapped pass whose host step fans its triangles out, a render execution kept
from the GPU alone by the rate map alone has its records decoded on the GPU at the step, which
reads back each command's corners and none of its records, and its commands run in their merged
variant (`WorkCounts::rate_map_gpu_routes`): a second round trip, for the decode, comes before
the probe's. Other commands run in the large-buffer form (their range-limited buffer slots at device
addresses, with in-shader bounds checks), whose variants the commit compiles for every pipeline
state a record may name (for a render execution, every state the CPU set on its commands; or,
for an execution committed before a route that may write the records met the buffer, the call