Support trial inlining in the baseline interpreter
Categories
(Core :: JavaScript Engine: JIT, task, P1)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox144 | --- | fixed |
People
(Reporter: iain, Assigned: iain)
References
(Blocks 4 open bugs)
Details
(Keywords: perf-alert)
Attachments
(8 files)
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review |
We inline when a baseline script reaches a particular warmup threshold. With off-thread baseline compilation enabled, it is possible for small scripts to reach that threshold in the baseline interpreter while we're still compiling the baseline script offthread. This means we won't inline into that script.
The most robust way to fix this is to enable inlining in the baseline interpreter at the same threshold. This should significantly reduce the effect of variance in background thread compilation time on inlining decisions.
| Assignee | ||
Comment 1•7 months ago
|
||
| Assignee | ||
Comment 2•7 months ago
|
||
| Assignee | ||
Comment 3•7 months ago
|
||
| Assignee | ||
Comment 4•7 months ago
|
||
When we passed the ICScript in the JSContext, we had to be certain that we were calling baseline code. If we instead called a different tier, it would leave the ICScript in the context, and a subsequent call to baseline code might pick it up, leading to a mismatched set of ICs. Now that we're passing it in the stub frame, it is always safe to call a lower tier, so we can simplify this code.
| Assignee | ||
Comment 5•7 months ago
|
||
| Assignee | ||
Comment 6•7 months ago
|
||
We have an invariant that a script must have a BaselineScript to have an IonScript. It's a little unclear how that should extend to inlined scripts.
Right now, there are a couple of assertions to enforce that inlined scripts must have a BaselineScript: one here, and another here.
This patch prevents us from reaching that situation. Alternatively, we could decide to relax those assertions.
| Assignee | ||
Comment 7•7 months ago
|
||
Comment 10•6 months ago
|
||
Comment 11•6 months ago
|
||
Comment 12•6 months ago
|
||
Backed out for causing SM build bustages on TrialInlining.cpp
Comment 13•6 months ago
|
||
Comment 14•6 months ago
|
||
Comment 15•6 months ago
|
||
Backed out for causing bc crashes @ browser_ext_activeScript.js
Comment 16•6 months ago
|
||
There are some r+ patches which didn't land and no activity in this bug for 2 weeks.
:iain, could you have a look please?
If you still have some work to do, you can add an action "Plan Changes" in Phabricator.
For more information, please visit BugBot documentation.
Updated•6 months ago
|
| Assignee | ||
Comment 17•6 months ago
|
||
There's a finicky stack overflow issue in 32-bit Windows mochitests that I have to solve before this lands.
Comment 18•6 months ago
|
||
Comment 19•6 months ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/a2cff0941dba
https://hg.mozilla.org/mozilla-central/rev/887bc1c960b3
https://hg.mozilla.org/mozilla-central/rev/e75b2c8ac3a5
https://hg.mozilla.org/mozilla-central/rev/a7363e13ee62
https://hg.mozilla.org/mozilla-central/rev/1302848ee76d
https://hg.mozilla.org/mozilla-central/rev/5bf7ff4b60a0
https://hg.mozilla.org/mozilla-central/rev/8afc8f690872
https://hg.mozilla.org/mozilla-central/rev/485b77b0aae2
Comment 20•5 months ago
|
||
There have been some performance regressions reported for this bug and I've tracked it down to part 3 ("Pass the ICScript in the stub frame instead of the JSContext"). The problem with this change is that it doesn't handle the case where there's an arguments-rectifier frame between the IC stub frame and the trial-inlined callee, because we set the flag on the stub frame's descriptor and not on the arguments-rectifier frame descriptor.
I tested a fix for that and it does get rid of (most of?) the regressions. However this needs a bit more work and there might be a better solution (one option is to go back to a field on the context, but keep the frame descriptor flag and also set that in the arguments rectifer trampoline like my patch does).
Let's back this out for now and Iain can fix it properly when he's back from leave.
Comment 21•5 months ago
|
||
Comment 22•5 months ago
|
||
Backed out for causing performance issues
Backout link: https://hg.mozilla.org/integration/autoland/rev/78c4083d168f41a4ddc2d9d04421d67b66d85bec
Comment 23•5 months ago
|
||
Backout merged to central: https://hg-edge.mozilla.org/mozilla-central/rev/78c4083d168f41a4ddc2d9d04421d67b66d85bec
Comment 24•5 months ago
|
||
(In reply to Jan de Mooij [:jandem] from comment #20)
Let's back this out for now and Iain can fix it properly when he's back from leave.
Seems that we may also need to revert bug 1974946? I am once again seeing various compilation failures after the backout.
Comment 25•5 months ago
|
||
(In reply to Sandor Molnar[:smolnar] from comment #22)
Backed out for causing performance issues
Backout link: https://hg.mozilla.org/integration/autoland/rev/78c4083d168f41a4ddc2d9d04421d67b66d85bec
Perfherder has detected a browsertime performance change from push 78c4083d168f41a4ddc2d9d04421d67b66d85bec.
If you have any questions, please reach out to a performance sheriff. Alternatively, you can find help on Slack by joining #perf-help, and on Matrix you can find help by joining #perftest.
Improvements:
| Ratio | Test | Platform | Options | Absolute values (old vs new) | Performance Profiles |
|---|---|---|---|---|---|
| 3% | speedometer AngularJS-TodoMVC/DeletingAllItems | windows11-64-24h2-shippable | fission webrender | 37.97 -> 36.94 | Before/After |
Details of the alert can be found in the alert summary, including links to graphs and comparisons for each of the affected tests.
If you need the profiling jobs you can trigger them yourself from treeherder job view or ask a performance sheriff to do that for you.
You can run all of these tests on try with ./mach try perf --alert 45971
The following documentation link provides more information about this command.
Comment 26•5 months ago
|
||
(In reply to Cristina Horotan [:chorotan] from comment #23)
Backout merged to central: https://hg-edge.mozilla.org/mozilla-central/rev/78c4083d168f41a4ddc2d9d04421d67b66d85bec
Perfherder has detected a devtools performance change from push 78c4083d168f41a4ddc2d9d04421d67b66d85bec.
If you have any questions, please reach out to a performance sheriff. Alternatively, you can find help on Slack by joining #perf-help, and on Matrix you can find help by joining #perftest.
Improvements:
| Ratio | Test | Platform | Options | Absolute values (old vs new) |
|---|---|---|---|---|
| 20% | damp custom.jsdebugger.pause.DAMP | linux1804-64-shippable-qr | e10s fission stylo webrender | 928.08 -> 740.28 |
| 11% | damp custom.jsdebugger.pause.DAMP | macosx1470-64-shippable | e10s fission stylo webrender | 965.17 -> 858.77 |
| 8% | damp custom.jsdebugger.pause.DAMP | windows11-64-24h2-shippable | e10s fission stylo webrender | 339.20 -> 310.84 |
| 7% | damp custom.jsdebugger.pause.DAMP | windows11-64-24h2-shippable | e10s fission stylo webrender | 334.42 -> 309.39 |
| 4% | damp custom.jsdebugger.stepInNewSource.DAMP | linux1804-64-shippable-qr | e10s fission stylo webrender | 2,274.07 -> 2,177.98 |
| 2% | damp custom.jsdebugger.stepInNewSource.DAMP | windows11-64-24h2-shippable | e10s fission stylo webrender | 871.02 -> 853.36 |
Details of the alert can be found in the alert summary, including links to graphs and comparisons for each of the affected tests.
If you need the profiling jobs you can trigger them yourself from treeherder job view or ask a performance sheriff to do that for you.
You can run all of these tests on try with ./mach try perf --alert 45967
The following documentation link provides more information about this command.
| Assignee | ||
Comment 27•4 months ago
|
||
Ah, good catch.
Bug 1815498 might be the best way to fix this. We already know the target here; instead of using the rectifier trampoline, we could just push the correct number of arguments in the first place.
| Assignee | ||
Comment 28•4 months ago
|
||
As written, these tests require OSR to get into Ion. In test(Get|Set)Element, however, there are inner loops. If we trigger OSR at one of those inner loops, we break scalar replacement. This shouldn't normally happen because of our heuristics to prioritize outer loops, but it looks like offthread baseline compilation can occasionally disrupt the timing enough to trigger inner loop OSR.
The simplest fix is to split out inner functions that can be compiled on entry, then disable OSR. It doesn't look like inlining disrupts this, but I disabled it just to be sure.
Looking at the other subarray-scalar-replace tests, none of them involve inner loops, so they don't require the same change.
Comment 29•3 months ago
|
||
Comment 30•3 months ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/7216b87aefcb
https://hg.mozilla.org/mozilla-central/rev/6e90038b69ae
https://hg.mozilla.org/mozilla-central/rev/20837cb64126
https://hg.mozilla.org/mozilla-central/rev/4f2aa92c79d0
https://hg.mozilla.org/mozilla-central/rev/fddd1ffd8f40
https://hg.mozilla.org/mozilla-central/rev/52d8390e3844
https://hg.mozilla.org/mozilla-central/rev/7c6521861b55
https://hg.mozilla.org/mozilla-central/rev/2dea7e82a4c7
Updated•3 months ago
|
Description
•