P5-1a: independent axiomatic oracle and the litmus corpus (20 tests agree)
tools/litmus/enumerate.py was written by an independent author from spec 04 §20 alone, with the programs blind (outcome sets removed). check.py compares its allowed sets with tests/litmus/*.lit: 20/20 equal. 21 self-tests derived from the axioms. Both run in CI. The author's spec findings are Q-024.
This commit is contained in:
1 parent
cfee89ff19
commit
f8d2a99249
28 files changed
+1278
-5
No files matched your search
@@ -26,6 +26,7 @@ Status values: `open`, `resolved`.
|
||||
| Q-018 | resolved | P2 | Runtime diagnostics (traps) vs verifier diagnostics |
|
||||
| Q-019 | resolved | P3 | Non-terminating programs in test tooling |
|
||||
| Q-020 | resolved | P2 | Size bound for SSA array values |
|
||||
| Q-024 | open | P5 | Memory-model clarifications found by the independent oracle |
|
||||
|
||||
## Q-001 — Text AIR grammar
|
||||
|
||||
@@ -170,3 +171,16 @@ A byte string lowers to one `local.zero`, then a borrow, index, store and end pe
|
||||
## Q-023 — `ref` of a whole array passed to a `ref<[T; N]>` parameter
|
||||
|
||||
In `.aji` a borrow of a whole array written as an argument (`f(ref a)`, `a: [u64; 4]`) is always lowered as a slice (`slice<u64>`), so a function declared with a parameter `ref<[u64; 4]>` cannot be called with `ref a` (`E7005`). Spec 15 §5 says that binding a borrow of a whole array (`ref r = a;`) gives a slice. It does not say what an argument borrow gives, so the frontend's choice is not specified. Options: the argument borrow follows the parameter type (array borrow for `ref<[T; N]>`, slice for `slice<T>`), which is a small amount of inference from a known signature; or keep slices only and state it in spec 15. Found while writing the interpreter memory test; not urgent.
|
||||
|
||||
## Q-024 — Memory-model clarifications found by the independent oracle
|
||||
|
||||
The independent author of `tools/litmus/enumerate.py` (P5-1a) worked from spec 04 §20 only. It reported five points the text leaves implicit. For each, the author chose the RC11 reading, and all 20 corpus tests agree with the stated sets under it. Proposed clarifying text for spec 04 §20, for owner approval:
|
||||
|
||||
1. **RMW events (§20.1–§20.2).** An RMW consists of a read event and a write event of the same location, related by `rmw`, with the read immediately `sb`-before the write. Both carry the RMW's ordering. A failed compare-exchange is a single read with the failure ordering and is not in `rmw`.
|
||||
2. **Initial writes (§20.1).** The initializing write of a cell is non-atomic (it starts no `sw`), first in `mo`, and `hb`-before every event of every task that can reach the cell.
|
||||
3. **Primitive orders (§20.3).** "A total order consistent with `hb`" means that no `hb` edge between two operations of one object points backwards in that order.
|
||||
4. **Channels (§20.3).** A channel's messages are received in send order (FIFO), and each message is received at most once. Capacity is not yet modelled. For a bounded channel, a later RFC must say whether a receive that frees a slot synchronizes with the send that was waiting for it. The litmus format has no capacity.
|
||||
5. **Release sequence (§20.2).** `rs = [W] ; (rf ; rmw)*` is deliberately the C++20 form, without RC11's same-thread later stores. Spec 04 §20.2 says "C++20" in the comment; no change is needed beyond keeping it explicit.
|
||||
|
||||
Points 1–3 and 5 are editorial. Point 4 fixes FIFO, which spec 04 §38 already implies for the interpreter, but leaves capacity synchronization open.
|
||||
|
||||
@@ -55,7 +55,7 @@ Phase 4 commit frozen (tag p4-frozen)
|
||||
|---|---|---|---|---|---|
|
||||
| P5-0 | done (gate: owner verdict pending) | 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/2026-10-06-p5-0.md`](../evaluation/results/2026-10-06-p5-0.md) | see "Regression gate" below; 6/6 PASS; R3 found frontend defect A (`ref` through `mut`), fixed with a regression test |
|
||||
| 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-1a | done (owner review pending) | 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 |
|
||||
|
||||
@@ -4,7 +4,7 @@ Litmus tests for the memory model of spec 04 §20–§30 (RFC 0015). They are se
|
||||
|
||||
The tests do not define the model; spec 04 §20 does. They are its consequences, and the normative conformance corpus for the interpreter (spec 04 §20.5).
|
||||
|
||||
**Status:** draft corpus. The sets below were derived by hand from the axioms. P5-1a makes the corpus normative: every set is confirmed with the enumerator, the test files go into `tests/litmus/`, and the owner reviews the result. When the enumerator, the interpreter and a stated set disagree, the cause is diagnosed (spec 04 §20.5). A set is never edited to match a tool without a diagnosis.
|
||||
**Status:** confirmed by the independent oracle (P5-1a, 2026-10-06): the oracle's allowed set equals the stated set for all 20 tests (`python3 tools/litmus/check.py`). It becomes normative on the owner's review. Earlier status: draft corpus. The sets below were derived by hand from the axioms. The test files are `tests/litmus/*.lit` (format: `tests/litmus/README.md`), where every allowed set is written out in full. P5-1a makes the corpus normative: `tools/litmus/check.py` confirms every set against the independent oracle `tools/litmus/enumerate.py`, and the owner reviews the result. When the enumerator, the interpreter and a stated set disagree, the cause is diagnosed (spec 04 §20.5). A set is never edited to match a tool without a diagnosis.
|
||||
|
||||
## Rules
|
||||
|
||||
@@ -36,7 +36,7 @@ The tests do not define the model; spec 04 §20 does. They are its consequences,
|
||||
| SB sc | all `sc` | (0,1) (1,0) (1,1) | (0,0) |
|
||||
| SB fences | `rlx` accesses, `fence sc` between store and load on both sides | (0,1) (1,0) (1,1) | (0,0) |
|
||||
| LB rlx | `r0=x; y=1` ‖ `r1=y; x=1`, all `rlx` | (0,0) (0,1) (1,0) | (1,1), a consequence of NO-THIN-AIR |
|
||||
| IRIW acq | `x=1 rel` ‖ `y=1 rel` ‖ `r0=x acq; r1=y acq` ‖ `r2=y acq; r3=x acq` | includes (1,0,1,0) | — |
|
||||
| IRIW acq | `x=1 rel` ‖ `y=1 rel` ‖ `r0=x acq; r1=y acq` ‖ `r2=y acq; r3=x acq` | all 16 tuples, including (1,0,1,0) | — |
|
||||
| IRIW sc | all `sc` | every tuple except (1,0,1,0) | (1,0,1,0) |
|
||||
| CoRR | `x=1 rlx` ‖ `r0=x rlx; r1=x rlx` | (0,0) (0,1) (1,1) | (1,0) |
|
||||
| CoWW | `x=1 rlx; x=2 rlx`, final `x` | 2 | 1 |
|
||||
@@ -46,8 +46,8 @@ The tests do not define the model; spec 04 §20 does. They are its consequences,
|
||||
| CAS failure relaxed | as above with `cas.acq.rlx` | (0,0) (0,1) (1,0) (1,1) | — |
|
||||
| release sequence | `d=1 rlx; f=1 rel` ‖ `add.wrap(f,2) rlx` ‖ `r0=f acq; r1=d rlx` | (0,0) (0,1) (1,1) (2,0) (2,1) (3,1) | (1,0) (3,0) |
|
||||
| channel handoff | `x=1 rlx; send(t)` ‖ `recv; r0=x rlx` | (1) | (0) |
|
||||
| mutex handoff | `lock; x=1 rlx; unlock` ‖ `lock; r0=x rlx; unlock`, in that lock order | (1) | (0) |
|
||||
| spawn/join | `x=1 rlx`; spawn ‖ child: `r0=x rlx; x=2 rlx`; after join `r1=x rlx` | (1,2) | (0,·) (·,1) |
|
||||
| mutex handoff | `lock; x=1 rlx; f=1 rlx; unlock` ‖ `lock; r0=f rlx; r1=x rlx; unlock` | (0,0) (1,1) | (1,0) (0,1) |
|
||||
| spawn/join | `x=1 rlx`; spawn ‖ child: `r0=x rlx; x=2 rlx`; after join `r1=x rlx` | (1,2) | (0,2) (1,1) |
|
||||
|
||||
## Rejected programs
|
||||
|
||||
|
||||
Reference in new issue
Block a user