Skip to content

Metal SharedEvent all-work signals do not serialize short untracked command buffers #909

Description

@lukstafi

The standalone probe landed by staging#641 (gh-ocannl-828, benchmarks/runners/ocannl/metal_queue_probe.ml) reproduces Metal_backend's kernel/signal/wait+kernel/signal sequence and observes the two command buffers overlapping fully through the ~1.2 s scheduling transition it measured. That contradicts the runtime comment in arrayjit/lib/metal_backend.ml claiming the sequence serializes back-to-back routines.

Why it matters: repeated routines reuse untracked buffer pools, so if consecutive runs of one routine can overlap on the device, the second run may read or write a buffer the first is still using — a silent same-buffer race, not a timing artifact. The gh-828 worker flagged it as outside that issue's timing scope and did not investigate further.

What a fix touches: audit where the all-work signal is placed relative to the encoder's commit (metal_backend.ml, the stream/event machinery), and add an EXECUTED test whose consecutive runs produce distinguishable values when they overlap (a run that writes its own serial number into a cell the next run reads back before writing), so the invariant is checked rather than commented. test/operations/lifecycle-family placement per AGENTS.md.

Filed by the wave coordinator (2026-09-04 fleet wave) from the staging#641 worker's hand-back.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions