Closed Bug 1919025 Opened 2 months ago Closed 1 month ago

Investigate using Semi-NCA in ComputeImmediateDominators

Categories

(Core :: JavaScript Engine: JIT, task, P2)

task

Tracking

()

RESOLVED FIXED
133 Branch
Tracking Status
firefox133 --- fixed

People

(Reporter: jandem, Assigned: jandem)

References

Details

Attachments

(3 files)

Spinning this off from bug 1916442.

The next issue is MIR dominator-tree building. The algorithm we have doesn't scale well with large MIR graphs and I want to see if we can change that to Semi-NCA which is a more recent algorithm that's also used by LLVM.

I've reimplemented ComputeImmediateDominators using Semi-NCA and it's a large improvement: 14 seconds to 7.9 seconds for ort-wasm-simd-threaded.jsep.wasm. I also verified it produces exactly the same immediate dominators for all jit-tests and this Wasm file.

My prototype patch for this is pretty straight-forward and I've added assertions to check it computes the same information as the current algorithm for all jit-tests.

The main thing left is to clean it up and make sure it doesn't regress JS/Wasm compile times for normal-size graphs.

Severity: -- → N/A
Priority: -- → P2

With this patch we run both algorithms at the same time and the Semi-NCA code asserts
the immediate dominators match.

Semi-NCA is much faster for very large graphs. For the ort-wasm-simd-threaded.jsep.wasm
Wasm module in bug 1916442, it reduces the total time spent in ComputeImmediateDominators
with --no-threads from 7171 ms to 151 ms. The LLVM backend also uses Semi-NCA.

I'm landing the "assert same results in DEBUG builds" patch first. It doesn't affect release builds yet.

If that's green I'll land part 3 a few days later.

Keywords: leave-open
Pushed by jdemooij@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/2da59767e15f part 1 - Move dominator tree building code to a new jit/DominatorTree.cpp file. r=mgaudet https://hg.mozilla.org/integration/autoland/rev/17850ee711c4 part 2 - Add Semi-NCA implementation. r=mgaudet
Keywords: leave-open
Pushed by jdemooij@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/55aff6551061 part 3 - Remove old implementation of ComputeImmediateDominators. r=mgaudet
Status: ASSIGNED → RESOLVED
Closed: 1 month ago
Resolution: --- → FIXED
Target Milestone: --- → 133 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: