Bug 150279

Summary: FTL should use B3 as its backend
Product: WebKit Reporter: Filip Pizlo <fpizlo>
Component: JavaScriptCoreAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: benjamin, ggaren, jfbastien, luke, ossy, ysuzuki
Priority: P2    
Version: WebKit Nightly Build   
Hardware: All   
OS: All   
See Also: https://bugs.webkit.org/show_bug.cgi?id=153478
Bug Depends on: 150280, 150430, 150454, 150456, 150480, 150507, 150511, 150527, 150533, 150534, 150535, 150540, 150559, 150651, 150657, 150685, 150688, 150720, 150721, 150726, 150727, 150749, 150750, 150751, 150759, 150762, 150764, 150775, 150777, 150794, 150827, 150828, 150831, 150845, 150878, 150903, 150991, 150994, 151008, 151043, 151045, 151114, 151115, 151124, 151128, 151146, 151174, 151177, 151209, 151213, 151214, 151230, 151316, 151321, 151350, 151370, 151423, 151428, 151531, 151667, 151736, 151777, 151808, 151955, 151980, 152105, 152184, 152198, 152202, 152222, 152281, 152358, 152360, 152365, 152425, 152468, 152484, 152493, 152512, 152514, 152519, 152521, 152530, 152539, 152572, 152579, 152743, 152745, 152754, 152756, 152770, 152901, 152909, 152916, 152922, 152925, 152934, 152951, 152963, 153113, 153213, 153286, 153313, 153338, 153394, 153422, 153445, 153477, 153491, 153511, 153546, 153583, 153658, 153674, 153714, 153802, 154020, 154124    
Bug Blocks: 154319    
Attachments:
Description Flags
current performance, before tuning none

Description Filip Pizlo 2015-10-17 11:22:08 PDT
This will be fun.
Comment 1 Filip Pizlo 2016-01-05 10:11:05 PST
Current status:

- It runs a lot of JS code, but not all of it.  It usually runs it a bit slower than if it was compiled with LLVM.  The largest single benchmark slowdown is ~25% on mandreel, and the largest single benchmark speed-up is ~15% on imaging-gaussian-blur.  More than half of the benchmarks are neutral, but the slowdowns currently dominate.  We think we know all of the optimizations that we are missing, and most of them are trivial (like missing instruction selection patterns and missing strength reduction rules).

- Still need to finish gluing our FTL exception implementation to B3's notion of patchpoints.  Currently any code that uses exceptions in FTL B3 will crash or do strange things, because most of the exception paths are unimplemented.

- Still need to finish fixing the tailcall implementation.  It works for simple cases, but encounters an assertion in the callframe shuffler.  I haven't investigated this yet.

- ARM64 is being worked on, but it's not done, yet.

- We anticipate having to implement some more sophisticated optimizations in B3, like load elimination, tail duplication, CSE with Phi insertion, sinking, and probably LSR.  We don't think that we will need all of them, but probably some of them, to meet our performance goals.

- We anticipate having to beef up how the register allocator handles pressure.  Currently it does the classic kind of spilling where every access to a spilled temporary turns into a stack access.  That's suboptimal.  My current thinking is that we want something like what GCC calls "reload", but much more focused on spill handling and rematerialization.  Rematerialization is a big deal because the way JSC works, we end up with a lot of large constants, and they are easier to remat than spill.

We'll approach this by first filling in all coverage and getting FTL B3 to pass all tests.  We're not there yet, but it will probably happen soon - maybe even this week.  Then, we'll optimize the heck out of it.  We can turn on FTL B3, and remove FTL LLVM, if and when our Octane, JetStream, and Kraken scores with FTL B3 are as good as with FTL LLVM.  It's still possible (but unlikely) that we won't get there, in which case we can explore other options, like slotting FTL B3 in as a middle tier.
Comment 2 Filip Pizlo 2016-01-08 16:39:03 PST
As of http://trac.webkit.org/changeset/194805, FTL B3 passes all JSC tests on Mac.
Comment 3 Filip Pizlo 2016-01-09 17:03:24 PST
Created attachment 268633 [details]
current performance, before tuning
Comment 4 Filip Pizlo 2016-01-25 12:51:20 PST
As of http://trac.webkit.org/changeset/195549, FTL B3 is as fast as FTL LLVM on X86_64.  We can still make FTL B3 even better, but at this point, we should enable it on trunk on X86_64.
Comment 5 Filip Pizlo 2016-02-15 16:26:29 PST
*** Bug 118400 has been marked as a duplicate of this bug. ***
Comment 6 Filip Pizlo 2016-02-15 16:27:41 PST
*** Bug 127245 has been marked as a duplicate of this bug. ***
Comment 7 Filip Pizlo 2016-02-16 18:20:57 PST
B3 is now enabled on all platforms that support the FTL JIT.
Comment 8 Filip Pizlo 2016-02-16 18:21:40 PST
Comment on attachment 268633 [details]
current performance, before tuning

We've sped up a lot since then.  See the blog post for latest perf numbers.
Comment 9 Filip Pizlo 2016-02-16 18:30:14 PST
FTL does use B3 as a backend!  Yaaayyyy!