Docs / Proofs

The trace-replay checker

Kernel.replay and its soundness, for every program (MojoProof/Sem/Replay.lean).

The checker

Kernel.replay prog fn L args m ch oracle fuel phases obs R, for a decidable R:

  1. Grid.start prog fn L args m ch oracle. If the start faults, the result is unknown.
  2. Replay.run L c fuel phases g. This is Grid.run (MojoProof/Sem/Grid.lean), except that a stop keeps what Grid.run drops (Replay.Stop):
    • fault g n fire e: the grid g and the thread n whose step (fire = false) or collective call (fire = true) is the fault e;
    • deadlock g: the grid after a phase that completed nothing with a thread not returned;
    • out msg: out of fuel or phases.
  3. Replay.found obs R. A fault .ub gives ub n msg. An .unsupported fault gives unknown, and so does out. A deadlock gives stuck. For a final grid g the checks run in order:
    • race? g.mem.trace: an access and the earlier access it races with gives race a e;
    • then broken? g.mem.trace: a frozen read (an !invariant.load that neither writes nor is an atomicrmw's) and an access that writes for the core's kept (a write or an atomicrmw's read) that touches its bytes give broken r w;
    • then obs g.mem: none gives post none, a y failing R gives post (some y), and a y satisfying R gives pass y.

Found.bad is true exactly for ub, race, broken, stuck and post.

Statements

For every launch L, contexts c, grid g, fuel, phases, observation obs and decidable R:

For every program, kernel, launch, arguments, memory, choice, oracle, fuel, phases and adm with adm ch oracle:

Proofs

Probes

The probes of an output from its cells' bytes (wrong outputs the checker must refuse: one cell omitted, no cell stored, two cells swapped, every cell zero, the input copied): Probe.drop k, Probe.stale, Probe.swap i j, Probe.zero w n and Probe.copy l t enc x n.

Scope

Every program, for the checker and its soundness. The instances in MojoProofTest/Replay.lean cover vector_addition only, on one launch (L23), memories mem5 and mem4, choice ch₀ and oracle ω₀:

Kernel evaluation of one replay of L23 takes about 3 s.

What a replay does not give: