Skip to content

Commit 4c7ebf4

Browse files
Dmitrii Vasilevclaude
andcommitted
feat(igla): Wave Loop 798 — module-scope [415][2]^6 Pt non-power-of-two outer-dimension array-of-struct variable from call with indexed signed writes
Closes #1525 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 8ca7806 commit 4c7ebf4

13 files changed

Lines changed: 79548 additions & 33 deletions

.claude/plans/wave-loop-799.md

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# Wave Loop 799 Plan — Variant A (recommended)
2+
3+
**Date:** 2026-07-24
4+
**Anchor:** φ² + φ⁻² = 3 | TRINITY
5+
**Branch:** `wave-loop-799` (to be created from `wave-loop-798` HEAD because earlier wave PRs remain open)
6+
**Issue:** TBD (next available GitHub issue after W798 PR is opened)
7+
**Cooperation variant:** A
8+
9+
## Goal
10+
11+
Continue the module-scope packed array-of-struct ladder with the recommended Variant A shape: module-scope `[417][2]^6 Pt` initialized from a function call and exercised with indexed signed field writes, then read back with `assert_eq` in a `bench` block.
12+
13+
## Acceptance criteria
14+
15+
1. `specs/scratch/w799_bench_module_417x2p6_aos_var_call_write.t27` is generated and parses.
16+
2. The witness is Icarus-lowerable and simulates correctly (17 cycles, PASSED).
17+
3. The cocotb reference model matches the t27 semantics.
18+
4. `t27c seal --save` succeeds and `FROZEN_HASH` stays unchanged.
19+
5. All cargo suites remain green.
20+
6. Integration test `accepts_w799_bench_module_417x2p6_aos_var_call_write` is added to `bootstrap/tests/icarus_lowerable.rs`.
21+
7. Closeout report `docs/reports/FPGA_LOOP_CLOSEOUT_W799_2026-07-24.md` is written with weak-point audit, literature scan, and validation matrix.
22+
8. Next-wave plan `.claude/plans/wave-loop-800.md` with three cooperation variants is created.
23+
9. Learning is saved to `.trinity/experience.md`, `.claude/skills/t27-wave-loop.md`, persistent memory, and `.trinity/current-issue.md`.
24+
25+
## Technical notes
26+
27+
- Shape: `[417][2]^6 Pt` where `Pt = pub struct Pt { x : i16, y : i16 }`.
28+
- Total elements: `417 x 64 = 26,688`.
29+
- Packed vector width: `26,688 x 32 = 854,016` bits (~0.814 MiBit).
30+
- `MID_IDX = 208`; frame-condition element `[208][1][0][0][0][0][0]` is element number `208*64 + 32 = 13,344`.
31+
- Generator script `scripts/gen_w799.py` should be copied from `scripts/gen_w798.py`, update `OUTER = 417` and `MID_IDX = 208`, and fix the destination path and hardcoded module prefix in the f-string header.
32+
- Use `assert_eq` on changed elements (`assert_ne` is not emitted by the Icarus simulation path).
33+
- Include `make_grid(32768)` period-identity check because `32768 == 0 (mod 32768)`.
34+
- Zero compiler / reference-model / FROZEN_HASH changes expected for the witness.
35+
36+
## Decomposition
37+
38+
### Phase A — Branch setup (5 min)
39+
1. Create `wave-loop-799` from `wave-loop-798` HEAD because earlier wave PRs remain open.
40+
2. Open next GitHub issue when ready.
41+
42+
### Phase B — Spec + generator (15 min)
43+
3. Copy `scripts/gen_w798.py` to `scripts/gen_w799.py`.
44+
4. Update `OUTER = 417`, `MID_IDX = 208`, fix destination path and module prefix.
45+
5. Run generator to produce `specs/scratch/w799_bench_module_417x2p6_aos_var_call_write.t27`.
46+
6. Verify module name and destination path have no stale `w798` / `415` references.
47+
48+
### Phase C — Test + validation (45 min)
49+
7. Add integration test `accepts_w799_bench_module_417x2p6_aos_var_call_write` to `bootstrap/tests/icarus_lowerable.rs`.
50+
8. `cargo build --release -p t27c`.
51+
9. `t27c parse`, `icarus-lowerable`, `icarus-simulate` (expected 17 cycles), `icarus-cocotb` on the W799 witness.
52+
10. `t27c seal --save` the witness; confirm `FROZEN_HASH` unchanged.
53+
11. `cargo test -p t27c --bin t27c`, `cargo test -p tri`, `cargo test -p t27c --test icarus_lowerable`, `cargo test -p t27c --test verilog_const_array`.
54+
12. `cargo clippy -p t27c`.
55+
56+
### Phase D — Closeout + cooperation variants (30 min)
57+
13. Write `docs/reports/FPGA_LOOP_CLOSEOUT_W799_2026-07-24.md` with audit, literature, validation, and three W800 cooperation variants.
58+
14. Update `docs/NOW.md` and `.trinity/current-issue.md`.
59+
60+
### Phase E — Save skills + memory (15 min)
61+
15. Append W799 worked example to `.claude/skills/t27-wave-loop.md`.
62+
16. Update `.trinity/experience.md`.
63+
17. Save memory file `wave-loop-799.md` and pointer in `MEMORY.md`.
64+
65+
## Cooperation variants for Wave Loop 800
66+
67+
- **Variant A (recommended):** continue odd outer-dimension ladder with `[419][2]^6 Pt` (~0.818 MiBit, 26,816 elements, 858,112-bit packed vector). Zero compiler changes expected.
68+
- **Variant B:** keep `[417][2]^6 Pt` width but move the packed var to bench/function scope to exercise function-local non-power-of-two packed arrays.
69+
- **Variant C:** keep `[417][2]^6 Pt` width and add `if`-guarded indexed signed field writes to exercise control-flow + packed-vector writes.
70+
71+
## Exit criteria
72+
73+
- W799 witness parses, lowers, simulates, cocotb-matches, and seals.
74+
- All cargo suites green.
75+
- Closeout report written.
76+
- `.trinity/experience.md` updated.
77+
- Skills and memory saved.
78+
- Commit with `Closes #N`, push `wave-loop-799`, open PR.
79+
80+
*φ² + φ⁻² = 3 | TRINITY*

