Skip to content

Wasm: execute atomics natively and scale shared memory #490

Description

@chrisbbreuer

Parent: #486
Depends on: #487, #476, #478, #482

Goal

Execute Wasm shared-memory atomics and wait/notify natively and remove engine/runtime scaling bottlenecks while preserving the exact Wasm threads memory model.

Measured boundary

The July 18 report records eight-worker contended add at 1.18x scaling, disjoint add at 1.25x, contended CAS at 0.54x, and 287,444 wait/notify pair handoffs/s after a nonmonotonic four-worker peak. Multi-worker timing includes shared-realm Thread construction and joins.

Scope

  • Lower every supported atomic load/store/RMW/CAS/fence/wait/notify operation to correct target atomics with exact width, alignment, sign, bounds, and ordering.
  • Separate unavoidable cache-line contention from interpreter dispatch, address/bounds checks, shared-instance locks, waiter-table locks, Thread lifecycle, parking, and wake storms.
  • Optimize disjoint accesses, waiter sharding, generation/queue bookkeeping, park/wake handoff, false sharing, and bounded waiter cleanup.
  • Preserve memory growth synchronization, instance/module sharing, spurious wake/timeouts, termination, and JS Atomics interoperability.
  • Add fixed-thread steady-state panels alongside lifecycle-inclusive public Thread panels, clearly labeled.

No-workaround rules

  • No relaxed memory order in place of required semantics, non-atomic fast path, changed contention layout, omitted lifecycle from an existing row, busy-spin presented as wait performance, or JSC comparison where no equivalent public surface exists.

Acceptance

  • All threads corpus atomics execute through verified native attribution on each backend.
  • Exact memory-model litmus, bounds/alignment/trap, growth race, wait/notify/timeout/termination, no-GIL, TSan, and lifecycle gates pass.
  • Profiles identify and materially reduce engine overhead in disjoint/CAS/wait rows; unavoidable hardware contention is reported separately.
  • Scaling is monotonic where work is disjoint, lifecycle and steady-state metrics are both retained, and RSS/waiter resources stay bounded.
  • Dated raw evidence replaces the July 18 artifact only after clean full validation.

Foundation

#284#288; current 105-sample report.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestperformanceMeasured runtime, memory, scaling, or build performancewasmWebAssembly runtime, compilers, and benchmarks

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions