Files
aji/docs/plan/phase-5-atomics-and-memory-model.md
T
dev 11ce6cb38c plan: implementation plan with per-phase task breakdowns
- plan/README.md: sequencing principles, milestones M1-M5, phase table
  with exit criteria and blocking questions, dependency graph, error-code
  -> phase coverage, cross-cutting tracks, task conventions
- phase-0..phase-8 files: scope, invariants, task tables (P<N>-<k>) with
  dependencies, outputs and mechanical "done when" checks
2026-10-04 12:05:40 +03:00

2.7 KiB
Raw Blame History

Phase 5 — Atomics and memory model

Non-normative. Part of the implementation plan.

Goal: atomic types with all five orderings and fences, an interpreter that exhibits exactly the outcomes the memory model allows, systematic schedule exploration, and record/replay.

Exit criterion: the litmus suite (reference/concurrency-litmus.md) and atomic-publication conformance tests pass, including allowed weak outcomes.

Spec inputs: spec 04 §20–32, 11; reference/concurrency-litmus.md. RFC 0003 moves to Accepted.

Blocking questions: Q-015 operational weak-memory model, Q-017 replay format.

Invariants

  • no atomic operation without an explicit, valid ordering;
  • safe code never accesses atomic storage as ordinary storage;
  • DRF-SC holds for programs without ordinary-memory races;
  • the interpreter neither forbids allowed outcomes (SB r1=0,r2=0) nor produces forbidden ones (MP).

Tasks

ID Status Task Depends Output Done when
P5-1 todo Resolve Q-015, Q-017; RFC 0003 to Accepted — spec 04, 11 questions resolved
P5-2 todo Contract tables: atomic.load, atomic.store, atomic.rmw, atomic.cmpxchg, atomic.fence P5-1 spec 07 appendix all fields present, including allowed orderings per op
P5-3 todo Atomic types and ordering validation P5-2 src/verifier/atomics.zig E4201 accept/reject for every op, including cmpxchg failure order
P5-4 todo atomic / atomic.weak effect marking P5-3 verifier + report relaxed use without atomic.weak rejected per Q-011 outcome; weak sites listed in report
P5-5 todo Weak-memory model in the interpreter P5-1 src/interp/weak.zig SB weak outcome reachable; MP forbidden outcome unreachable
P5-6 todo Happens-before tracking and dynamic race detector (validates the verifier) P5-5 src/interp/ any race the verifier missed aborts the test run with a diagnostic
P5-7 todo Systematic schedule exploration with bounded budget P5-5 src/interp/sched.zig aji test --interleavings=N explores distinct schedules deterministically
P5-8 todo Record and replay P5-1 src/interp/replay.zig aji run --record / aji replay reproduce a failing concurrent run byte-for-byte
P5-9 todo Litmus suite runner P5-5 tests/litmus/, zig build litmus each litmus test states allowed and forbidden outcomes; all pass
P5-10 todo Phase exit review all plan status exit criterion passes

Conformance tests to add

Negative corpus entry owned by this phase: invalid atomic ordering. Litmus: MP, SB, mutex handoff, channel handoff, spawn/join, invalid ordinary race.