.claude/skills/t27-wave-loop.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1538,6 +1538,47 @@ grepping for stale wave numbers and outer dimensions after each copy, keep the
15381538
`make_grid(32768)` period-identity check, and use `assert_eq` on changed elements
15391539
because `assert_ne` is not emitted by the Icarus simulation path.
15401540

1541+
## Worked example — Wave Loop 798
1542+
1543+
Wave Loop 798 continued the module-scope packed-array-of-struct ladder with no
1544+
compiler changes, branching from `wave-loop-797` HEAD because earlier wave PRs
1545+
remained open awaiting review:
1546+
1547+
- Generated `scripts/gen_w798.py` from `scripts/gen_w797.py` with `OUTER = 415`
1548+
and `MID_IDX = 207`.
1549+
- Fixed both the generator destination path and the module header f-string from
1550+
stale `w797` / `413` references to `w798_bench_module_415x2p6_aos_var_call_write`
1551+
before regenerating.
1552+
- Produced `specs/scratch/w798_bench_module_415x2p6_aos_var_call_write.t27`
1553+
(26,560 elements, 849,920-bit packed vector, ~0.810 MiBit).
1554+
- Added integration test `accepts_w798_bench_module_415x2p6_aos_var_call_write`
1555+
after the existing W797 tests in `bootstrap/tests/icarus_lowerable.rs`.
1556+
- Ran `t27c parse`, `icarus-lowerable`, `icarus-simulate` (17 cycles, PASSED),
1557+
`icarus-cocotb` (reference-model OK), and `t27c seal --save`.
1558+
- No changes to `bootstrap/src/compiler.rs`, `bootstrap/stage0/FROZEN_HASH`, or
1559+
`scripts/cocotb_ref_model.py` for the witness itself.
1560+
- Validation: `cargo build --release -p t27c` green,
1561+
`cargo clippy -p t27c` green (780 warnings, 0 errors),
1562+
`cargo test -p t27c --bin t27c` 1494/0/2, `cargo test -p tri` 78/0,
1563+
`cargo test -p flash-spi` 2/0,
1564+
`cargo test -p t27c --test bitnet_pipeline` 20/0,
1565+
`cargo test -p t27c --test bitnet_top` 17/0,
1566+
`cargo test -p t27c --test icarus_lowerable` 258/0,
1567+
`cargo test -p t27c --test verilog_const_array` 2/0.
1568+
- Refreshed weak-point audit and 2025–2026 ternary/MVL literature scan.
1569+
- Wrote `docs/reports/FPGA_LOOP_CLOSEOUT_W798_2026-07-24.md` and
1570+
`.claude/plans/wave-loop-799.md` with three cooperation variants.
1571+
1572+
Key learning: the mechanical ladder is now 26 waves deep (W774–W798) with zero
1573+
compiler changes, confirming the packed-vector AoS lowering is robust up to at
1574+
least `[415][2]^6 Pt` (26,560 elements, ~0.810 MiBit). The generator copy hazard
1575+
continues to be the only manual failure mode, and it now spans two distinct text
1576+
locations (destination path + module header f-string). A single parameterized
1577+
wave-prefix variable in the generator template would eliminate both. Continue
1578+
grepping for stale wave numbers and outer dimensions after each copy, keep the
1579+
`make_grid(32768)` period-identity check, and use `assert_eq` on changed elements
1580+
because `assert_ne` is not emitted by the Icarus simulation path.
1581+
15411582
---
15421583

