Files
metal2vulkan/crates
Anees Iqbal ed9b745d20 RUNTIME 2238: an ICB's per-command pipeline states in a dense table, and one hold a pipeline set
An indirect command buffer's CPU setters cost ~290 ns a command in the runtime alone on lavapipe
(the consumer's icb_slots_cost at pin 72: 16384 render commands of 5 fields; a Mac does ~5 ns),
the largest frames CallHold's drop, the setters' edit, and a BTreeMap<u32, CommandState> insert per
command. Two cuts:
- The per-command state is a dense table: a u32 a command indexing a small table of distinct
  CommandStates, each counted by the commands that name it (set_states.rs); a set checks the last
  state it set, then a map. A recovery's carry walks the distinct states. An entry goes when its
  count reaches 0, so nothing is held past what the map held.
- A render or compute pipeline set took 4 CallHolds (the setter's, program(),
  can_encode_indirect_commands(), indirect_command_writes()), 8 mutex takes; it now takes one, and
  a set of a state the table already names reads no program at all.
Also: icb_encode_bench gains a full render slot (pipeline + 2 vertex + fragment + draw) and a
compute slot (pipeline + 2 kernel buffers + dispatch) a command.

Verified (icbset, msi lavapipe release, one A/B job m3-max-26475, binaries alternated, two passes,
host load ~20 so passes drift; median ns a command at 16384 commands): full render slot base
232.7/291.6 -> dense 215.7/253.9 -> + one hold 135.2/185.8 (-42%/-36%); compute slot 212.0/263.4 ->
196.8/217.6 -> 116.6/151.5 (-45%/-42%). ICB, released-program, write-route, recovery and kept tests
on lavapipe running (26484) at the branch tip. The batched setter (set_each) and the unlocked
action/pipeline setters follow after the ICB reset's dirty flags land.

RUNTIME_VERSION 2237 -> 2238.
2026-11-13 13:03:06 -08:00
..