ReviewOS

zig-utils/zig-js

WebAssembly SIMD: integer lane arithmetic and comparisons

#281
Closed chris opened this 9 days ago ·
9 days ago

Parent: #264 Depends on: #279, #280 Roadmap: #142, #134

Implement every pinned fixed-width-SIMD integer instruction over the portable v128 substrate.

Acceptance:

  • Implement i8x16/i16x8/i32x4/i64x2 comparisons, shifts, boolean reductions, and ordinary arithmetic.
  • Implement signed/unsigned saturating arithmetic, min/max/average, narrowing, widening, extadd/extmul, pairwise extension, dot, and q15 operations.
  • Match lane-width wrapping, signedness, shift masking, and saturation exactly without host undefined behavior.
  • Keep one architecture-independent scalar oracle/fallback and prove any native acceleration bit-identical against it.
  • Publish per-family focused official-corpus totals with zero hidden exclusions.
9 days ago

First portable integer checkpoint is on main as 40d9e018: every i8x16/i16x8/i32x4 comparison, every standardized i64x2 comparison, and all four all_true/bitmask reductions now execute lane-by-lane without host-vector assumptions. Signed lanes are explicitly extended before comparison and true lanes are reconstructed at their exact width.

Pinned official evidence (WABT 1.0.39, proposal a78b98a…):

  • simd_boolean.wast: 273/273 applicable, 4 text-format n/a
  • simd_i8x16_cmp.wast: 445/445
  • simd_i16x8_cmp.wast: 465/465
  • simd_i32x4_cmp.wast: 465/465 applicable, 10 text-format n/a
  • simd_i64x2_cmp.wast: 113/113

That is 1,761/1,761 applicable commands across the five focused files, zero failures and zero runner errors. This also removes 138 of #280’s 184 shared-file blockers; wrapping arithmetic and shifts are next.

9 days ago

Two more portable scalar checkpoints are now on main:

  • d1d5b113: abs/neg/popcnt, width-masked signed/unsigned shifts, and wrapping add/sub/mul.
  • 9a82d87d: signed/unsigned saturating add/sub, min/max, and rounded unsigned averages.

New pinned official green files: simd_bit_shift 237/237 applicable; simd_i8x16_sat_arith 202/202; simd_i16x8_sat_arith 218/218; simd_i8x16_arith 131/131; simd_i16x8_arith 194/194. The shared simd_lane and simd_const files are also now 369/369 and 577/577 applicable. All have zero failures and zero runner errors; text-format n/a remains explicit. Narrow/widen, extadd/extmul, dot, and q15 are next.

9 days ago

Completed on main. Final implementation checkpoint 08e29a5f adds narrowing, all low/high signed+unsigned extension and extmul forms, pairwise extension-add, dot, and q15 rounding/saturation; 32e4f60d publishes the terminal score in README/docs.

Across the declared 24 focused official integer files: 4,380/4,380 applicable pass, 0 fail, 65 explicit text-format n/a, 0 runner errors. The implementation is architecture-independent scalar code with explicit lane widths, signed extension, wrapping, shift masks, and clamps; no native acceleration exists, so it is also the oracle future optimized paths must match. All five acceptance items are checked.

Sign in to comment on this issue.