Files
metal2vulkan/docs
Anees Iqbal 9e698176bc Record what Metal does with a wait whose signal is already running
What: a conformance case, event-wait-behind-a-running-signal, in the event_orders family, with
two rows, one for MTLEvent and one for MTLSharedEvent. Queue A's command buffer runs 192 fills
of 256 MiB into a private buffer, then signals a companion shared event at 1, then the event
under test at 1. Queue B's command buffer waits for the event at 1, then fills 256 shared bytes.
A is committed, then B. RUNNING_WINDOW (20 ms) later the case reads B's status and handlers,
the shared event's value, A's status, and last the companion. A companion still at 0 proves the
signal had not landed by any of those reads, since one command buffer's signals land in order.
A run whose companion reads 1 records only that fact, so it differs from an answer rather than
passing as one. B's Scheduled status is the proxy for "submitted, and so checked"; the case's
docs say so.

Why: reims's platform sets a submission check on every command buffer, and the runtime holds a
checked head until each value it waits for has landed. checks.rs justified that with "Metal
submits the submission, and checks it, once the signal happened", which nothing had measured.
event-cross-queue-wait reads a waiter only while its signaller is not yet committed, and
event-held-command-buffer only while only the host can raise the event.

Metal's answer, recorded on the M3 Max (macOS 27.0.1): 5 of 5 runs identical, and the
validated leg ran.
- MTLEvent: B reads Scheduled with its scheduled handler run while A still reads Scheduled and
  the companion reads 0. Metal submits it at once, with the wait on the GPU.
- MTLSharedEvent: B reads Committed with no handler run, signaledValue 0, A Scheduled. Metal
  holds it until the signal lands.

The fills measured 156 to 163 ms of GPU time on the M3 Max (a throwaway Metal probe,
GPUEndTime less GPUStartTime, three runs), so the read falls about eight windows before the
signal.

Our side replays divergent on the M3 (MoltenVK) on the plain row: B still reads Committed at
20 ms. A's vkQueueSubmit takes 10 to 27 ms there, in MoltenVK's encoding of our fills by
transfers. A later commit reduces that.

(cherry picked from commit 2efae5489b87b0c37603d1c5e7b51a5222a49414)
2026-11-03 16:16:40 -08:00
..