ReviewOS

zig-utils/zig-js

WebAssembly threads: upstream corpus, TSan, and scaling evidence

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

Parent: #265 Depends on: #284, #285, #286 Child: #315 Roadmap: #268, #142, #134

Publish terminal reproducible correctness and performance evidence for the pinned WebAssembly threads profile.

Acceptance:

  • Inventory every command in the pinned upstream threads corpus with explicit execution modes and zero hidden skips.
  • Add bounded exact-pin CI witnesses plus a deliberate complete profile command.
  • Pass deterministic contention, stress, leak, lifecycle, and ThreadSanitizer gates across supported hosts.
  • Benchmark representative atomic counter, CAS, wait/notify, and shared-memory kernels at one and multiple workers, with a system-engine comparison where equivalent.
  • Publish exact totals, raw samples, ownership/timing boundaries, supported architectures, and reproduction in README/docs.

Completion evidence:

  • Exact WebAssembly/threads@979d0fcb994439423d63b2f0a8a7332d6285dd84 corpus: 551/551 across 13 files, zero fail/N/A/runner
  • Execution modes: 493 JavaScript API, 29 proposal-thread, 29 proposal-wait
  • Scaling artifact: 105 samples / 15 scored rows at 1, 2, 4, and 8 workers
  • Focused lifecycle and sanitizer witnesses: 3/3 normal and 3/3 TSan
  • Full Linux CI acceptance: all four no-GIL TSan corpus shards, unit/TSan shards, threadfuzz lifecycle/stress, and Threads jobs green in run 29697559754
  • Child #315 closed the concurrent Memory wrapper growth-publication race
9 days ago

#286 is complete, so this is now the sole terminal Threads-profile gate.

Landed baseline available to this issue:

  • complete 67-opcode decode/validation/execution surface;
  • stable shared Memory ownership across Context/Thread/Worker;
  • wait32/wait64/notify, targeted termination interruption, growth/destruction lifecycle coverage;
  • exact threads/atomic.wast 372/372;
  • full unit root 1,069/1,069 and focused overlapping-access TSan 4/4.

Explicit current corpus gap (not hidden): the pinned WABT converter rejects proposal script directives such as (thread ...). LB_atomic.wast, MP_atomic.wast, and SB_atomic.wast therefore appear as runner errors when an atomic.wast substring filter includes them; the same script-layer limitation affects the proposal wait/notify scenarios. tools/wasm-spec.py now records conversion failure as a runner error instead of publishing zero totals.

Next order:

  1. implement exact pinned proposal-script thread directives and join/wait semantics;
  2. generate a complete command/mode inventory with zero hidden skips and add bounded exact-pin CI witnesses;
  3. run deterministic contention, stress, leak, lifecycle, and full TSan gates;
  4. benchmark atomic counter, CAS, wait/notify, and shared-memory kernels at 1..N workers against equivalent system JSC cases;
  5. publish raw samples, timing/ownership boundaries, host/architecture metadata, README scores, and reproduction.
9 days ago

Corpus/runner acceptance landed on main in fd1e20ea, d8319174, and docs checkpoint bf258e90.

Evidence:

  • exact WebAssembly/threads@979d0fcb994439423d63b2f0a8a7332d6285dd84 + WABT 1.0.39 pin
  • all 13 files, 551/551 pass, 0 fail, 0 n/a, 0 runner errors
  • modes: 493 JavaScript API, 29 proposal thread, 29 proposal wait
  • recursive/deep nesting, shared module identity, either, unlinkable imports, LB/MP/SB litmus pairs, atomic.wast 372/372, and real wait/notify all execute
  • production-default true-parallel no-GIL evaluator; 100 consecutive exact wait/notify replays passed under a 2s watchdog
  • shared Wasm store ownership registry is now synchronized for concurrent module/instance/export registration
  • five parser/generator regression tests pass; bounded exact-pin CI witnesses are prepared for simple.wast, deeply_nested.wast, and wait_notify.wast
  • focused no-GIL Wasm API test passes 3/3 with zero leaks

README and docs/wasm.md now publish the checked-in docs/.data/wasm-threads-inventory.json and complete reproduction. Remaining acceptance is the full TSan/host matrix plus scaling/system-engine report.

9 days ago

Published the terminal scaling artifact and focused sanitizer witness on main:

  • harness: eb43a2f9 (zig build wasm-threads-benchmark)
  • raw/report/README: 341fcf8d, 105 raw samples, rendered report
  • exact-kernel lifecycle/TSan witness: 87c0f0f8; ordinary and TSan filters each pass 3/3 with 0 skipped, failed, or leaked
  • support-boundary documentation: 1bf3dcef

The 7-sample matrix covers contended atomic add, retrying CAS, disjoint shared-memory atomics, and monotonic wait/notify generations at 1 and/or 2/4/8 workers. It validates counts, generations, timeouts, and a 120-second watchdog. The system macOS JSC embedding exposes no SharedArrayBuffer, rejects the shared module, and has no equivalent shared-realm worker API, so the report records JSC as N/A and links the equivalent general/SIMD comparisons.

Remaining acceptance item: the wider supported-host deterministic stress/leak/lifecycle/TSan matrix. The exact CI workflow change is ready locally, but GitHub rejects workflow-file pushes because the current OAuth token lacks workflow scope.

9 days ago

Child #315 is complete in 7650986. Acceptance run https://github.com/zig-utils/zig-js/actions/runs/29697559754 is green across the full workflow and all four no-GIL TSan corpus shards, including the original growth-publication race witness. Remaining work here is the broader upstream-corpus and terminal evidence scope.

9 days ago

Completed. The exact corpus, proposal-thread/wait execution, scaling artifact, supported-host boundary, and the full four-shard no-GIL TSan/lifecycle matrix are all published and green.

Sign in to comment on this issue.