Skip to content

census: optional column dump, so a consumer can answer the SIMD question - #14

Merged
AdaWorldAPI merged 1 commit into
masterfrom
claude/c64-6502-falsifier-shztkk
Sep 14, 2026
Merged

AdaWorldAPI merged 1 commit into
masterfrom
claude/c64-6502-falsifier-shztkk

Conversation

@AdaWorldAPI

@AdaWorldAPI AdaWorldAPI commented Sep 14, 2026

Copy link
Copy Markdown
Owner

r2il::columns states that whether vectorizing its scans pays "is a profiling question nobody has answered", and that the crate takes no ndarray dependency on purpose — the consumer holds one. That left no way to get real columns out of a real lift and into such a consumer.

What this adds

An env-gated dump in the win32_census example — WIN32_CENSUS_COLUMNS_OUT=<path>, default off, zero behaviour change when unset — writing the three columns in a flat LE form: u64 n, n×u8 tag, n×u8 space, n×u64 offset.

It is deliberately the smallest possible change: no ndarray edge is created anywhere in this workspace, and r2il's dependency surface is untouched.

What it was used for

AdaWorldAPI/ndarray#308 consumes the dump and answers the question on this fixture's 12 408 p-code ops (four arms — scalar over the native u8/u64 columns, mask_and, mask_ternlog::<AND3>, and the _under chain — all gated bit-for-bit identical before timing, swept 256 → 3.2 M):

  • mask arms 1.32–1.42× the scalar scan at the real size;
  • the advantage inverts to 0.75–0.80× above ~200 K ops, because the facade's narrowest value type is u32 while these columns are u8, so a consumer pays a 4× widened copy;
  • whole-census saving 2.5 µs, against a SLEIGH lift that costs milliseconds.

Also measured, and it bears on find_ram_in_range directly: 100 % of Ram-space offsets in this lift exceed 2³² (image-based, 0x1_4000_105e0x1_4000_8398), and ndarray's ordered comparator family stops at i32 — so that query has no general vectorized spelling today without a u64 range primitive.

The columns' own doc-comment caution was right, and is now measured rather than assumed.

🤖 Generated with Claude Code

https://claude.ai/code/session_01DCfrD5y19cvFc4AoyydXYv

Summary by CodeRabbit

  • New Features
    • Added optional columnar output for the Win32 census tool.
    • Set WIN32_CENSUS_COLUMNS_OUT to export operation counts, tags, spaces, and offsets to a specified file.
    • The tool reports how many operations were exported.
    • When the setting is not provided, no output file is generated.

`r2il::columns` states that whether vectorizing its scans pays "is a
profiling question nobody has answered", and that the crate takes no
ndarray dependency on purpose — the consumer holds one. That left no way
to get real columns out of a real lift into such a consumer.

Adds an env-gated dump (WIN32_CENSUS_COLUMNS_OUT, default off, no
behaviour change when unset) writing the three columns in a flat LE form:
u64 n, n*u8 tag, n*u8 space, n*u64 offset.

Measured with it (ndarray's r2il_column_scan_probe, Xeon avx512f/bw/vl):
on this fixture's 12 408 p-code ops the mask arms run 1.32-1.42x the
scalar scan, the advantage inverts to 0.75-0.80x above ~200 K ops, and the
whole-census saving is 2.5 us against a lift that costs milliseconds. The
columns' own doc-comment caution was right.

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

coderabbitai Bot commented Sep 14, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Essentials

Run ID: 4875ab61-10bc-4352-ae1e-43f337155506

📥 Commits

Reviewing files that changed from the base of the PR and between 99d2553 and 0a39849.

📒 Files selected for processing (1)
  • crates/r2sleigh-lift/examples/win32_census.rs

📝 Walkthrough

Walkthrough

The Win32 census example now optionally exports projected operation data to a file specified by WIN32_CENSUS_COLUMNS_OUT.

Changes

Win32 census column export

Layer / File(s) Summary
Environment-controlled column export
crates/r2sleigh-lift/examples/win32_census.rs
When WIN32_CENSUS_COLUMNS_OUT is set, the census writes operation counts, tags, spaces, and little-endian offsets to the specified file. It reports the exported operation count and fails if writing fails.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Feature

Suggested reviewers: claude

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

A rabbit found columns in rows,
And packed little-endian flows.
The census counted each byte,
Then wrote the results just right.
No path, no dump—quiet repose.

Comment @coderabbitai help to get the list of available commands.

@cursor

cursor Bot commented Sep 14, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_94e5adbd-0d08-4750-add1-12a94894b158)

@AdaWorldAPI
AdaWorldAPI marked this pull request as ready for review September 14, 2026 21:01
@AdaWorldAPI
AdaWorldAPI merged commit aacb268 into master Sep 14, 2026
1 of 2 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