Files
aji/docs/plan/phase-5-atomics-and-memory-model.md
T
dev 19dff5dd52 air: feature negotiation for AIR format 0 (DD-014)
- reference/air-features.md: normative feature registry (arrays,
  atomics, capabilities, channels, effects, islands, ownership, regions,
  sync, tasks; all reserved), dependency closures, reasons for E0006
- spec 07 §8.1/§8.5/§8.7: features are mandatory, validated before the
  body, full dependency closure declared, sorted canonically; every
  extension belongs to a feature; published feature semantics immutable
- spec 05 §8: features vs effects vs capabilities
- src/air/features.zig: registry, validation, sync test with the docs
- parser validates features first; E0006 carries `reason`
- `aji features` prints supported AIR format, language and features
- conformance: unknown, reserved and duplicate feature tests
- plan: feature publication tasks in phases 1-5
2026-10-04 12:49:29 +03:00

2.9 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 is proposed for acceptance (owner decision); acceptance integrates it into the spec.

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; propose RFC 0003 for acceptance — 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-2a todo Publish feature atomics P5-2 reference/air-features.md, src/air/features.zig feature_not_declared / missing_dependency tests
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.