Closed Bug 1686652 Opened 5 years ago Closed 5 years ago

Generalize the SIMD wormhole and make available on non-Nightly

Categories

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

x86_64
All
enhancement

Tracking

()

RESOLVED FIXED
87 Branch
Tracking Status
firefox87 --- fixed

People

(Reporter: lth, Assigned: lth)

Details

Attachments

(3 files)

The wormhole must be generalized to x86+x64 and Ion+baseline.

Generalize the wormhole to both x86 and x64, and both baseline and Ion.

Attachment #9197020 - Attachment description: Bug 1686652 - Generalize the SIMD wormhole. → Bug 1686652 - Generalize the SIMD wormhole. r?yury

A stale test case: it creates a combination of switches that breaks a test, but the combination is not allowed.

Flags: needinfo?(lhansen)

Good grief, how hard can this be?

Flags: needinfo?(lhansen)

The problem here is that the moz.configure changes raced with some other changes; the changes here need to be stronger to exclude the arm64 simulator. Taking the opportunity to further tune the guards in the test case for clarity.

Backout by nbeleuzu@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/b9549541b848 Backed out changeset a3a8f2b9d254 for Linting failure on moz.configure . CLOSED TREE

Targeting FF88 for an experiment.

Priority: P3 → P1
Flags: needinfo?(lhansen)
Summary: Generalize the SIMD wormhole → Generalize the SIMD wormhole and make available on non-Nightly

Backed out changeset 58936f707b78 (bug 1686652) for wormhole related failures.

Push with failures: https://treeherder.mozilla.org/jobs?repo=autoland&group_state=expanded&selectedTaskRun=bg8dyARaTFOLUjPp0K4tFQ.0&fromchange=58936f707b78c204f1dcff131691afd60485eed6&searchStr=build&tochange=79b3fae614f2e77f867d93eca95abc03faaa87bd

Backout link: https://hg.mozilla.org/integration/autoland/rev/79b3fae614f2e77f867d93eca95abc03faaa87bd

Failure log:
https://treeherder.mozilla.org/logviewer?job_id=328211878&repo=autoland&lineNumber=456
``
...
[task 2021-01-29T14:10:45.801Z] checking bindgen cflags... -x c++ -fno-sized-deallocation -fno-aligned-new -DTRACING=1 -DIMPL_LIBXUL -DMOZILLA_INTERNAL_API -DRUST_BINDGEN -DOS_POSIX=1 -DOS_LINUX=1 -std=gnu++17 -m32
[task 2021-01-29T14:10:45.804Z] ERROR: SIMD wormhole currently supported on native x86/x64 only
[task 2021-01-29T14:10:45.850Z] Traceback (most recent call last):
[task 2021-01-29T14:10:45.850Z] File "/builds/worker/checkouts/gecko/js/src/devtools/automation/autospider.py", line 514, in <module>
[task 2021-01-29T14:10:45.850Z] check=True,
[task 2021-01-29T14:10:45.850Z] File "/builds/worker/checkouts/gecko/js/src/devtools/automation/autospider.py", line 429, in run_command
[task 2021-01-29T14:10:45.850Z] raise subprocess.CalledProcessError(status, command, output=stderr)
[task 2021-01-29T14:10:45.850Z] subprocess.CalledProcessError: Command '['sh', '-c', '/builds/worker/checkouts/gecko/js/src/configure --enable-stdcxx-compat --disable-gold --enable-simulator=arm --target=i686-pc-linux --enable-rust-simd --enable-optimize --enable-debug --target=i686-pc-linux --enable-nspr-build --prefix=/builds/worker/workspace/obj-spider/dist']' returned non-zero exit status 1.
[task 2021-01-29T14:10:45.857Z] + BUILD_STATUS=1

Flags: needinfo?(lhansen)

Apart from yet another backout (this is probably a personal record) we're going to need other changes here. Minimally:

  • the wasm compilation should take an options bag which asks for simd and simd_wormhole for the compilation without being set globally
  • the fact that the wormhole is enabled needs to be recorded with serialized code because it's an attribute of the code

Additionally, we should discuss whether there should be a new preference that can be set by an extension to enable the recognition of the options bag. It may be that this is required to avoid WPT failures but that's TBD; it may be that it's desirable to have it regardless, so as to avoid exposing experimental content to the web more than for those that choose to use this functionality.

Additionally, it's possible javascript.options.wasm_simd_wormhole should go away, though it may be desirable to keep it for development?

Flags: needinfo?(lhansen)

This just tidies up the wormhole switch, introducing a getter for it
on the moduleEnv. As a drive-by fix, the v128Enabled switch in the
code metadata is removed, since nobody's using it. (At least I think
so. It does not seem to be part of anything we use to determine
whether cached code is valid, for example.)

Depends on D101709

This introduces cleaner logic around selecting the SIMD wormhole. The
large comment block in WasmConstants.h explains it in full, but in
summary this is what happens:

  • The switch j.o.wasm_simd_wormhole now serves as a signal that the
    wormhole may be requested through other means for individual
    compilations by content, it does not directly enable functionality.

  • Content can pass an options bag to wasm compilation functions
    requesting simd + the simd wormhole; the j.o.wasm_simd switch may be
    false but is overridden in this case. The bag is ignored if the
    j.o.wasm_simd_wormhole pref is not set.

The intent of this mechanism is that privileged extensions will set
the j.o.wasm_simd_wormhole switch and then request compilation of wasm
code with the {simdWormhole:true} options bag, thus enabling simd
functionality (with the wormhole opcodes, too) in release browsers
for these extensions before simd ships. We do it this way because
enabling j.o.wasm_simd exposes content in a way we don't want to
expose it.

Depends on D103693

Patches finally green on try with acceptable logic and updated logic for feature enablement (see commit msg). There is a placeholder for "privileged content" that currently always returns false.

Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → 87 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: