Skip to content

Add WASM SIMD128 differential test harness and structural linter - #837

Draft
stereobooster wants to merge 1 commit into
RoaringBitmap:masterfrom
stereobooster:pr-c-wasm-harness
Draft

Add WASM SIMD128 differential test harness and structural linter#837
stereobooster wants to merge 1 commit into
RoaringBitmap:masterfrom
stereobooster:pr-c-wasm-harness

Conversation

@stereobooster

@stereobooster stereobooster commented Jun 4, 2026

Copy link
Copy Markdown

Split out of #818 (which is being broken into small, single-purpose PRs). This is the verification infrastructure for the WebAssembly SIMD128 work (issue #801), landing ahead of the SIMD code itself so the test strategy can be reviewed in isolation.

Contents

  • tests/wasm_diff_harness.c: deterministic-digest harness comparing native / wasm-scalar / wasm-simd128 amalgamation builds via bounded metamorphic membership oracles, iterator/export parity, inplace parity, cardinality laws and portable round-trip.
  • tools/run_wasm_differential_test.sh + tools/ci_wasm_differential_digest.sh: build the three legs and compare digests. A wasm-objdump SIMD-presence guard (a bring-up check that the -msimd128 leg isn't vacuously scalar codegen) activates once SIMD paths exist; it is retired in the final SIMD PR once the three-way digest comparison stands on its own.
  • tools/check_wasm_simd_neon_pairing.sh: structural #elif hygiene linter for files sharing CROARING_WASM_SIMD and CROARING_USENEON branches — wired into the emscripten CI workflow.
  • CMake targets wasm_differential_test / wasm_neon_simd_parity_check; README section.

Note on CI: only the NEON-pairing linter runs in CI here (it passes on a SIMD-free tree). The differential-digest CI step is intentionally added together with the first SIMD path (next PR in the split), because its SIMD-presence guard requires wasm SIMD code to be present — this keeps every PR green.

Follow-up SIMD PRs (run / bitset / array / nonempty) will build on this harness.


AI usage disclosure (per AI_USAGE_POLICY.md): this change was prepared with significant AI assistance (Claude Code). It is opened as a draft; I am reviewing it personally before marking it ready for review, I remain the author and am accountable for the contribution, and I can answer questions about it. The commits also carry a Co-Authored-By trailer noting the AI assistance.

Adds the verification infrastructure for the WebAssembly SIMD128 work
(issue RoaringBitmap#801), landing ahead of the SIMD code itself:

- tests/wasm_diff_harness.c: deterministic-digest harness comparing
  native / wasm-scalar / wasm-simd128 amalgamation builds via bounded
  metamorphic membership oracles, iterator/export parity, inplace parity,
  cardinality laws and portable round-trip. The digest is integer-only
  (the floating-point jaccard index is excluded to avoid a 1-ULP
  native-vs-wasm divergence flipping a quantized value).
- tools/run_wasm_differential_test.sh + ci_wasm_differential_digest.sh:
  build the three legs and compare digests (with wasm-objdump / LLVM IR
  SIMD-presence guards once SIMD paths exist). count_simd_ops wraps its
  grep in a set+e subshell so a zero-match baseline does not abort under
  pipefail.
- tools/check_wasm_simd_neon_pairing.sh: structural #elif hygiene linter;
  wired into the emscripten CI workflow.
- CMake targets wasm_differential_test / wasm_neon_simd_parity_check for
  local runs; README section documenting the approach.

Only the NEON-pairing linter runs in CI here; the differential-digest CI
step is enabled in the first SIMD PR (its SIMD-uplift guard needs SIMD
code present), so every commit keeps CI green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

1 participant