Skip to content

Add NEON and AVX2 decode SIMD kernels for PIVCO - #12355

Open
lwwmanning wants to merge 1 commit into
wm/pivco-arrayfrom
wm/pivco-simd-decode
Open

lwwmanning wants to merge 1 commit into
wm/pivco-arrayfrom
wm/pivco-simd-decode

Conversation

@lwwmanning

Copy link
Copy Markdown
Contributor

Stacked on #12103

Replaces the scalar decode fallbacks in vortex-pivco with NEON and AVX2+POPCNT merge, popcount, and flat-subtree unpack kernels (for D in 2..=6). NEON shares a single 64-byte merge helper across the variable-vector and constant-side paths, and x86 targets AVX2+POPCNT plus scalar without redundant SSSE3/SSE4.1 tiers, verified against scalar with bit-exact parity tests.

Authored with AI assistance.

Adds NEON and AVX2+POPCNT SIMD decode merges, popcount, and flat-subtree
unpack kernels (D in 2..=6) behind the scalar fallbacks in vortex-pivco,
deduplicating NEON 64-byte merge bodies and dropping shadowed SSSE3/SSE4.1
x86 tiers, plus bit-exact SIMD-vs-scalar parity tests.

Co-Authored-By: Antigravity <noreply@google.com>
Signed-off-by: Will Manning <will@willmanning.io>
@lwwmanning lwwmanning added the changelog/performance A performance improvement label Nov 30, 2026
@chatgpt-codex-connector

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

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-30T00:59:08.680076Z 8310a72 PR opened
ℹ️ 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.

@lwwmanning lwwmanning left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Posted by Claude Opus 5.5 on Will's behalf.

I read the NEON and AVX2 kernels against the scalar code. I found no bug. The in-place merges are safe. Each 16-byte store holds 16 merged symbols, so a store never overwrites a byte that a later load needs. Every vector load stays inside the l_len, r_len or packed.len() guard, and the unpack tails read only the bytes the scalar path reads.

The AVX2 code has not run in CI. On pull requests, the workspace tests run only on Rust tests (linux-arm64). The nightly x86 musl job runs them only after merge. The nightly rust-test-cpu-features avx2 job tests only vortex-buffer, vortex-mask and vortex-array. So before merge, merge_vec_vec_avx2, merge_cst_side_avx2, merge_cst_cst_avx2 and the five unpack_flat_d*_avx2 kernels have no CI coverage. Please add -p vortex-pivco to the cpu-features job, or run the pivco tests once on an AVX2 host and say so in the description.

The NEON shuffle tables have no exhaustive check, but the x86 tables do (test_x86_merge_pshufb_tables_exhaustive_16bit). One test can cover both. Call merge_vec_vec, merge_cst_vec and merge_vec_cst with k = 16 and 16-byte inputs for all 65,536 masks, and compare with the scalar merge. That runs the real dispatch on each target. It can replace the table-only x86 test.

The parity tests use seeded loops over fixed lengths and patterns. A Hegel property that draws the bitmap bytes, k, the slack and the depth would cover the same cases with less code. This is optional.

The PR adds about 1,560 lines of unsafe SIMD with no measured result. Please add one line with the decode speedup over scalar, on NEON and on AVX2. The pivco_compress decode benches in #12358 can give it.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog/performance A performance improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant