spec: single normative source, accept RFC 0004, freeze AIR format 0, fuel
Owner decisions after the Phase 0 review: - precedence: docs/spec/ is the single normative source; RFCs are decision records whose accepted rules are integrated into the spec in the same change (AGENTS.md, docs/README.md, rfcs/README.md, DD-011) - RFC 0004 Accepted (scope: AIR format 0, language 0.1) - AIR format 0 frozen as the semantic baseline; spec 07 §8.7 defines the only permitted additive changes, everything else needs `air 1` (DD-012) - Q-019 resolved: deterministic instruction fuel (spec 11 §7). Outcome `limit_exceeded` is a runner outcome, not a trap; `aji run --fuel N`, exit code 5; conformance runs always use fuel (default 1 000 000, `fuel:` header); fuel/schedule budget/quantum kept separate for P3 (DD-013)
This commit is contained in:
1 parent
dc36b5cfc0
commit
03dda1245a
24 files changed
+268
-63
No files matched your search
@@ -61,3 +61,41 @@ aji test --interleavings=10000
|
||||
## 6. Deterministic selection
|
||||
|
||||
When `select` has multiple ready branches, deterministic mode must choose according to a stable rule and record the decision.
|
||||
|
||||
## 7. Execution limits
|
||||
|
||||
Wall-clock time MUST NOT determine whether a run, test or verification terminates or what its outcome is.
|
||||
|
||||
### 7.1 Fuel
|
||||
|
||||
A runner MAY bound execution with **fuel**: the number of AIR instructions executed.
|
||||
|
||||
- Every instruction consumes one unit of fuel when it begins execution, including terminators, `assert` and `call`.
|
||||
- The instructions executed inside a callee consume fuel separately; a `call` costs one unit regardless of the callee.
|
||||
- If no fuel remains when an instruction is about to begin, execution stops before that instruction and the run ends with the outcome `limit_exceeded` (spec 07a "Run result"), reporting `limit` and `steps` (the number of instructions executed, equal to `limit`).
|
||||
|
||||
Fuel exhaustion is a decision of the execution environment, not behavior of the program:
|
||||
|
||||
- it is not a trap and has no `T` code;
|
||||
- a program's semantics are the same with or without a fuel limit, except that a limited run may end early with `limit_exceeded`;
|
||||
- for a given module, inputs and fuel limit, the outcome is deterministic.
|
||||
|
||||
The three run outcomes are therefore:
|
||||
|
||||
```text
|
||||
returned the program finished
|
||||
trapped the program failed (T0xxx)
|
||||
limit_exceeded the environment stopped the program
|
||||
```
|
||||
|
||||
Running without a fuel limit is permitted (for example `aji run program.air`). Conformance, fuzz and stress runs MUST use a fuel limit.
|
||||
|
||||
### 7.2 Concurrent execution (from Phase 3)
|
||||
|
||||
With several tasks, fuel is global: the sum of instructions executed by all tasks. Two further, separate budgets apply to scheduling and MUST NOT be conflated with fuel:
|
||||
|
||||
| Budget | Bounds |
|
||||
|---|---|
|
||||
| fuel | how long the program may execute |
|
||||
| schedule budget | how many interleavings schedule exploration examines |
|
||||
| quantum | how many instructions a task executes before a forced scheduling point |
|
||||
Reference in new issue
Block a user