Form B in detail

Batches

The renderer thread cuts the records into batches. A batch ends at a new pass and at a record that is not a draw, except constant buffer writes, which stay inside it in their order. Measured over 600 presents: 480,000 batches, 8.6 draws each, 88% of the draws in batches of 16 or more. A batch of fewer than 16 draws (12% of the draws) runs on the renderer thread, as today.

Workers and the order

The state each thread owns

Shared caches

43% of the draws are in batches with a miss of the draw table, the targets or the texture cache. So a worker must handle misses, not only hits. Each shared cache gets a rule:

  1. Reads on the hit path without a lock: entries that are written whole and published with a release store (a generation word last), and entries freed only when no batch of an older generation runs (epoch reclamation, as the frames in flight already keep descriptor sets and views alive).
  2. Misses under a lock of that cache. A miss that needs the GPU (an upload, a reload of a target, a decode) records its copy into the worker's list, before the draw, as the commands of an upload do today.
  3. A miss that needs a submit, a wait or a landing stops the batch. The renderer thread runs the rest of the batch.

The LRU lists and the statistics become per worker, merged at a present.

Batches that depend on others

19% of the draws are in batches that sample a target that an earlier batch of the present wrote. The command order of the replay keeps the GPU's order correct. The CPU's view must also be correct: a texture memo that checks a target's wgen, a copy of a target that a draw samples, the layout and the barriers.


Made from docs/dev/parallel-draw-batches.md at 69237645142c. GPL-3.0-or-later.