Closed Bug 1690492 Opened 2 years ago Closed 2 years ago

SIMD optimization x64/x86: Use PBLENDVB for bitselect when the control vector is mask-like

Categories

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

x86_64
All
enhancement

Tracking

()

RESOLVED FIXED
91 Branch
Tracking Status
firefox91 --- fixed

People

(Reporter: lth, Assigned: yury)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

See https://github.com/WebAssembly/simd/issues/192#issuecomment-586397568. If we know the control vector is a mask with all 0 or all 1 per lane (ie it comes from a friendly constant or from an operation we know to generate a mask) we should be able to use PBLENDVB to merge the vectors rather than PAND; PANDN; and POR as now, and we can also avoid a move and a scratch register.

Using PBLENDVB is a little awkward because the control vector must be in xmm0, this isn't much of a hardship for Ion but might be a little messier in baseline. We could make this an ion-only optimization. This makes sense anyway since ion is required to recognize that the input is a mask in the case of a compare source.

The current code is actually pretty good so if we end up with anything more than just the single PBLENDVB it's probably not worth doing this.

Assignee: nobody → ydelendik
Attachment #9218783 - Attachment description: WIP: Bug 1690492 - Use PBLENDVB for blend operations. → Bug 1690492 - Use PBLENDVB for blend operations. r?lth
Status: NEW → ASSIGNED
Pushed by ydelendik@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/90822bbcf202
Use PBLENDVB for blend operations. r=lth
Pushed by ydelendik@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/489c49881778
Use PBLENDVB for blend operations. r=lth

Backed out for causing bustage on Lowering-x86-shared.cpp

backout: https://hg.mozilla.org/integration/autoland/rev/ee2ed3aaf4da0c50bead3cf494a65496da85b1e5

push: https://treeherder.mozilla.org/jobs?repo=autoland&group_state=expanded&revision=489c498817783088b301d13b8eeda694251ff860

failure log: https://treeherder.mozilla.org/logviewer?job_id=341065657&repo=autoland&lineNumber=19646

[task 2021-05-28T13:43:04.579Z] 13:43:04 INFO - In file included from Unified_cpp_js_src_jit14.cpp:38:
[task 2021-05-28T13:43:04.579Z] 13:43:04 ERROR - /builds/worker/checkouts/gecko/js/src/jit/x86-shared/Lowering-x86-shared.cpp:951:29: error: out-of-line definition of 'specializeConstantMaskAsShuffle' does not match any declaration in 'js::jit::MWasmBitselectSimd128'
[task 2021-05-28T13:43:04.580Z] 13:43:04 INFO - bool MWasmBitselectSimd128::specializeConstantMaskAsShuffle(
[task 2021-05-28T13:43:04.581Z] 13:43:04 INFO - ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[task 2021-05-28T13:43:04.581Z] 13:43:04 INFO - 1 error generated.
[task 2021-05-28T13:43:04.582Z] 13:43:04 ERROR - make[4]: *** [/builds/worker/checkouts/gecko/config/rules.mk:676: Unified_cpp_js_src_jit14.o] Error 1
[task 2021-05-28T13:43:04.583Z] 13:43:04 INFO - make[4]: Leaving directory '/builds/worker/workspace/obj-build/js/src/jit'
[task 2021-05-28T13:43:04.583Z] 13:43:04 INFO - make[4]: *** Waiting for unfinished jobs....

Flags: needinfo?(ydelendik)
Flags: needinfo?(ydelendik)

Bug 1699271 made diff invalid though it applied to MIR.h anyway. Reverted change made by the 1699271.

Lars, can you re-review the patch?

Flags: needinfo?(ydelendik) → needinfo?(lhansen)
Flags: needinfo?(lhansen)
Pushed by ydelendik@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/8f6458084f5f
Use PBLENDVB for blend operations. r=lth
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 91 Branch
You need to log in before you can comment on or make changes to this bug.