Open Bug 1942827 Opened 23 days ago Updated 22 days ago

wasm: analysis of performance lossage for JetStream3/tsf-wasm

Categories

(Core :: JavaScript: WebAssembly, task, P3)

task

Tracking

()

People

(Reporter: jseward, Assigned: jseward)

References

(Blocks 1 open bug)

Details

Attachments

(3 files)

For JetStream3/tsf-wasm we get a run-time score of 39.314 vs 48.287 for
V8-13.4.37 on Intel Tiger Lake. This is a pretty poor showing and the second
worst after JetStream3/gcc-loops-wasm (see bug 1942596).

Summary:

  • excessive spilling
  • insufficient block chaining in some situations
Attached file Fragment_1.txt

Fragment_1.txt

This test case seems like an interpreter loop -- a loop whose body is a
multiway switch, with 292 entries in this case.

(1) An extra block in the loop

For V8 the per-iteration overhead for the loop is 3 blocks: a block to do the
interrupt check, a block to fetch the next opcode and do a bounds check, and a
block to do the indirect branch to one of the 292 handlers. Each handler does
its thing and jumps directly back to the interrupt check. Hence a minimum
per-opcode cost of 4 blocks.

For SM, we only have one loop backedge, so the handler blocks jump to a
loop-end block, which does one or two MoveGroups and jumps back to the
interrupt check. Hence a minimum per-opcode code of 5 blocks.

Jan points out that CodeGeneratorShared::jumpToBlock can short out blocks in
some cases -- at least when the target block is empty. We could perhaps make
it more aggressive, and copy the target block's contents provided they are only
MoveGroups. That would fix this case.

(2) Excessive spilling

V8's 3-block overhead contains no spills or reloads. Our 4-block overhead
contains 2 reloads and a spill.

Attached file Fragment_2.txt

Fragment_2.txt

For unknown reasons, what is a single block in V8 is two blocks for SM.

Attached file Fragment_3.txt

Fragment_3.txt

Excessive spilling.

Just one of a many examples. The reloads/spills aren't dramatic, but many
blocks are affected. A general burden on performance.

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: