Files
metal2vulkan/crates/metal2vulkan-runtime/examples
Anees Iqbal 3cd05059be RUNTIME 2423: Compute encoders set aside one bind state per pipeline state lately dispatched, as render encoders do
A compute encoder kept one bind state, its last dispatch's: a dispatch of
another pipeline state than the one before read its table whole, found its
shape again and instantiated its commands again, though its own state's
previous dispatch had planned and instantiated the same. A guest's compute
workloads switch kernel at every dispatch, about one dispatch a compute
encoder (walk counts: 356,723 dispatches, 369,091 instantiations, 226 as
before, planned as before 90%).

LiveDispatch now sets aside the states of up to live_bind::SET_ASIDE (7)
pipeline states dispatched before its last dispatch's, each with its shape,
listing count, ReadFrom, DispatchMemo and Instantiated, under the pipeline
state that left it (held weakly); a dispatch starts from its own state's.
They travel as the state does: parked in the command buffer for its next
compute encoder, given to the device's spares at the commit, every memo let
go there and its sampler states unlisted where the state's are.
live_bind::start_from is the rule both encoders' select share (render's
select now calls it; same choices).

Exact as a draw's: whichever state a dispatch starts from, every field is
brought in place from the encoder's table at that dispatch; kept commands
only while no value kind their plan reads moved since that state's last
dispatch; a memo entry only where every input it compares holds.

WorkCounts: dispatches_from_set_aside, and its split set_aside_commands_kept
/ set_aside_commands_instantiated. Test: tests/compute_set_aside.rs (three
states in turn, an encoder each, within and across command buffers; a
moving output instantiates again; changing setBytes keeps its commands with
the right words; the entry's bytes bounded).

Also 260b91e6b8: dispatch_chain: --states K, dispatch n of a command buffer of the host's time sets state n % K

A program whose dispatches each run a kernel of their own sets another
compute pipeline state for each: --states K makes K states of the
kernel, one creation each from the same function, and dispatch n of a
command buffer sets state n % K (with --host). The HOST line names K.
Bench only; compiled in the dispcall lane's first build job.

Verified in the lane at 1d48a48e1a: msi m3-max-35257 clippy -p metal2vulkan-runtime --all-targets
--all-features -D warnings 0; lavapipe (m2v_cpu_icd, debug) compute, carried, draw_again, live_bind and
compute_set_aside 97/97 (three states in turn, one encoder a dispatch: CB1 instantiated 3, from
set-aside 9, kept 9; CB2 instantiated 0, from set-aside 12, kept 12; words checked; offsets moving
instantiate again 9; setBytes changes keep commands with the new words); api_signatures re-blessed
(+3 WorkCounts fields); release dispatch_chain build m3-max-35261. Still running when landed: the
negative control, PHOENIX compute suites, the PHOENIX bench before/after, clippy m2v_gpu and
m2v_cpu_icd, rustdoc.

New Degradation kinds: none.
2026-11-15 22:23:11 -08:00
..