Closed Bug 1814519 Opened 1 year ago Closed 1 year ago

Improve performance of dart-barista

Categories

(Core :: JavaScript: WebAssembly, enhancement, P2)

enhancement

Tracking

()

RESOLVED FIXED
112 Branch
Tracking Status
firefox112 --- fixed

People

(Reporter: rhunt, Assigned: rhunt)

References

(Depends on 1 open bug, 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

Some misc improvements from profiling.

ObjectMetadataBuilder is used for tracking allocations with devtools.
This commit removes support for it while we're optimizing for performance,
we will need to add a dynamic fallback for when devtools is tracking
allocations in bug 1814520.

Globals are kept alive for the duration of the program, this is a strong
hint that what is stored in them will be long lived.

Depends on D168613

This commit adds a TraceOffsetVector which is used for storing
pre-computed offsets of reference typed values. This minimizes
interpretation required while tracing.

Depends on D168614

This commit:

  1. Extends AllocSite to support 'wasm' sites that don't have scripts but should be tracked
  2. Gives every type definition in a module an allocation site that is used when allocating

This was seen to give a meaningful speedup on the dart barista3 benchmark.

Extending AllocSite is the trickiest part, as it is size sensitive and there are no
bits available. This commit chose to encode 'isWasm' by using a special script pointer.
There may be a better way.

This commit uses AllocSite as 1:1 with a type definition for two reasons:

  1. There is no easy way to allocate AllocSites for every allocation instruction
    with our current compiler infrastructure. I am also concerned that would dramatically
    blow-up our runtime size.
  2. Current targets of wasm-GC are nominal languages (object oriented too), and it seems
    like we could see some similar lifetime behavior for all instances of a class.

However, we definitely should experiment with different usage of AllocSite, types are
just the easiest start and they showed an improvement.

Depends on D168615

Baseline can fold the offset of inline struct accesses more aggressively
and reduce memory pressure by reusing the object pointer for the
data pointer.

Depends on D168616

Arrays/structs are initialized to be completely null. The pre-write barrier will
always be dead code for them.

Depends on D168617

This function has a lot of unnecessary pointer chasing.

Depends on D168618

These are not used anymore now that cranelift is gone.

Depends on D168619

This is the same improvement as the previous baseline patch, skip the
pre-write barrier when initializing a struct/array, as all the fields
are null.

There is one additional change here, we start skipping the pre-write
barrier for storing reference results to the stack. The reason for
this is that reference values on the stack are rooted and do not need
a pre-write barrier to mark them during incremental GC. We were
unnecessarily doing that before.

Depends on D168620

Depends on: 1814599

Right now for a GC write, we perform a call to the post-write barrier instance
method. The method then filters if it is necessary. This has the downside of
requiring all registers to be spilled, even if the barrier was not necessary.

This commit adds a new MIR node: MWasmPostWriteBarrier, modeled after a JS
version. This node performs the filtering inline and jumps to an OOL code
stub that spills live registers and performs a call to the instance barrier
method if necessary.

Depends on D168621

The structNew/arrayNew builtins allocate a struct/array and zero initialize
all fields and elements. This is fine for struct.new_default and array.new_default,
but is wasted work for struct.new and array.new, which will clobber over the
existing fields. This commit adds new builtins which skip zero initialization.

These builtins must be carefully used, as these GC objects are not fully
ready to be observed until they are initialized by the caller JIT code.

Depends on D169266

Pushed by rhunt@eqrion.net:
https://hg.mozilla.org/integration/autoland/rev/c2cd98ecdeab
wasm: Don't set object metadata for GC types. r=jseward
https://hg.mozilla.org/integration/autoland/rev/f1c8becd15eb
wasm: Force use of tenured heap for GC types allocated in globals. r=jseward
https://hg.mozilla.org/integration/autoland/rev/e9339526745a
wasm: Optimize performance of WasmStructObject::obj_trace. r=jseward
https://hg.mozilla.org/integration/autoland/rev/7009e330e6ff
wasm: Pretenure GC objects using the type as an allocation site. r=jseward,jonco
https://hg.mozilla.org/integration/autoland/rev/c3f4a844e32d
wasm: Improve inline struct access in baseline. r=jseward
https://hg.mozilla.org/integration/autoland/rev/4eb906313d0f
wasm: Don't emit pre-write barrier for initialization of structs/arrays. r=jseward
https://hg.mozilla.org/integration/autoland/rev/cd1e5acc4191
wasm: Remove indirections on post barrier by caching store buffer. r=jseward
https://hg.mozilla.org/integration/autoland/rev/bcbe085e2fa3
wasm: Remove filtering GC barriers. r=jseward
https://hg.mozilla.org/integration/autoland/rev/20bc54a8bcd1
wasm: Don't perform pre-write barrier for initialization in ion. r=jseward
https://hg.mozilla.org/integration/autoland/rev/4e273e81907f
wasm: Perform post-write barrier in Ion as OOL call that preserves live registers. r=jseward
https://hg.mozilla.org/integration/autoland/rev/e24ce05e5c7a
wasm: Initalize GC fields/elements only once for struct/array.new. r=jseward
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: