rfc: 0015 scalar atomics and the Aji memory model accepted (revision 2) and integrated into the spec

The Aji RC11 profile (RC11 with NO-THIN-AIR; stronger than ISO C11/C++20) as
normative axioms in spec 04 §20; DRF-SC; linear atomic<T> for AtomicScalar
with atomic.new/atomic.take; ref<atomic<T>> operands; ordering tables incl.
cmpxchg failure table and two results; effects [atomic] / [atomic, atomic.weak];
target atomic_widths and E4203; E4202; enumerator as oracle (observed ⊆ allowed,
exact equality on the normative litmus corpus). Feature atomics stays reserved
until P5-2a. Q-015 resolved; record/replay and Q-017 moved to Phase 8.
RFC 0003 superseded. AIR bundle +1.9 %.
This commit is contained in:
dev committed 2026-10-06 00:30:35 +03:00
1 parent 702d69b2c1
commit 2bbbd2135c
24 files changed
+927 -142

No files matched your search

+14 -13
View File
@@ -4,11 +4,11 @@ Non-normative. Part of the [implementation plan](README.md).
**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.
**Exit criterion:** every litmus test passes with exact equality between observed and allowed outcomes; atomic-publication conformance tests pass in AIR and `.aji`.
**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.
**Spec inputs:** spec 04 §20–§30, §42; spec 05 §13; spec 11; `reference/concurrency-litmus.md`. Decision record: [RFC 0015](../rfcs/0015-atomics-memory-model.md) (Accepted, revision 2; supersedes RFC 0003).
**Blocking questions:** Q-015 operational weak-memory model, Q-017 replay format.
**Blocking questions:** none. Q-015 was resolved by RFC 0015; Q-017 moved to Phase 8 with record/replay.
**Owner decision (2026-10-05, after the Phase 4 exit review).** Phase 5 starts with the RFC. Implementation is on hold until all three of these are done:
@@ -54,17 +54,18 @@ Phase 4 commit frozen (tag p4-frozen)
| ID | Status | Task | Depends | Output | Done when |
|---|---|---|---|---|---|
| P5-0 | todo | M/C regression on the frozen Phase 4 commit (tag `p4-frozen`): M, C × Aji/source × N1–N3, 6 cells, same agents, tasks, evaluators and procedure as P6A-9 | — | `docs/evaluation/results/` | see "Regression gate" below |
| P5-1 | todo | RFC 0015: scalar atomics and the Aji memory model (supersedes RFC 0003); closes the owner's question list; resolves Q-015; scope of Q-017 | — | `docs/rfcs/0015-…` | Accepted by the owner and integrated into spec 04, 05, 07a, 11, 15 |
| P5-1a | todo | Normative litmus corpus: the classes MP, SB, LB, release/acquire publication, `seq_cst` ordering (IRIW, SB with `seq_cst`), relaxed counter, CAS success/failure, fence publication, forbidden non-atomic race, atomic/non-atomic mixing, plus the handoffs (mutex, channel, spawn/join). Each test has allowed and forbidden outcome sets, and an independent enumerator of the RFC's axiomatic model reproduces every set | P5-1 | `reference/concurrency-litmus.md`, `tests/litmus/` | the enumerator agrees with every stated set; owner review |
| 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-1 | done | RFC 0015: scalar atomics and the Aji memory model (supersedes RFC 0003); closes the owner's question list; resolves Q-015; scope of Q-017 | — | `docs/rfcs/0015-…` | Accepted by the owner and integrated into spec 04, 05, 07a, 11, 15 |
| P5-1a | todo | Litmus enumerator `tools/litmus` (an executable oracle derived from spec 04 §20, not the definition) and the normative corpus: the classes MP, SB, LB, release/acquire publication, `seq_cst` ordering (IRIW, SB with `seq_cst`), relaxed counter, CAS success/failure, fence publication, forbidden non-atomic race, atomic/non-atomic mixing, plus the handoffs (mutex, channel, spawn/join). Each test has allowed and forbidden outcome sets | P5-1 | `tools/litmus/`, `reference/concurrency-litmus.md`, `tests/litmus/` | the enumerator's allowed set equals every stated set, disagreements diagnosed (spec 04 §20.5); owner review |
| P5-2 | done | Contract tables: `atomic.new`, `atomic.take`, `atomic.load`, `atomic.store`, RMW, `atomic.cmpxchg`, `atomic.fence` | P5-1 | spec 04 §42, spec 07a | all spec 07 §4 fields present, with the ordering tables of spec 04 §24 (integrated with RFC 0015) |
| P5-2a | todo | Publish feature `atomics` (depends on `effects`, `ownership`) | P5-3 | `reference/air-features.md`, `src/air/features.zig` | feature_not_declared / missing_dependency tests |
| P5-3 | todo | AIR parse/print, types (linear `atomic<T>`, AtomicScalar, not IslandSafe), ordering tables, `E4202` | P5-1a | `src/air/`, `src/verifier/` | `E4201` accept/reject for every operation and every cmpxchg success/failure pair; `E4202`; `E1001`, `E2111`, `E0006` cases |
| P5-4 | todo | `atomic` / `atomic.weak` effects (spec 05 §13); weak sites in `aji report` | P5-3 | verifier + report | each non-`seq_cst` ordering without `atomic.weak` is `E3101`; `seq_cst` needs only `atomic`; weak sites listed |
| P5-5 | todo | Interpreter: atomic cells with message histories, views, weak reads drawn from the schedule stream; atomic operations are scheduling points | P5-3 | `src/interp/` | sound on the corpus and the differential test; no extra draw without weak accesses; existing records unchanged |
| 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-7 | todo | Exhaustive bounded exploration of schedules and weak-read choices | P5-5 | `src/interp/` | for each litmus test, the outcome set observed equals the oracle's allowed set exactly |
| P5-8 | dropped | Record and replay: moved to Phase 8 (P8-10) by RFC 0015 D13 | — | — | — |
| P5-9 | todo | Litmus runner and differential test (random small programs; interpreter outcomes ⊆ oracle outcomes) | P5-7 | `tests/litmus/`, `zig build litmus` | all corpus tests pass with exact equality; differential test in CI |
| P5-9a | todo | `.aji` layer 10 (spec 15 §12), Quick Reference subsection after mutexes, source coverage rows, bundle measurement | P5-4 | `src/frontend/`, `docs/agent/` | `.aji` run/reject tests for every row; Quick Reference excerpts checked; growth recorded against RFC 0015's estimate |
| P5-10 | todo | Phase exit review | all | plan status | exit criterion passes |
## Regression gate (P5-0)
+1
View File
@@ -20,4 +20,5 @@ Non-normative. Part of the [implementation plan](README.md).
| P8-6 | todo | Packages: dependencies, lockfile, content addressing, sandboxed declared build extensions | — | spec 12, `src/pkg/` | dependency resolution is deterministic; unsafe dependencies reported separately |
| P8-7 | todo | Integrate `ajid` with the evaluation scaffold (E0-3) so Aji runs use the agent protocol | P8-2, E0-3 | scaffold adapter | scaffold drives Aji through `ajid`; protocol §28 records complete |
| P8-8 | todo | External agent trial on a reference task | P8-2…P8-5 | trial report in `docs/plan/` | exit criterion passes |
| P8-10 | todo | Record and replay (moved from P5-8 by RFC 0015): `aji run --record` / `aji replay`; the replay format (Q-017) records scheduler choices, reads-from choices, modification orders and the SC order | P8-1 | `src/interp/replay.zig`, spec 11 §4 | a failing concurrent run, weak-memory runs included, is reproduced byte for byte from its file |
| P8-9 | todo | Phase exit review; Aji 0.1 release-candidate checklist | all | plan status | all phases done; spec status updated |