Skip to content

D-DRAM-P3-5: k-of-n on the shipped carry words — kill condition fired - #1954

Merged
AdaWorldAPI merged 3 commits into
mainfrom
ccr-85acaff0-oszq40-dram-p3-5
Nov 4, 2026
Merged

AdaWorldAPI merged 3 commits into
mainfrom
ccr-85acaff0-oszq40-dram-p3-5

Conversation

@AdaWorldAPI

Copy link
Copy Markdown
Owner

This is a lab bench plus a board record. It changes no production code, adds no new opcode and no public type. Please don't merge automatically. The IDEAS status line for this result is on #1952, because the IDEAS section was added there.

What was measured

crates/crepe-plan-probe/examples/kofn_carry_words.rs asks, per lane: are at least k of the n masks set? It compares:

  • carry: the Abakus fold, built from ndarray's two shipped words only. full_add_mask adds two masks into column 0, half_add_mask ripples the carry upward, and a constant-k comparator runs over the planes.
  • simd: facade byte counters, U8x64::saturating_add(mask_blend(m, 0, 1)) per mask, then cmpgt_mask(k-1).
  • naive per-lane and per-byte loops, and the plain OR/AND folds.
  • an independent oracle that walks set bits with trailing_zeros.

Result

The carry arm is 1.7–4.0× slower than the facade byte counters in every cell: dense, random and one-lane masks; n = 3, 8, 32; k = 1, ⌈n/2⌉, n. On dense masks with n = 32 it takes 61–65 ns per 64-lane word, against 24–25 ns for the byte counters.

The kill condition stated before the run ("slower than native on dense masks") fired. The likely cause is width: one u64 (64 lanes) per carry-word call versus one vector add per 64 lanes. That cause is HYPOTHESIS; no wide carry-word arm was built.

Correctness:

  • In all 3 runs, every arm agrees with the oracle in every cell.
  • Silence twin: k = 1 equals OR and k = n equals AND, exactly.
  • Anti-vacuity: on random masks, the middle k splits the lanes between 5% and 95%.

Disable runs (commit first, then patch, then checkout):

  • the comparator loses its gt term: 21 FAIL lines;
  • the ripple stops after one column: 29 FAIL lines;
  • restored: 0.

Clippy -D warnings passes on the example.

Coverage of the A-gates proposed in #1949 (a proposal by a GPT session, adopted after review):

  • A1, A2 and A6 are partly covered.
  • A5 (NULL/Bag) and A7 (Quack lowering, other ISA tiers) are not covered.
  • One host (AVX-512 without VNNI), default x86-64 target. The facade backend that build selected was not recorded.

Open

  • A wide carry word over U64x8 would be a new ndarray word, which needs ndarray's owner. It is not built here.
  • Counts above 255, and folds that keep the planes for later arithmetic, are where the bit-plane model could still win. Neither was measured.

Record: .claude/board/entries/2026-11-03-d-dram-p3-5-kofn.md. STATUS_BOARD and the plan checklist are updated.


Generated by Claude Code

@coderabbitai

coderabbitai Bot commented Nov 3, 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: 6a476e92-1621-4481-8ea0-6fb0355593fd
  • 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

@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:00:28.260682Z 121e151 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.

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