51,552 JavaScript tests can't be wrong


Yeah, so about that OpenPOWER Minimum Viable Product JavaScript JIT for Firefox. This happened (all timings from an unoptimized debug build on my dual-8 Talos II with -j24):

% ./mach jstests --args "--no-ion --no-baseline --blinterp-eager --regexp-warmup-threshold=0" -F -j24

[43359|    0|    0|  614] 100% ======================================>| 529.7s
PASS
% ./mach jstests --args "--no-ion --no-baseline" -F -j24
[43359|    0|    0|  614] 100% ======================================>| 499.0s
PASS
% js/src/jit-test/jit_test.py --args "--no-ion --no-baseline --blinterp-eager --regexp-warmup-threshold=0" -f -j24 obj/dist/bin/js
[8193|   0|   0|   0] 100% ==========================================>| 132.3s
PASSED ALL
% js/src/jit-test/jit_test.py --args "--no-ion --no-baseline" -f -j24 obj/dist/bin/js
[8193|   0|   0|   0] 100% ==========================================>| 133.3s
PASSED ALL

That's a wrap, folks: the MVP, defined as Baseline Interpreter with irregexp and Wasm support for little-endian POWER9, is now officially V. This is the first and lowest of the JIT tiers, but is already a significant improvement; the JavaScript conformance suite executed using the same interpreter with --no-ion --no-baseline --no-blinterp --no-native-regexp took 762.4 seconds (1.53x as long) and one test timed out completely. An optimized build would be even faster.

Currently the code generator makes heavy use of POWER9-specific instructions, as well as VSX to make efficient use of the FPU. There are secondary goals of little-endian POWER8 and big-endian support (including pre-OpenPOWER so your G5 can play too), but these weren't necessary for the MVP, and we'd need someone actually willing to maintain those since I don't run Linux on my G5 or my POWER6 and I don't run any of my OpenPOWER systems big. While we welcome patches for them, they won't hold up primary support for POWER9 little-endian, which is currently the only "tier 1" platform. I note parenthetically this should also work on LE Power10 but as a matter of policy I'm not going to allow any special support for the architecture until IBM gets off their corporate rear end and actually releases the firmware source code. No free work for a chip that isn't!

You should be able to build a JIT-enabled Firefox 86 off of what's in the Github tree now, but my current goal is to pull it up to 91ESR so that it can be issued as patches against a stable branch of Firefox. These patches will be part of my ongoing future status updates for Firefox on OpenPOWER (yes, you'll need to build it yourself, though I'm pondering setting up a Fedora copr at some point). The next phase will be getting Baseline Compiler passing everything, which should be largely done already because of the existing Baseline Interpreter and Wasm support, and then the final Ion JIT stage, which still needs a lot of work. We'll most likely set up a separate tree for it so you can help (ahem). No promises right now but I'd like to see the completed JIT reach the Firefox source tree in time for the next ESR, which is Firefox 102. That's more than you can say for Chrome/Chromium, which so far has refused to accept OpenPOWER-specific work at all.

Comments

  1. does it fall back to non-JIT gracefully if run on unsupported hardware? because if it does not and it depends on power9 stuff, it's practically unshippable

    ReplyDelete
    Replies
    1. Yes, the shippable final draft will most likely have runtime detection. If POWER9+ isn't detected, the JIT doesn't run. If this is less workable, there would be a compile-time disable, though obviously that's less preferable.

      Delete
  2. Great work! Many thanks form a Blackbird user!

    ReplyDelete
  3. For those of us with upcoming four day holiday weekends and a big-endian Talos, is there any guidance on how to collaborate if support were to magically appear? A draft MR on GitHub, perhaps?

    ReplyDelete
    Replies
    1. Potentially but it might be better to wait until we have a new tree up for the forward porting.

      Delete
  4. Thanks a lot, working with large GDocs in FF on Talos is painful.

    ReplyDelete
  5. Thank you! I'll compile/test it asap!

    Can we still use the same mozconfig as you posted for Firefox 86 at https://www.talospace.com/2021/02/firefox-86-on-power.html ? Or does it need an extra flag to enable the baseline JIT and wasm?

    ReplyDelete
    Replies
    1. It probably compiles as is and the JIT should "just build" but before running the actual browser make sure (at least) javascript.options.baselinejit, javascript.options.ion and javascript.options.wasm_optimizingjit are set to false in about:config. There may be other settings necessary to turn off (javascript.options.wasm_baselinejit??) to get the browser up. I haven't tried this yet myself since I'd rather dedicate the time actually into the ESR.

      Delete
    2. Thanks so much for all your hard work! I'll be getting Void Linux running part time on my dual G5 soon, and hope this will make a difference there in due time. To say nothing of my eventual Blackbird...

      Delete
    3. Thanks!

      @Koen: I forgot. You *do* need --enable-jit in your .mozconfig. I realized I hadn't made that the default while doing diffs tonight.

      Delete
    4. Thank you for the clarification! Unfortunately, it threws a lot of compiler errors once I add the '--enable-jit' flag.

      But this can also be because I still run Debian oldstable (!) (with a very old gcc version), so let's not waste our time here. I'm currently very busy, but hopefully during the Christmas holidays, I find some time to upgrade my Talos to the 'newish' Debian stable. Then I'll try it again!

      Delete
    5. It's possible. I've got ESR91 compiling with the JIT now and finishing some final touches before mounting the browser, so you might have more luck with that (modulo https://www.phoronix.com/scan.php?page=news_item&px=Web-Browser-Packages-Debian of course).

      Delete
  6. This is good news; thanks for your efforts!

    I'm waiting on a blackbird so I can't try any of this stuff out yet. Do you know if firefox on power9 can do all of the drm stuff to play video from amazon, disney, etc.? Or do those sort of things all require intel?

    ReplyDelete
    Replies
    1. Only if there is an open source version of those components (usually plugins) that you can add keys to, because I'm quite sure there aren't ppc64le binaries. I don't routinely work with such content, so I don't know what's out there.

      Delete

Post a Comment

Comments are subject to moderation. Be nice.