Skip to content

D-DYNBAG-1: ℕ-compose for p(X, Z) over DR64² tiles: exact, and measured - #1909

Merged
AdaWorldAPI merged 6 commits into
mainfrom
ccr-85acaff0-oszq40-dynbag1
Nov 1, 2026
Merged

AdaWorldAPI merged 6 commits into
mainfrom
ccr-85acaff0-oszq40-dynbag1

Conversation

@AdaWorldAPI

@AdaWorldAPI AdaWorldAPI commented Nov 1, 2026 •

Copy link
Copy Markdown
Owner

What

p(X, Z) :- r(X, Y), s(Y, Z) keeps both ends. Until now it was refused at admission. The lab probe now answers it as an integer matrix product over two DR64² 0/1 tiles. This is the falsifier from plan d-dynbag-holographic-bags-v1.md §7.5, with results in §7.6.

  • xlog-relcomp-probe src/ncompose.rs:
    • admit_pair admits XLOG's body in both join orders its optimizer emits. It admits a ChainJoin only when its own relations match its fallback. Bounds are refused, and q(Y) is still never admitted as p(X, Z).
    • pair_counts builds the 0/1 tiles over DR LocalMap axes (base relations are sets) and multiplies them with ndarray::simd::matmul_i8_to_i32.
  • Tests: tests/litho.rs part 4.
  • Cost probe: examples/ncompose_cost.rs. It reports ns per call against relcomp::compose, and prints which matmul_i8_to_i32 tier ran.

Results

  • Equality: ℕ per (x, z) matches both oracles: scalar witness enumeration, and a bag walk of XLOG's own RIR for p. It holds on the fixture and on a 300-case random differential, with ids 0..6 per axis so that ℕ ≠ B in more than 100 cases.

  • Projection: count > 0 equals relcomp::compose on the DR64 register in every case.

  • Disable runs, both red:

    • Swapping the operands is caught only by the differential; the hand fixture passes.
    • Reading the result as B before counting fails both tests.
  • Bug found while testing: XLOG's ChainJoin sometimes puts s first. The first version of admit_pair refused that order; it now admits it, checked against the fallback.

  • Cost (MEASURED). The host is an Intel Xeon, model 0x55 (Skylake-SP / Cascade Lake class), 4 vCPU VM, with AVX-512 VNNI and no AMX. The product ran on its AVX-512 VNNI VPDPBUSD tier. Two runs agreed within 1%.

    case compose (B) matmul_i8_to_i32 (ℕ, tiles prepared) pair_counts (ℕ, from tuples)
    sparse, 4 × 4 tuples 55 ns 20,762 ns 21,402 ns
    dense 64 × 64 2,369 ns 20,716 ns 158,756 ns

    Through matmul_i8_to_i32's current signature, a 64² tile costs about 21 µs whatever the density: exact, but 400× slower than B on sparse input and 9× on dense. 64³ multiply-adds is only about 4,096 VPDPBUSD instructions. HYPOTHESIS (not profiled): the time is the per-call pack_contig, u8 shift copy, output Vec, bias pass and copy back (plan §7.4). Two candidates follow, both for ndarray::simd, backend-first:

    • a non-allocating entry point;
    • a bit-packed i1 × i1 → i32 word (popcount of R[x] ∧ Sᵀ[z]), which is D-DYNBAG-3.
  • Correction. The first version of this PR said "no VNNI, scalar tier". I had grepped /proc/cpuinfo for avx512vnni, but the kernel spells it avx512_vnni. The numbers did not change on re-run, and the example now prints the tier.

  • AMX (ndarray .claude/AMX_GOTCHAS.md):

    • This host has no AMX: model 0x55 is pre-Sapphire Rapids, so amx_available() == false is genuine (Gotcha 4 does not apply).
    • A later AMX measurement must not be certified on a shared VM (Gotcha 14: tile state is silently corrupted under host contention).
    • Its parity tests must also run under deliberate CPU contention, and a skipped tile test is not a pass (Gotcha 9).

Validation

  • cargo test --release: every probe suite green (one #[ignore] that was already there).
  • cargo clippy --release --all-targets -- -D warnings: clean.

Still open:

  • Bounds on X or Z.
  • Chains longer than two atoms: counts would exceed i8 after one hop (§7.3).
  • Cross-tile compose (MISSING-7).

🤖 Generated with Claude Code

https://claude.ai/code/session_01XAqKMNZqKXSaeb9g2ypywF

…DYNBAG-1, WIP: tests not yet run)

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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XAqKMNZqKXSaeb9g2ypywF
matmul_i8_to_i32 over two DR64 tiles is exact against both oracles (300
cases) and projects to relcomp::compose; on this host (no VNNI, no AMX) it
costs ~21 us per tile against 50 ns - 2.4 us for the Boolean compose.

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

coderabbitai Bot commented Nov 1, 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: 687c61d4-2c4e-4f89-a7dd-2815fd063bdd
  • 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

…tchas noted

The cost example now prints the matmul tier. /proc/cpuinfo spells the flag
avx512_vnni; the earlier grep missed it. Numbers unchanged on re-run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XAqKMNZqKXSaeb9g2ypywF
@AdaWorldAPI
AdaWorldAPI marked this pull request as ready for review November 1, 2026 03:08
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 1, 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-01T03:10:01.508357Z 3df8cf8 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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3df8cf8274

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

… D-DYNBAG-1 in PR

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

The ChainJoin branch compared only the relation ids with its fallback, so a
chain with a reordered projection or a filter on one input was answered as
the fallback's query. It now checks its output columns against the key order
and refuses a bound on either input before the comparison.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XAqKMNZqKXSaeb9g2ypywF
@AdaWorldAPI
AdaWorldAPI merged commit f08e5bd into main Nov 1, 2026
13 checks passed
AdaWorldAPI pushed a commit that referenced this pull request Nov 1, 2026
…rge)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XAqKMNZqKXSaeb9g2ypywF
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