Skip to content

Support bounded rule loops and restore ordered array scans - #284

Merged
zhoubot merged 1 commit into
mainfrom
codex/static-rule-loops
Oct 10, 2026
Merged

zhoubot merged 1 commit into
mainfrom
codex/static-rule-loops

Conversation

@zhoubot

@zhoubot zhoubot commented Oct 10, 2026

Copy link
Copy Markdown
Contributor

Pure behavioral rules could not express ordered prefix computations without manually expanding each step. This change implements bounded ordinary for name in range(INTEGER_LITERAL) through the existing Python capture and MLIR lowering flow and restores the original array_scans example. No decorator, Table scan method, IR opcode or alternate compiler route is added.

Loop lowering preserves logical Integer induction, existing typed assignment boundaries, final binder values and zero-trip behavior. It rejects unsupported effects and syntax before expansion, prepays source-wide resources, retains iteration/call provenance and rolls back failed staging. Unchanged branch values reuse the existing SSA only after declaration/binding validation. The example retains all four ordered scalar/aggregate scans, complete prefix snapshots and the two original depth-one queues.

Deep-record validation exposed redundant C++ default member initializers. Direct nominal Struct fields now rely on their initialized leaves; scalar, Enum and Table initialization, layout and aggregate construction are preserved. For the same depth-32 final IR and compiler, one measured generated-C++ syntax check fell from 154.77 s to 0.41 s. This is a single workload measurement, not a general scaling claim.

Validation:

  • Source interface/ledger/rollback native suite: 73/73.
  • Existing API gate: 22/22; installed source-system execution: 43/43.
  • Existing local binding, four-state binding, branch, default, scalar-helper and multi-writer regressions: 6/6.
  • array_scans: 1,031 Work samples agree across native workers 1/2 and Verilator; 495 accepted tokens, 492 retired and three reset drops. Closed system: 16 cycles / 32 sampling epochs, both backends. Both standalone CTests pass.
  • Complete source-import and transformed IR for DUT/bench retained and byte-matched to published units; both backend outputs consume the same verified final artifact.
  • Public bounded-loop gate: native workers 1/2 and Icarus six known/X/Z rows, Verilator three known rows; depth-32 native/Verilator both outcomes and default/value/partial/explicit aggregate initialization; 43 rejection cases with publication protection; generated outside-loop assertion failure.
  • Python unit/quickstart suite: 578 passed, 5 skipped. Strict docs, changed-file pre-commit and whitespace checks passed.

The catalog now contains 69 examples / 25 API cases and 66 / 13 systems. These are inventory counts, not full-catalog acceptance. The three remaining historical roots (multirate_compute, nested_config_types, parameterized_types) require capabilities/policy that cannot be truthfully replaced by fixed fixtures; their exact original requirements are recorded in #272.

The extra depth-32 Icarus known-value scaling probe exceeded its 600-second resource limit and was stopped after 707 seconds; its simulation was not run. It is not counted as passing. Required main Icarus X/Z coverage and depth-32 native/Verilator outcomes remain in the semantic gate. Exact evidence and reproduction are tracked in #265. Full nightly and cross-platform native release acceptance were not run.

Candidate-bound commands, hashes, independent reviews, results and performance records remain local ignored artifacts under docs/gates/logs/array-scans-20261009/ and docs/gates/logs/array-scans-final-20261010/; no tests depend on those logs.

Independent code review: APPROVE, all 36 files bound to reviewed content; architecture: CLEAR. Final local candidate: 21255887baf2e1141f9ec3c3c85812f0ae423c50. The native producer test checks exact input-derived AST sites, ordered iteration/call frames, outside-loop origin restoration and active malformed-frame rejection.

@zhoubot
zhoubot requested a review from xiekunpeng as a code owner October 10, 2026 00:18
@zhoubot
zhoubot merged commit 9a5d5b4 into main Oct 10, 2026
2 checks passed
@zhoubot
zhoubot deleted the codex/static-rule-loops branch October 10, 2026 00:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant