Stream: git-wasmtime

Topic: wasmtime / PR #4269 Cranelift: support 14-bit Type index ...


view this post on Zulip Wasmtime GitHub notifications bot (Jun 14 2022 at 18:29):

cfallin opened PR #4269 from 14-bit-type to main:

After extending Type to a u16, ValueData became 12 bytes rather
than 8. This packs it back down to 8 bytes (64 bits) by stealing two
bits from the Type for the enum discriminant (leaving 14 bits for the
type itself).

Performance comparison (3-way between original (ty-u8), 16-bit Type
(ty-u16), and this PR (ty-packed)):

~/work/sightglass% target/release/sightglass-cli benchmark \
    -e ~/ty-u8.so -e ~/ty-u16.so -e ~/ty-packed.so \
    --iterations-per-process 10 --processes 2 \
    benchmarks-next/spidermonkey/benchmark.wasm

compilation
  benchmarks-next/spidermonkey/benchmark.wasm
    cycles
      [20654406874 21749213920.50 22958520306] /home/cfallin/ty-packed.so
      [22227738316 22584704883.90 22916433748] /home/cfallin/ty-u16.so
      [20659150490 21598675968.60 22588108428] /home/cfallin/ty-u8.so
    nanoseconds
      [5435333269 5723139427.25 6041072883] /home/cfallin/ty-packed.so
      [5848788229 5942729637.85 6030030341] /home/cfallin/ty-u16.so
      [5436002390 5683248226.10 5943626225] /home/cfallin/ty-u8.so

So, when compiling SpiderMonkey.wasm, making Type 16 bits regresses
performance by 4.5% (5.683s -> 5.723s), while this PR gets 14 bits for a 1.0%
cost (5.683s -> 5.723s). That's still not great, and we can likely do better,
but it's a start.

cc @sparker-arm -- you could try this as a starting point, and maybe look
for where the remaining 1% degradation is coming from and try to address it?
I suspect that the Vec<Type> in VCode may be playing a role, and if so
we can do a sparse-out-of-bounds trick (Vec<u8> with one sentinel
"out of bounds" indicator value and FxHashMap<Value, Type> for exceptions).

view this post on Zulip Wasmtime GitHub notifications bot (Jul 05 2022 at 15:58):

cfallin updated PR #4269 from 14-bit-type to main.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 05 2022 at 15:59):

cfallin has marked PR #4269 as ready for review.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 05 2022 at 16:00):

cfallin requested sparker-arm for a review on PR #4269.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 05 2022 at 17:06):

sparker-arm submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 05 2022 at 20:45):

cfallin updated PR #4269 from 14-bit-type to main.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 05 2022 at 21:51):

cfallin merged PR #4269.


Last updated: Dec 23 2024 at 13:07 UTC