Improve lazy tiering
Categories
(Core :: JavaScript: WebAssembly, task, P1)
Tracking
()
Tracking | Status | |
---|---|---|
firefox130 | --- | fixed |
People
(Reporter: rhunt, Assigned: rhunt)
References
(Blocks 1 open bug)
Details
Attachments
(11 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 | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review |
Fix the first low hanging fruit to improve lazy tiering.
Assignee | ||
Comment 1•4 months ago
|
||
FeatureUsage is moved from CodeMetadata to ModuleMetadata. This removes
one of the places where we mutate CodeMetadata while compiling a tier
of code, which prevents us from making CodeMetadata truly immutable
for tier2.
Assignee | ||
Comment 2•4 months ago
|
||
Changes ModuleMetadata to create an manage the inner CodeMetadata.
Assignee | ||
Comment 3•4 months ago
|
||
We can get the FuncType* from just the typeIndex, and the pointer
makes serializing this class difficult. Drop it.
Assignee | ||
Comment 4•4 months ago
|
||
We previously did not have FuncDesc available on Code/Instance,
leading to a bunch of ad-hoc ways of getting the same info,
such as FuncExport/Import having a typeIndex, or debugFuncTypeIndices,
or numFuncs. This commit switches them to use FuncDesc and serializes
it.
Assignee | ||
Comment 5•4 months ago
|
||
Now that we have FuncDesc, we don't need FuncImport/Export::typeIndex around anymore.
Assignee | ||
Comment 6•4 months ago
|
||
ModuleGenerator mutates CodeMetadata during initialize() and finishModule(),
and these make it difficult to make CodeMetadata immutable for tier2.
We can fix the mutation done by initialize() by adding a ModuleMetadata::
prepareForCompilation() method which all compilers use.
The mutation in finishModule() is trickier, but most of it can be fixed
by having CompileArgs be saved on ModuleMetadata.
The remaining mutation is harmless for making tier2 use an immutable
metadata because it only happens duing ModuleGenerator::finishModule,
which doesn't run on tier2. So we change that mutation to acquire its
mutable CodeMetadata from the mutable ModuleMetadata passed by param.
Once this is all done, we can finally have ModuleGenerator only need
an immutable CodeMetadata for intializing and compiling functions.
Assignee | ||
Comment 7•4 months ago
|
||
Now that we ModuleGenerator can use the CodeMetadata from the original
tier-1 compile, use that instead of recreating one.
Assignee | ||
Comment 8•4 months ago
|
||
CompileArgs live on ModuleMetadata/CodeMetadata now, so ModuleGenerator can
just grab it from that instead.
Assignee | ||
Comment 9•4 months ago
|
||
Use the bytecode offset from CodeRange to skip in the code section
to exactly the function that we're compiling for tier2.
Note: this requires a hack to OpIter to skip the checks that all bytes
are consumed. The reason is that CodeRange doesn't have a function
body length to use. This is fixed in a later commit that adds a
FuncDefRange.
Assignee | ||
Comment 10•4 months ago
|
||
ModuleGenerator used to compile the shared stubs every time it was
initialized to compile a complete tier. This is wasteful, because it
would be thrown away when compiling tier2. However, we need the shared
stubs link data for serializing tier2, making fixing this tricky.
This commit reworks serialization so that the LinkData that we
serialize comes from wasm::Code. This lets tier1 put the shared
stubs link data into wasm::Code, then have the tier2 compile
pull it out when it's time to serialize.
With that in place, we can now skip compiling shared stubs when
we're not in tier1.
Depends on D215698
Assignee | ||
Comment 11•4 months ago
|
||
Add a FuncDefRange to CodeMetadata that tracks the begin/length bytecode
offsets for every function defined in a module.
This lets us drop the equivalent info from CodeRange, shrinking that struct.
We can then use this for lazy compilation, and in the future for inlining.
Depends on D216220
Updated•4 months ago
|
Comment 12•4 months ago
|
||
Assignee | ||
Updated•4 months ago
|
Comment 13•4 months ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/649cfd2e8c96
https://hg.mozilla.org/mozilla-central/rev/19ce9e92c773
https://hg.mozilla.org/mozilla-central/rev/9ced3a801124
https://hg.mozilla.org/mozilla-central/rev/ce088784c1e1
https://hg.mozilla.org/mozilla-central/rev/9d606119b727
https://hg.mozilla.org/mozilla-central/rev/a7d8d2c13b31
https://hg.mozilla.org/mozilla-central/rev/f7f2d95f3e49
https://hg.mozilla.org/mozilla-central/rev/931ce01840a3
https://hg.mozilla.org/mozilla-central/rev/d57a1961c6fa
https://hg.mozilla.org/mozilla-central/rev/67a952c44d89
https://hg.mozilla.org/mozilla-central/rev/e77dd6f34a82
https://hg.mozilla.org/mozilla-central/rev/53fa71987ba0
Description
•