Skip to content

D-DRISA-3 (lab): threshold, Kleene and Bag on the shipped carry words (stacked on #1955) - #1956

Merged
AdaWorldAPI merged 6 commits into
mainfrom
ccr-85acaff0-oszq40-drisa-3
Nov 4, 2026
Merged

AdaWorldAPI merged 6 commits into
mainfrom
ccr-85acaff0-oszq40-drisa-3

Conversation

@AdaWorldAPI

Copy link
Copy Markdown
Owner

Stacked on #1955 (its base is the D-DRISA-1 branch). Merge #1955 first, then retarget this PR to main. Like #1955, it is a lab and board change only: no production code, no new ndarray word, no public type, and no import of U24x5 or Abacus. Please don't merge automatically. It is stage 3 of EXO-153 and follows P3-5 (#1954).

What was tested

src/alu.rs uses only ndarray::simd::{half_add_mask, full_add_mask, U8x64}. Each input is a DR-aligned mask plane, with a presence plane for absent rows. Every shape is checked per row against a scalar oracle:

  • k-of-n (450 cells): n ∈ {1, 2, 4, 5, 16, 24}, k ∈ {0, 1, ⌈n/2⌉, n, n+1}. Inputs: zero, full, alternating, one-hot and random. Row counts: 100, 4,096 and 65,573 (tails included). The carry arm and a U8x64 byte-counter arm both match the oracle on every row.
  • Kleene k-of-n: TRUE when the TRUE count reaches k; FALSE when even TRUE + UNKNOWN does not; UNKNOWN otherwise. The fixture produces over 1,000 UNKNOWN results, and none is turned into FALSE early.
  • Bag: per-row sums of 2-bit multiplicities. Over the same inputs, the Bag result and the support count disagree on at least 4 of the 8 k values tested.
  • Boundaries, all exact: k=1 is OR, k=n is AND, k=0 is exactly the present rows, and k>n is empty. A dirty presence tail never leaks into a result. 3-of-5 equals its 10-term Boolean expansion.

All 19 tests in the crate pass. Seven disable runs, all red: the comparator, presence, Kleene overlap, Bag weight, carry column, and tail. The tail guard only carries weight once the dirty-presence test exists. Before that test was added, presence alone zeroed the tail.

Result

The carry words are an exact vocabulary for all three shapes, and slower than native words in every shape, in ns per 64 rows:

instruction carry words native slower by
2-of-2 vs AND 6.9 1.5 4.8×
3-of-5 vs Boolean SOP 12.7 3.8 3.3–3.4×
3-of-5 vs U8x64 12.7 5.7–5.8 2.2×
8-of-16 vs U8x64 40 13.8 2.9×
12-of-24 vs U8x64 56 20 2.8×
Kleene 4-of-8 vs U8x64 40 23–26 1.5–1.7×
Kleene 12-of-24 vs U8x64 132 77 1.7×
Bag sum vs U8x64 25 8 3.1–3.2×

Measured on one host (AVX-512, no VNNI) with the default x86-64 target. I did not record which facade backend that build selected. A branchless ripple was also tried and was not faster.

Likely cause (HYPOTHESIS): a carry-word call covers one u64 (64 rows), while a single U8x64 add also covers 64 rows. No wide carry word exists to test this.

Proposed ruling (memo D-DRISA-M6): lower threshold, Kleene and Bag to byte counters by default. Keep the carry formulation and its oracle as the semantic reference. Not measured: counts above 255, folds that keep planes for later arithmetic, other ISA tiers.

Board: entry entries/2026-11-04-d-drisa-3-alu-semantics.md, the STATUS_BOARD row D-DRISA-3-LAB, the memo checklist, and the regenerated index.


Generated by Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XAqKMNZqKXSaeb9g2ypywF
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XAqKMNZqKXSaeb9g2ypywF
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XAqKMNZqKXSaeb9g2ypywF
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XAqKMNZqKXSaeb9g2ypywF
@coderabbitai

coderabbitai Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1b6bd395-d980-475d-9d37-e37292c8c83a
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Copy link
Copy Markdown
Owner Author

linux-build-v4 (x86-64-v4) failed at 15db2344c because the runner ran out of disk. The log shows rustc-LLVM ERROR: IO failure on output stream: No space left on device, and ld terminated with signal 7 [Bus error] while linking the lance-graph test test_datafusion_varlength_complex.

This PR does not change lance-graph. Its only code is in crates/drisa-register-probe, which is excluded from the workspace. The same job passed on #1954 earlier today. No code fix applies, so I'll re-run the failed job once the rest of the run finishes; a re-run is refused while the run is still in progress.


Generated by Claude Code

@AdaWorldAPI
AdaWorldAPI marked this pull request as ready for review November 4, 2026 00:59
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-04T01:02:47.460580Z 15db234 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@AdaWorldAPI
AdaWorldAPI changed the base branch from ccr-85acaff0-oszq40-drisa-1 to main November 4, 2026 01:52
lib.rs: both sides added a line at the top (pub mod alu; the AtomicU64
import from #1955); kept both. Board indexes regenerated. 21/21 tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XAqKMNZqKXSaeb9g2ypywF
@AdaWorldAPI
AdaWorldAPI merged commit da52d4c into main Nov 4, 2026
13 checks passed
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.

2 participants