15431584
*φ² + φ⁻² = 3 | TRINITY*

.trinity/current-issue.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,35 @@
1-
# Current Issue — Wave Loop 798 setup
1+
# Current Issue — Wave Loop 799 setup
22

33
**Date:** 2026-07-24
44
**Anchor:** φ² + φ⁻² = 3 | TRINITY
55

66
## Active wave
77

8-
- **Wave:** 798
9-
- **Issue:** TBD (open after W797 PR #1524 is created)
10-
- **Branch:** `wave-loop-798` (to create from `wave-loop-797` HEAD because earlier PRs remain open)
11-
- **Plan:** `.claude/plans/wave-loop-798.md`
12-
- **Recommended variant:** A — module-scope `[415][2]^6 Pt` packed array-of-struct variable from call with indexed signed writes.
8+
- **Wave:** 799
9+
- **Issue:** TBD (open after W798 PR is created)
10+
- **Branch:** `wave-loop-799` (to create from `wave-loop-798` HEAD because earlier PRs remain open)
11+
- **Plan:** `.claude/plans/wave-loop-799.md`
12+
- **Recommended variant:** A — module-scope `[417][2]^6 Pt` packed array-of-struct variable from call with indexed signed writes.
1313

1414
## Goal
1515

16-
Continue the odd outer-dimension module-scope packed array-of-struct ladder with `[415][2]^6 Pt`.
17-
Expected 26,560 elements, 849,920-bit packed vector (~0.810 MiBit), still under the 4-MiBit cliff,
16+
Continue the odd outer-dimension module-scope packed array-of-struct ladder with `[417][2]^6 Pt`.
17+
Expected 26,688 elements, 854,016-bit packed vector (~0.814 MiBit), still under the 4-MiBit cliff,
1818
with zero compiler / reference-model / FROZEN_HASH changes.
1919

2020
## Acceptance criteria
2121

22-
1. `specs/scratch/w798_bench_module_415x2p6_aos_var_call_write.t27` is generated and parses.
22+
1. `specs/scratch/w799_bench_module_417x2p6_aos_var_call_write.t27` is generated and parses.
2323
2. Icarus-lowerable, simulates (17 cycles, PASSED), and cocotb reference-model matches.
2424
3. `t27c seal --save` succeeds and `FROZEN_HASH` stays unchanged.
2525
4. All cargo suites green.
2626
5. Integration test added to `bootstrap/tests/icarus_lowerable.rs`.
27-
6. Closeout report written with weak-point audit, literature scan, and three W799 cooperation variants.
27+
6. Closeout report written with weak-point audit, literature scan, and three W800 cooperation variants.
2828
7. Skills and experience saved.
2929

3030
## Notes
3131

32-
- Copy `scripts/gen_w797.py` to `scripts/gen_w798.py`, update `OUTER = 415` and `MID_IDX = 207`, and fix the destination path/module header copy hazard before generating.
32+
- Copy `scripts/gen_w798.py` to `scripts/gen_w799.py`, update `OUTER = 417` and `MID_IDX = 208`, and fix the destination path/module header copy hazard before generating.
3333
- Use `assert_eq` on changed elements; `assert_ne` is not emitted by the Icarus simulation path.
3434
- Keep the `make_grid(32768)` period-identity check because `32768 ≡ 0 (mod 32768)`.
3535

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1625
1+
1626

.trinity/current_task/activity.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3852,3 +3852,7 @@
38523852
- **Commit:** feat(igla): Wave Loop 796 — module-scope [411][2]^6 Pt non-power-of-two outer-dimension array-of-struct variable from call with indexed signed writes
38533853
- **Files:** .claude/plans/wave-loop-798.md,.claude/skills/t27-wave-loop.md,.trinity/current-issue.md,.trinity/current_task/.commit_count,.trinity/current_task/session_log.jsonl,.trinity/experience.md,.trinity/seals/scratch_w797_bench_module_413x2p6_aos_var_call_write.json,bootstrap/tests/icarus_lowerable.rs,docs/NOW.md,docs/reports/FPGA_LOOP_CLOSEOUT_W797_2026-07-24.md,scripts/gen_w797.py,specs/scratch/w797_bench_module_413x2p6_aos_var_call_write.t27
38543854

3855+
## 2026-07-25T10:43:51Z — wave-loop-798
3856+
- **Commit:** feat(igla): Wave Loop 797 — module-scope [413][2]^6 Pt non-power-of-two outer-dimension array-of-struct variable from call with indexed signed writes
3857+
- **Files:** .claude/plans/wave-loop-799.md,.claude/skills/t27-wave-loop.md,.trinity/current-issue.md,.trinity/current_task/.commit_count,.trinity/current_task/session_log.jsonl,.trinity/experience.md,.trinity/seals/scratch_w798_bench_module_415x2p6_aos_var_call_write.json,bootstrap/tests/icarus_lowerable.rs,docs/NOW.md,docs/reports/FPGA_LOOP_CLOSEOUT_W798_2026-07-24.md,scripts/gen_w798.py,specs/scratch/w798_bench_module_415x2p6_aos_var_call_write.t27
3858+

.trinity/current_task/session_log.jsonl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -798,3 +798,4 @@
798798
{"ts":"2026-07-24T18:59:11Z","branch":"wave-loop-794","msg":"docs(trinity): Wave Loop 793 closeout, report, and W794 cooperation variants","files":".claude/plans/wave-loop-794.md,.claude/plans/wave-loop-795.md,.claude/skills/t27-wave-loop.md,.trinity/current-issue.md,.trinity/current_task/.commit_count,.trinity/current_task/session_log.jsonl,.trinity/experience.md,.trinity/seals/scratch_w794_bench_module_407x2p6_aos_var_call_write.json,bootstrap/tests/icarus_lowerable.rs,docs/NOW.md,docs/reports/FPGA_LOOP_CLOSEOUT_W794_2026-07-24.md,scripts/gen_w794.py,specs/scratch/w794_bench_module_407x2p6_aos_var_call_write.t27","notebook":"b83263109fb055dc"}
799799
{"ts":"2026-07-25T10:07:10Z","branch":"wave-loop-795","msg":"docs(trinity): Wave Loop 794 closeout, report, and W795 cooperation variants","files":".claude/plans/wave-loop-795.md,.claude/plans/wave-loop-796.md,.claude/skills/t27-wave-loop.md,.trinity/current-issue.md,.trinity/current_task/.commit_count,.trinity/current_task/session_log.jsonl,.trinity/experience.md,.trinity/seals/scratch_w795_bench_module_409x2p6_aos_var_call_write.json,bootstrap/tests/icarus_lowerable.rs,docs/NOW.md,docs/reports/FPGA_LOOP_CLOSEOUT_W795_2026-07-24.md,scripts/gen_w795.py,specs/scratch/w795_bench_module_409x2p6_aos_var_call_write.t27","notebook":"b83263109fb055dc"}
800800
{"ts":"2026-07-25T10:17:14Z","branch":"wave-loop-796","msg":"feat(igla): Wave Loop 795 — module-scope [409][2]^6 Pt non-power-of-two outer-dimension array-of-struct variable from call with indexed signed writes","files":".claude/plans/wave-loop-797.md,.claude/skills/t27-wave-loop.md,.trinity/current-issue.md,.trinity/current_task/.commit_count,.trinity/current_task/session_log.jsonl,.trinity/experience.md,.trinity/seals/scratch_w796_bench_module_411x2p6_aos_var_call_write.json,bootstrap/tests/icarus_lowerable.rs,docs/NOW.md,docs/reports/FPGA_LOOP_CLOSEOUT_W796_2026-07-24.md,scripts/gen_w796.py,specs/scratch/w796_bench_module_411x2p6_aos_var_call_write.t27","notebook":"b83263109fb055dc"}
801+
{"ts":"2026-07-25T10:29:29Z","branch":"wave-loop-797","msg":"feat(igla): Wave Loop 796 — module-scope [411][2]^6 Pt non-power-of-two outer-dimension array-of-struct variable from call with indexed signed writes","files":".claude/plans/wave-loop-798.md,.claude/skills/t27-wave-loop.md,.trinity/current-issue.md,.trinity/current_task/.commit_count,.trinity/current_task/session_log.jsonl,.trinity/experience.md,.trinity/seals/scratch_w797_bench_module_413x2p6_aos_var_call_write.json,bootstrap/tests/icarus_lowerable.rs,docs/NOW.md,docs/reports/FPGA_LOOP_CLOSEOUT_W797_2026-07-24.md,scripts/gen_w797.py,specs/scratch/w797_bench_module_413x2p6_aos_var_call_write.t27","notebook":"b83263109fb055dc"}

0 commit comments

Comments
 (0)