Initial support for lazy tiering
Categories
(Core :: JavaScript: WebAssembly, task, P1)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox130 | --- | fixed |
People
(Reporter: rhunt, Assigned: rhunt)
References
Details
Attachments
(7 files, 9 obsolete 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 |
Once bug 1898153 lands, we can build off of it to support lazy tiering. The initial version can be naive, the goal is to only compile a function with Ion after it has triggered some hotness heuristic.
| Assignee | ||
Comment 1•1 year ago
|
||
CompileMode currently doubles as both a 'strategy' and 'state' enum.
- 'strategy' is which overall plan are we following.
- 'compile once'
- 'compile with tiering'
- 'state' tracks where in the plan our module is currently at when
we're compiling in module generator.
- 'compile once'
- 'tiering on first tier'
- 'tiering on second tier'
With lazy tiering, this setup breaks and it seems cleaner to have two
separate enums to track these independently.
This commit also adds a placeholder mode/strategy for 'lazy' tiering.
Updated•1 year ago
|
| Assignee | ||
Comment 2•1 year ago
|
||
We currently keep the bytecode alive for debug modules. This changes
this so that we keep it alive for lazy tiering, and moves it to
wasm::Code.
Depends on D215412
| Assignee | ||
Comment 3•1 year ago
|
||
To avoid confusion with partial tiering, rename tier specific data to
show if it is only to be used when we're looking for a 'complete' tier
as opposed to a 'partial' tier.
Depends on D215413
| Assignee | ||
Comment 4•1 year ago
|
||
With lazy tiering, we can have one code block which contains a function
definition with a direct call to a function definition in a different
code block.
This commit moves CallFarJump out of ModuleGenerator and adds a list of
them to LinkData. When we're compiling a code block, any unresolved call
far jumps are appended to the LinkData. When the code segment is initialized,
the far jumps are applied, initially checking in the shared stubs block only.
Depends on D215414
| Assignee | ||
Comment 5•1 year ago
|
||
This introduces per-function hotness counters in baseline. We re-use the
stack overflow check strategy of triggering a trap. We do the hotness
increment in function prologues and loop headers.
Initially the hotness threshold is just '1'. When hotness is reached,
we just reset the hotness to INT32_MAX. A future commit will do something
with this information.
Depends on D215415
| Assignee | ||
Comment 6•1 year ago
|
||
Drive-by fix to actually apply the 'await tier2' flag in the JS
shell. We currently only apply it to shell worker contexts and not the
main thread context.
This flag forces tiering to happen for all modules, so it's important
for testing.
Depends on D215416
| Assignee | ||
Comment 7•1 year ago
|
||
This commit adds initial support for lazy tiering using a flag
to control it.
In this mode, we compile with baseline then do not trigger a tier2
background compile, but instead wait until a function triggers a
hotness threshold. When a function is hot, we synchronously
compile a tier-2 version of the function and commit it.
Limitations
- We have to re-enter the function to get into tier-2 code
- We don't use threads for the tier-2 compile
- CodeRange.bytecodeOffset is not useable for finding the function definition for
a function index. This means we have to scan through the whole module to find
the function definition. - Traps are an expensive way to trigger hotness
- We don't use the unused OS pages (4k) in code pages (64k) for lazy tier2 code.
Depends on D215417
Updated•1 year ago
|
| Assignee | ||
Comment 8•1 year ago
|
||
Depends on D215418
| Assignee | ||
Comment 9•1 year ago
|
||
Depends on D215690
| Assignee | ||
Comment 10•1 year ago
|
||
Depends on D215691
| Assignee | ||
Comment 11•1 year ago
|
||
Depends on D215692
| Assignee | ||
Comment 12•1 year ago
|
||
Not needed now that we have FuncDesc.
Depends on D215693
| Assignee | ||
Comment 13•1 year ago
|
||
Depends on D215694
| Assignee | ||
Comment 14•1 year ago
|
||
Depends on D215695
| Assignee | ||
Comment 15•1 year ago
|
||
Depends on D215696
| Assignee | ||
Comment 16•1 year ago
|
||
Depends on D215697
| Assignee | ||
Updated•1 year ago
|
Comment 17•1 year ago
|
||
| Assignee | ||
Updated•1 year ago
|
Comment 18•1 year ago
|
||
Comment on attachment 9411133 [details]
WIP: Bug 1905716 - wasm: Move FeatureUsage onto ModuleMetadata.
Revision D215690 was moved to bug 1907151. Setting attachment 9411133 [details] to obsolete.
Comment 19•1 year ago
|
||
Comment on attachment 9411134 [details]
WIP: Bug 1905716 - wasm: ModuleMetadata strongly owns CodeMetadata.
Revision D215691 was moved to bug 1907151. Setting attachment 9411134 [details] to obsolete.
Comment 20•1 year ago
|
||
Comment on attachment 9411135 [details]
WIP: Bug 1905716 - Drop FuncType* from FuncDesc to make it POD.
Revision D215692 was moved to bug 1907151. Setting attachment 9411135 [details] to obsolete.
Comment 21•1 year ago
|
||
Comment on attachment 9411136 [details]
WIP: Bug 1905716 - wasm: Serialize FuncDesc, replace ad-hoc old users.
Revision D215693 was moved to bug 1907151. Setting attachment 9411136 [details] to obsolete.
Comment 22•1 year ago
|
||
Comment on attachment 9411138 [details]
WIP: Bug 1905716 - wasm: Remove typeIndex from FuncImport and FuncExport.
Revision D215694 was moved to bug 1907151. Setting attachment 9411138 [details] to obsolete.
Comment 23•1 year ago
|
||
Comment on attachment 9411139 [details]
WIP: Bug 1905716 - wasm: Remove last mutation of CodeMetadata from ModuleGenerator.
Revision D215695 was moved to bug 1907151. Setting attachment 9411139 [details] to obsolete.
Comment 24•1 year ago
|
||
Comment on attachment 9411140 [details]
WIP: Bug 1905716 - wasm: Don't recreate ModuleMetadata for tier2.
Revision D215696 was moved to bug 1907151. Setting attachment 9411140 [details] to obsolete.
Comment 25•1 year ago
|
||
Comment on attachment 9411141 [details]
WIP: Bug 1905716 - wasm: Remove CompileArgs from ModuleGenerator constructor.
Revision D215697 was moved to bug 1907151. Setting attachment 9411141 [details] to obsolete.
Comment 26•1 year ago
|
||
Comment on attachment 9411142 [details]
WIP: Bug 1905716 - wasm: Only decode the function that is being re-compiled for tier2.
Revision D215698 was moved to bug 1907151. Setting attachment 9411142 [details] to obsolete.
Comment 27•1 year ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/0f75f3a3e577
https://hg.mozilla.org/mozilla-central/rev/a570798a633a
https://hg.mozilla.org/mozilla-central/rev/ef03ce2768ab
https://hg.mozilla.org/mozilla-central/rev/3f12d09cd5ae
https://hg.mozilla.org/mozilla-central/rev/8978a8942fd9
https://hg.mozilla.org/mozilla-central/rev/2aeac4710f81
https://hg.mozilla.org/mozilla-central/rev/426ef07e0ed2
https://hg.mozilla.org/mozilla-central/rev/9b917c65a1a7
Updated•1 year ago
|
Description
•