RUNTIME 2263: an execution's compute commands order by their records' barriers alone, in either kind of encoder

Metal's reference for MTLIndirectComputeCommand concurrentDispatchThreadgroups (and
concurrentDispatchThreads): "Compute commands encoded into an indirect command buffer don't
automatically serialize access to resources with other commands in the indirect command buffer.
Use barriers to serialize access to resources within a range of commands." and "If dispatchType
is serial, the compute command encoder adds a barrier before and after the range of commands. If
dispatchType is concurrent, then the compute command encoder does nothing". MSL 6.17.2: "In an
ICB, dispatches are always concurrent." The runtime ordered a serial encoder's execution as the
encoder's own dispatches: a barrier wherever their uses met (the host step and commit's
recording) or between every two commands (the GPU form).

Now a command runs after the earlier ones of its range only where its record sets a barrier, in
either kind of encoder; the segment's barriers from everything before and to everything after it
are the serial encoder's before and after the range (Execute loses `ordered`; ComputeKey loses
`ordered`, so a kept chunk runs in either kind of encoder; the GPU form puts a barrier between
two commands only where a route may set one in the records, CommandWrites::BARRIER; the
tracker's ordered_everything goes). docs/API.md's accepted difference quotes Metal's text. Not a
speed-for-accuracy choice (Metal's contract), so no FAST-PATHS row.

Also: kept_commands' compute tests note each command's own output window as an apart write
(the layer reported write-after-write between disjoint windows); trail_gpu_forms requires a GPU
form's scratch in device-local memory only without unified memory (a Private buffer lies in
system memory before the carve-out by design on the 780M), fixing the 780M lane failure.

From steelbrain/icbbarrier (b3f5e50f94, 7c5e5e60b2, fdfc1e412a; icbinherit). Verified on potluck
at fdfc1e412a: lavapipe 275/278 (28026; the 3 failures were lvpfails-owned and fixed by RUNTIME
2261 on development), clippy plain/m2v_gpu/m2v_cpu_icd and rustdoc 0 (28027), negative control
27962 (both new tests fail on the old runtime). XTX and 780M legs: not run (um790 down), owed at
the next pin's device legs.
This commit is contained in:
Anees Iqbal committed 2026-11-13 23:41:05 -08:00
1 parent 799e3dcd0a
commit 1f20452b37
12 files changed
+220 -110

No files matched your search

+14 -4
View File
@@ -5129,10 +5129,20 @@ each item named states the rule in full.
(`CommandBuffer::add_executed_commands_handler`, no Metal counterpart): a handler is called each
time the runtime reads an execution's records, at `commit`, in a host step, or not at all for an
execution the GPU alone runs.
- **An execution the GPU alone runs orders its commands one after another in a serial encoder**,
where Metal orders them only where their uses meet: the uses are the records', which the GPU
writes. In a concurrent encoder its commands run together where no route that wrote the records
may set a barrier (`IndirectCommandBuffer::command_writes`), and one after another otherwise.
- **An execution's commands order by their records' barriers alone, in either kind of
encoder**, as Metal states for `MTLIndirectComputeCommand`'s `concurrentDispatchThreadgroups`:
"Compute commands encoded into an indirect command buffer don't automatically serialize access
to resources with other commands in the indirect command buffer. Use barriers to serialize
access to resources within a range of commands. See setBarrier()." and "When you execute the
commands in an indirect command buffer, the dispatchType property of the compute command encoder
determines whether the compute command encoder adds additional barriers. If dispatchType is
serial, the compute command encoder adds a barrier before and after the range of commands. If
dispatchType is concurrent, then the compute command encoder does nothing, and you are
responsible for synchronizing access to resources." The runtime runs a command after the earlier
ones of the range where its record sets a barrier, and adds a barrier before and after the range
in either kind of encoder. Where the GPU alone runs the execution and a route that wrote the
records may set a barrier (`IndirectCommandBuffer::command_writes`), every command runs after the
one before it.
- **Render commands the GPU may write run on the GPU alone** where the commit can tell from what
the records may hold (`IndirectCommandBuffer::command_writes`) that every command is a draw of one
primitive type under the encoder's pipeline state, which the buffer inherits, and whose vertex