Files
metal2vulkan/docs
Anees Iqbal f6692d84e5 Keep an ICB execution's chunks where its check can see nothing among its commands
Before, any execution given a check (execute_commands_in_buffer_checked) recorded every command at
every commit and kept no chunk, even when the check's needs ruled out everything the buffer's
records may hold. In that case commit never calls the check: RenderExecution::check_sees and
Execute::check_sees answer from the needs and IndirectCommandBuffer::command_writes. A consumer
that hands every execution of own-state commands a check for draws of points, and draws
triangles, never had its unchanged commands run from kept recordings.

Now RenderExecution::keeping declines where `self.check_sees_now()` holds, and Execute::keeping
where `self.check_sees()` holds. The decision is the structural one commit makes for the check,
the check's needs against what the records may hold. When a later write makes the records hold
something the check looks for, it forgets the chunks it reaches. At the next execution
check_sees is true, so keeping declines and the execution records inline, calling the check with
every command.

Docs: the "Which executions" lists in render/executions/kept.rs and indirect_execute/kept.rs, and
docs/FAST-PATHS.md's kept-recordings row.

Tests (runtime_lane::kept_commands), counting records read, chunks and commands kept and
contexts made (WorkCounts::indirect_chunks_kept and kept_contexts_made show the kept path ran),
and the commands the check was called with:
- a_checked_execution_keeps_where_its_check_sees_nothing (render). With needs for states that
  may encode indirect commands, which the inherited state can't, the check sees nothing:
  [N, 0, 0, 0], then [N, 0, 0, 3], then [0, 3, N, 0], and the check is called 0 times. With
  needs for draws of points, which the records hold, the check sees: [N, 0, 0, 0] three times,
  and the check is called with all 3N commands.
- a_checked_compute_execution_keeps_where_its_check_sees_nothing: a compute execution checked for
  every kind. Its records hold no draw and no state that may encode, so it keeps as above, and
  the check is called 0 times. No fixture kernel encodes indirect commands, so compute has no
  "check sees" leg.

Verified on the M3 Max, debug (--cfg m2v_gpu), on lane 7583fe5d99 with the first-execution ruling
cherry-picked beneath it:
- nextest -j 8 over every runtime_lane module that executes an indirect command buffer: 39
  modules, 473 tests, all pass.
- Negative control: keep only with no check at all (the condition before). Both new tests fail
  at "the second records three chunks to keep" ([600, 0, 0, 0] where [600, 0, 0, 3] is expected).
- Negative control: keep whatever the check (render). The render test fails at "a check that sees
  keeps nothing" ([0, 3, 600, 0] where [600, 0, 0, 0] is expected).
- fmt --check, clippy -D warnings (runtime and validation, all targets and features, m2v_gpu),
  metal2vulkan tests::fast_paths 19/19.

Needs a RUNTIME_VERSION bump. No SEMANTICS_VERSION: no translated module changes.

(cherry picked from commit d75cb04ac8ed9d4616b10aa13d26af869a32d405)
(cherry picked from commit efafed587dd062f7d87bd9c9868ccb035e9ddc26)
2026-11-03 13:34:03 -08:00
..