Stream: git-wasmtime

Topic: wasmtime / PR #13640 cranelift(aarch64): lower the i8 rel...


view this post on Zulip Wasmtime GitHub notifications bot (Jun 15 2026 at 13:51):

darmie opened PR #13640 from darmie:aarch64-sdot-relaxed-dot to bytecodealliance:main:

On AArch64 with FEAT_DotProd, i32x4.relaxed_dot_i8x16_i7x16_add_s lowers to a
smull/smull2/addp/saddlp/add widening chain. This adds a has_dotprod
setting (auto-detected via cranelift-native) and lowers the op to a single
sdot — the instruction this relaxed op was designed to map to. Without the
feature, the existing fallback is unchanged.

There's no dedicated dot CLIF opcode (removed in #5889), so the wasm→CLIF
translator expands the op into a swiden/imul/iadd_pairwise/iadd tree; a
new ISLE rule contracts that tree back into sdot c, a, b.

Correctness

sdot is the signed, full-width, no-saturation dot product — exactly the
deterministic CLIF the translator already emits on AArch64 (the x86
pmaddubsw path is gated off here), so this is instruction selection, not a
semantic change. For the in-i7 range the op guarantees, the i16 pair sums
can't overflow, so sdot is bit-identical to the fallback; behavior differs
only in the spec's already-implementation-defined out-of-range zone, and the
relaxed-simd deterministic profile picks the same signed dot. Mirrors the
existing relaxed_madd → FMLA pattern of gating a native instruction behind a
feature.

Performance

cargo bench --bench relaxed_dot, Apple M1 Pro, wasmtime 47.0.0. The same
module is compiled twice toggling has_dotprod; the kernel is 8 independent
relaxed-dot accumulator chains (40M i8 4-way dots per call), criterion, 100
samples.

has_dotprod Lowering Time / call Speedup
false smull/smull2/addp/saddlp/add 17.12 ms 1.00×
true sdot 9.32 ms 1.84×

Tests / bench

view this post on Zulip Wasmtime GitHub notifications bot (Jun 15 2026 at 13:51):

darmie requested alexcrichton for a review on PR #13640.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 15 2026 at 13:51):

darmie requested wasmtime-compiler-reviewers for a review on PR #13640.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 15 2026 at 13:51):

darmie requested wasmtime-core-reviewers for a review on PR #13640.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 15 2026 at 13:51):

darmie requested wasmtime-default-reviewers for a review on PR #13640.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 15 2026 at 15:01):

:memo: alexcrichton submitted PR review:

Thanks for this!

view this post on Zulip Wasmtime GitHub notifications bot (Jun 15 2026 at 15:01):

:speech_balloon: alexcrichton created PR review comment:

We don't typically host micro-benchmarks like this for individual instruction/architecture pairs, so it's ok to omit changes here in the benches directory

view this post on Zulip Wasmtime GitHub notifications bot (Jun 15 2026 at 15:02):

:speech_balloon: alexcrichton created PR review comment:

It's ok to drop comments like this, LLMs generate text explaining what a test is but the text becomes irrelevant immediately after landing. This is "just another" test we have and you can leave a comment saying that this is testing the sdot lowering, but no need to call it a "new" lowering since after this PR merges that's stale text.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 15 2026 at 15:02):

:speech_balloon: alexcrichton created PR review comment:

Could this include a test interpret as well to verify it runs against the interpreter?

view this post on Zulip Wasmtime GitHub notifications bot (Jun 15 2026 at 15:39):

:memo: darmie submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 15 2026 at 15:39):

:speech_balloon: darmie created PR review comment:

Okay 👍🏾. Noted for next time. I'll make the change.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 15 2026 at 15:48):

:speech_balloon: darmie created PR review comment:

Resolved.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 15 2026 at 15:48):

:speech_balloon: darmie created PR review comment:

Done! It passes.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 15 2026 at 15:58):

darmie updated PR #13640.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 15 2026 at 15:59):

:memo: darmie submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 15 2026 at 15:59):

:memo: darmie submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 15 2026 at 15:59):

:speech_balloon: darmie created PR review comment:

Removed!

view this post on Zulip Wasmtime GitHub notifications bot (Jun 15 2026 at 16:01):

darmie requested alexcrichton for a review on PR #13640.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 15 2026 at 16:03):

:memo: darmie submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 15 2026 at 16:20):

:thumbs_up: alexcrichton submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 15 2026 at 16:20):

alexcrichton added PR #13640 cranelift(aarch64): lower the i8 relaxed dot product to NEON SDOT to the merge queue.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 15 2026 at 16:58):

:check: alexcrichton merged PR #13640.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 15 2026 at 16:58):

alexcrichton removed PR #13640 cranelift(aarch64): lower the i8 relaxed dot product to NEON SDOT from the merge queue.


Last updated: Jul 29 2026 at 05:03 UTC