Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .claude/board/INTEGRATION_PLANS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 2026-10-23 — d-mpf-math-polyfill-v1 — the mathematical polyfill API, Stage 1 → `.claude/plans/d-mpf-math-polyfill-v1.md`

**Status:** D-MPF-1 MEASURED, lab only; D-MPF-2.. PROPOSED. The Stage 1 polyfill API is the shipped R2IL procedure layer plus checked scalar arithmetic over mask-risc, with relalg as the rewriting frontend; no new primitive. One expression matches an independent row loop; at 64 K rows it costs under 1 ns/row, at one word ~600 ns per call. Gaps by counterexample: element-wise arithmetic, unsigned compare, floats, one-word fixed cost. Independent of ONNX and of the S0 drafts. Entry `2026-10-23-d-mpf-1-polyfill-probe.md`.
## 2026-10-23 — d-onnx-relalg-cap-capstone-1750-v1 — ONNX intake onto existing lance-graph surfaces (capstone S0, #1750) → `.claude/plans/d-onnx-relalg-cap-capstone-1750-v1.md`

**Status:** PROPOSAL, S0 docs only; nothing implemented. The pipeline "ONNX graph → RelAlg polyfill → Cartesian projection → native execution" is false as stated: relalg is a single-table integer selection with Count/Sum/Min/Max/Keep, so it receives only the integer selection/aggregate island; numeric ops route to existing ndarray kernels; Gather/Scatter, control flow and `ai.onnx.ml` are typed refusals. The ONNX `ModelProto` stays the only graph (D-RA-2 = A; no new AST, primitive or executor). The original DR64³ master plan was not found on `main` or 833 branches and is recorded as an OPEN documentation dependency. S1 is blocked on the operator naming one target model and the protobuf fork coordinates. Entry `2026-10-23-d-onnx-relalg-cap-s0-capstone-1750.md`. #1744's S0 (below) kept the base path; the native-first correction (#1753) governs where they differ.
Expand Down
12 changes: 12 additions & 0 deletions .claude/board/STATUS_BOARD.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
## D-MPF — mathematical polyfill API, Stage 1 (2026-10-23)

Lab only (`crates/math-polyfill-probe`). Plan `.claude/plans/d-mpf-math-polyfill-v1.md`; entry `entries/2026-10-23-d-mpf-1-polyfill-probe.md`.

| D-id | scope | status | gate / falsifier |
|---|---|---|---|
| **D-MPF-1** | one expression (SUM − k·COUNT, NULL plane) through the existing r2il procedures; oracle; typed refusals; cost split | MEASURED (this branch) | equal to an `i128` row loop at 64..65 537 rows; D1–D3 red; 0.86–0.91 ns/row at 64 K, ~600 ns per call at 64 rows |
| **D-MPF-2** | attribute the one-word fixed cost (~120 ns mask-risc + ~150 ns dialect) | Measured (#1752) | gate not met, reason recorded: floor alone 39 ns at one word; per-row bottleneck is `masked_sum_i32`'s bit walk (plan §7) |
| **D-MPF-3** | element-wise integer arithmetic (G1) | Blocked (owner decision) | `lane_plus_lane_is_refused` turns into an admitted, oracle-checked op |
| **D-MPF-2b** | dense/sparse hybrid masked sum (per-word density threshold) and one mask reused across count/sum/min/max | Measured (#1752) | hybrid th=16 is 2–3.7× (uniform) and 4–5× (clustered) faster than the walk, and never slower; reuse ~2× when sparse; a fused scalar pass is 6× faster at 50 % (plan §9) |
| **D-MPF-4** | R2IL as a router: attribution of the five things named R2IL, a routing table (DIRECT / COMPOSE / LOWER / REFUSE), and a ClassId → LazyLock → prebound-callable probe against direct ndarray | Measured (#1752) | prebound route == direct ndarray at 64..65 536 rows; one resolution per ClassId, 0 route evaluations and 0 allocations in steady state; frame/focus/scope guard 27–28 ns (4 atomic RMWs); three disable runs red (plan §10) |

## D-ONNX-CAP — ONNX intake onto existing lance-graph surfaces (2026-10-23)

PROPOSAL, docs only. Plan `.claude/plans/d-onnx-relalg-cap-capstone-1750-v1.md`; entry `entries/2026-10-23-d-onnx-relalg-cap-s0-capstone-1750.md` (#1750; #1744's S0 below kept the base path). ONNX `ModelProto` stays the only graph; relalg receives only the integer selection/aggregate island; no new primitive, AST or executor.
Expand Down
12 changes: 12 additions & 0 deletions .claude/board/entries/2026-10-23-d-mpf-1-polyfill-probe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# 2026-10-23 — E-D-MPF-1: the Stage 1 polyfill already exists; per row it is sub-nanosecond, per one-word call it is ~600 ns

**Status:** MEASURED, lab only (`crates/math-polyfill-probe`). Plan `.claude/plans/d-mpf-math-polyfill-v1.md`.

- The mathematical polyfill API is the shipped R2IL procedure layer (`lance-graph-r2il::procs`) plus checked scalar arithmetic in `FoldDialect`, over mask-risc, with relalg as the rewriting frontend. No new primitive, IR or executor.
- One expression, `SUM(v | sel) − k·COUNT(sel)` with a NULL presence plane, written only with those procedures, equals an independent `i128` row loop at 64 / 1 000 / 4 096 / 65 537 rows. 9 tests; disable runs D1–D3 each turn named tests red.
- Typed refusals already exist for lane + lane arithmetic, unsigned compare, overflow and division by zero.
- Cost (ns per call, medians, 3 runs): at 65 536 rows the expression costs 0.86–0.91 ns/row and beats the scalar loop 1.6×; at 64 rows one fold is ~120 ns in mask-risc plus ~150 ns in the dialect, and the scalar loop (~80 ns) beats the whole expression (~600 ns).
- Gaps by counterexample: G1 element-wise value arithmetic, G2 unsigned compare, G3 floats, G4 the one-word fixed cost.
- The ONNX fork `AdaWorldAPI/optimum-onnx-rs` is empty; `AdaWorldAPI/onnx` is not accessible.

Next gate: D-MPF-2 (attribute the one-word fixed cost), and the owner decision on G1.
11 changes: 11 additions & 0 deletions .claude/board/entries/2026-10-23-d-mpf-2-fixed-cost.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# 2026-10-23 — D-MPF-2: where the native fold's cost goes

**Status:** MEASURED, lab only (`crates/math-polyfill-probe`, PR #1752). Nothing changed outside the probe.

- Per call at 64 rows: scalar 12 ns; ndarray floor 39; mask-risc +57; `Program::new` +20 and 1 allocation; dialect +50. Total ~172 ns.
- Per row at 64 K rows: mask-risc ≈ ndarray floor. The floor's cost is `ndarray::simd::masked_sum_i32`, a scalar set-bit walk (LLVM: `tzcnt`/`blsr`, no vector register) whose time tracks popcount: 1.7 / 25 / 44 µs at 0 / 50 / 100 % selected. The compare is ~0.09 ns/row.
- Correction to D-MPF-1: "1.6× faster than the scalar loop" compared against the `i128` filter-chain oracle. An equal-work `i64` loop takes ~11 µs at 64 K rows and is ~3× faster than the fold.
- Proposal, not made: density-chosen `masked_sum_i32` body (branch-free above ~16 set bits per word, walk below). The branch-free form equals the oracle and is flat in selectivity; the walk is 7–10× faster on empty words.
- OPEN: whether the mask form beats a scalar loop when the mask is reused or combined (not measured here).

Plan: `.claude/plans/d-mpf-math-polyfill-v1.md` §7.
18 changes: 18 additions & 0 deletions .claude/board/entries/2026-10-23-d-mpf-4-classid-route.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# 2026-10-23 — D-MPF-4: R2IL routes once per ClassId; the steady-state cost is the guard, not the route

**Status:** MEASURED, lab (`crates/math-polyfill-probe/examples/classid_route.rs`). Plan `.claude/plans/d-mpf-math-polyfill-v1.md` §10. No production crate, ABI or execution contract changed.

- **Attribution:** five different things are called R2IL, and they stay apart:
- r2sleigh's `r2il`: IL types, no executor.
- the machine reading: `r2conc` / `r2sym`, scalar machine state.
- `ogar-r2il`: the opcode table, readings `0xC400` machine / `0xC401` fold.
- `lance-graph-r2il::FoldDialect`: the fold reading only.
- mask-risc / `ndarray::simd` / `simd_runtime`.

The 94–99 ns and 171–172 ns of D-MPF-2 are the cost of choosing the mask-risc and FoldDialect paths per call. They are not a cost of R2IL routing.
- **Recovered 2–5 ns figures:** each is a direct kernel, not an R2IL call. The one cited as a comparison is `ndarray::simd` AND, AND, popcount over 4 words at 2.2–2.8 ns, against 54–70 ns through r2il + mask-risc (`2026-10-21-d-rft-1-cost-breakdown.md`).
- **Routing table:** every wired fold-reading op has a DIRECT or COMPOSE route onto existing `ndarray::simd` entrypoints, or is refused. Only machine semantics need R2Sleigh: carry/borrow flags, address-space load/store, branches, width-exact integers.
- **Measured** (64 rows / 65 536 rows): prebound route without guard 36–39 / ≈ direct ndarray. Guard (`FrameStore::check` + focus + scope) 27–28 ns, 0 allocations; objdump shows 2× `lock cmpxchg` + 2× `lock decq` from `Arc::downgrade`. Per-call `LazyLock` + `match` adds 0–1 ns. Prepared R2IL (FoldDialect's `last_program` as a `CompiledProgram`) = prepared mask-risc, 85–94 ns.
- **Asserted:** one resolution per ClassId; 0 route evaluations in steady state; LOWER/REFUSE refused at bind; focus, scope and source changes refused at run; rebinding does not re-resolve. Three disable runs red.
- **Proposal (not made, DR lab owner):** compare `Weak::as_ptr` with `Arc::as_ptr` instead of `Weak::ptr_eq(.., &Arc::downgrade(..))`. Same identity semantics, no atomics. Unmeasured.
- OPEN: the program-only half of mask-risc's per-call `precheck`/`validate`; mask-sharing callables for multi-op bindings; the U64 unsigned-compare refusal (`lt_u64_to_mask` exists).
5 changes: 4 additions & 1 deletion .claude/board/entries/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ index row, (3) no duplicate entry id. Checks 1 and 2 are deliberately
opposite directions; the stranding this convention prevents shows up in
exactly one of them, never both.

455 entries, 2026-08-06 .. 2026-10-23.
458 entries, 2026-08-06 .. 2026-10-23.

| date | entry id | finding | file |
|---|---|---|---|
Expand All @@ -39,6 +39,9 @@ exactly one of them, never both.
| 2026-10-23 | `D-TGA-5` | | [2026-10-23-d-tga-5-squash-gate-preregistration.md](2026-10-23-d-tga-5-squash-gate-preregistration.md) |
| 2026-10-23 | `D-ONNX-RELALG-CAP` | S0 result: ONNX as import membrane, DR64³ plan not found | [2026-10-23-d-onnx-relalg-cap-s0.md](2026-10-23-d-onnx-relalg-cap-s0.md) |
| 2026-10-23 | `E-D-ONNX-RELALG-CAP-S0-1` | | [2026-10-23-d-onnx-relalg-cap-s0-capstone-1750.md](2026-10-23-d-onnx-relalg-cap-s0-capstone-1750.md) |
| 2026-10-23 | `D-MPF-4` | | [2026-10-23-d-mpf-4-classid-route.md](2026-10-23-d-mpf-4-classid-route.md) |
| 2026-10-23 | `D-MPF-2` | | [2026-10-23-d-mpf-2-fixed-cost.md](2026-10-23-d-mpf-2-fixed-cost.md) |
| 2026-10-23 | `E-D-MPF-1` | | [2026-10-23-d-mpf-1-polyfill-probe.md](2026-10-23-d-mpf-1-polyfill-probe.md) |
| 2026-10-23 | `coresearch-thought-git-markov` | | [2026-10-23-coresearch-thought-git-markov.md](2026-10-23-coresearch-thought-git-markov.md) |
| 2026-10-23 | `coresearch-thought-git-markov-cc2` | | [2026-10-23-coresearch-thought-git-markov-cc2.md](2026-10-23-coresearch-thought-git-markov-cc2.md) |
| 2026-10-23 | `coresearch-julia-egraphs` | | [2026-10-23-coresearch-julia-egraphs.md](2026-10-23-coresearch-julia-egraphs.md) |
Expand Down
Loading
Loading