Optimize loops in createMoveGroupsFromLiveRangeTransitions
Categories
(Core :: JavaScript Engine: JIT, task, P1)
Tracking
()
Tracking | Status | |
---|---|---|
firefox133 | --- | fixed |
People
(Reporter: jandem, Assigned: jandem)
References
Details
(Whiteboard: [sp3])
Attachments
(5 files)
Some of the loops in createMoveGroupsFromLiveRangeTransitions
have quadratic behavior and this hurts us when compiling Wasm modules with very large functions.
Fixing this improves the ONNX module in bug 1916442 from ~5.4 seconds to ~3.9 seconds and a PhotoShop module from 25 seconds to 14.5 seconds.
Assignee | ||
Comment 1•4 months ago
|
||
This looks like an optimization, but it never hits on any tests because two overlapping
ranges for a virtual register should have a different allocation. The loop is also
quadratic.
Assignee | ||
Comment 2•4 months ago
|
||
Assignee | ||
Comment 3•4 months ago
|
||
Use a vector to keep track of previous 'active' ranges that could be predecessor
ranges. This vector contains only a few ranges so this is much more efficient than
using rangeFor
.
Assignee | ||
Comment 4•4 months ago
|
||
First add all edges to a vector, including the range on the successor side.
Then sort this vector and iterate over the ranges and the edges simultaneously
to resolve all edges. This avoids quadratic behavior.
Assignee | ||
Comment 5•4 months ago
|
||
In createMoveGroupsForControlFlowEdges
, for at least 70% of all edges, the predecessor
and successor blocks have ranges with the same allocation. In this case moveAtEdge
is a
no-op.
We can increase this number by a few percentage points if we stop searching for a range
when we find an exact match.
This also fixes the register allocation issue reported in bug 1912154.
Updated•4 months ago
|
Comment 7•4 months ago
•
|
||
Improvements
27% improvement on Jetstream2-HashSet-wasm-Runtime
4.6% improvement on Jetstream2- stanford-crypto-aes-Average
3.4% improvement on Jetstream2-segmentation- suite
Regressions:
17% regression on Jetstream2-float-mm.c-Average (Effectively neutralizing the gains from bug 1918970)
Comment 8•4 months ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/49949b890d66
https://hg.mozilla.org/mozilla-central/rev/3df242142132
https://hg.mozilla.org/mozilla-central/rev/56f929b201ff
https://hg.mozilla.org/mozilla-central/rev/b1faf0f24bd2
https://hg.mozilla.org/mozilla-central/rev/db4000b52409
Updated•3 months ago
|
Updated•3 months ago
|
Description
•