diff --git a/docs/plan/README.md b/docs/plan/README.md index b622df3..dc66b90 100644 --- a/docs/plan/README.md +++ b/docs/plan/README.md @@ -156,5 +156,5 @@ Targets for Phase 6A, measured on dev tasks: | P3 | done (exit review in the phase file); P3-10, P3-11 moved to P7 | | P6A | done (exit review in `phase-6-source-language.md`; P6A-9 [results](../evaluation/results/2026-10-05-p6a-9.md)): the agent-facing source language over AIR is the architecture | | P4 | done (exit review in the phase file) | -| P5 | unpaused after P6A (owner decision, 2026-10-05); starts after the owner decision on the P4 exit review | +| P5 | started with the RFC (owner decision, 2026-10-05): implementation on hold until the RFC is accepted, the M/C regression on `p4-frozen` passes and the litmus corpus is ready | | P7, P8 | not started | diff --git a/docs/plan/phase-5-atomics-and-memory-model.md b/docs/plan/phase-5-atomics-and-memory-model.md index 5758184..0675b5d 100644 --- a/docs/plan/phase-5-atomics-and-memory-model.md +++ b/docs/plan/phase-5-atomics-and-memory-model.md @@ -10,6 +10,38 @@ Non-normative. Part of the [implementation plan](README.md). **Blocking questions:** Q-015 operational weak-memory model, Q-017 replay format. +**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: + +1. the RFC is reviewed and accepted; +2. the M/C regression on the frozen Phase 4 commit passes (P5-0); +3. the normative litmus corpus is ready (P5-1a). + +```text +Phase 4 commit frozen (tag p4-frozen) + ├── private M/C regression (P5-0) + └── RFC (P5-1) → review / Accepted → litmus corpus (P5-1a) → implementation (P5-2 …) +``` + +- **Scope.** Scalar atomics and memory ordering only. Hazard pointers, epoch reclamation, RCU, lock-free collections and atomic `iref`s or references are left to a later RFC. Q-023 is not touched before Phase 5. +- **No atomics agent benchmark before the RFC.** Without a normative model there is no correct result to measure. The litmus corpus comes first. Each litmus test states its set of allowed outcomes and its set of forbidden outcomes, not a single expected result. +- **Model statement.** The Phase 3 sentence "a native execution equals some interleaving of the deterministic scheduler" is not enough for relaxed atomics. Phase 5 replaces it with three layers: + - ordinary safe memory: DRF-SC; + - atomic memory: the Aji atomic memory model; + - unsafe code: its own proof obligations. +- **Questions the RFC must close before it can be accepted:** + - `sequenced-before`, `synchronizes-with` and `happens-before`; + - data race, and the DRF-SC guarantee; + - the five orderings, and which are allowed for load, store, RMW and CAS; + - `compare_exchange` success and failure orderings; + - fences; + - mixing atomic and non-atomic access; + - whether `atomic.weak` is a separate effect; + - which atomic types the format guarantees and which depend on the target; + - what counts as observable behavior of the deterministic interpreter; + - how the deterministic interleaving model relates to weak memory; + - what a native backend must preserve; + - the safe/unsafe boundary for atomic pointers and reclamation. + ## Invariants - no atomic operation without an explicit, valid ordering; @@ -21,7 +53,9 @@ Non-normative. Part of the [implementation plan](README.md). | 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-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 | @@ -33,6 +67,23 @@ Non-normative. Part of the [implementation plan](README.md). | 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 | +## Regression gate (P5-0) + +These criteria were fixed before the runs. M and C are a regression corpus only. They decide no semantic question, and the language is not tuned to them. + +- **Baseline.** The P6A-9 Aji/source cells (tag `p6a-candidate`): M 3/3, C 2/3. N3 on C wrote no program. +- **Hard gates.** A failure of any of these blocks Phase 5 code: + - R1: all four Aji references (M and C × Aji/AIR and Aji/source) still pass their frozen evaluators on `p4-frozen`; + - R2: no FAIL is classified `toolchain_bug = yes` or `evaluator_integration_bug = yes`; + - R3: the source cells show no IR-form code (`E0001`–`E0006`, `E5001`, `E5002`), no `E7900` and no `E1001`. +- **Checked and explained, but not gates on their own:** + - R4: a diagnostic code not seen in the P6A-9 source cells (`E7001`, `E7005`, `E7006`, `E7007`); + - R5: a cell that passed in P6A-9 and fails now; + - R6: the source/AIR ratio of the agents' programs (`mechanical_air_eliminated_raw`, 0.82–0.88 in P6A-9). + + Each of these is classified: toolchain, evaluator, or model. Only a toolchain or language cause is a regression. +- **Reported only.** One run per cell is noise for these: output tokens, uncached input, tool calls, repair cycles, documentation read (the Quick Reference grew by about 640 tokens with §7 Graphs). + ## 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.