Bug 167460 - Why doesn't mandelbrot.js FTL?
Summary: Why doesn't mandelbrot.js FTL?
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on: 167149 172216
Blocks:
  Show dependency treegraph
 
Reported: 2017-01-26 12:04 PST by JF Bastien
Modified: 2018-07-11 01:36 PDT (History)
8 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description JF Bastien 2017-01-26 12:04:56 PST
I added a mandelbrot test in #167149 because I wanted something with nested loops and not just int32.

This happens:

$ ./current-release/bin/jsc ./JSTests/microbenchmarks/mandelbrot.js --useConcurrentJIT=0 -p a && ./Tools/Scripts/display-profiler-output a
    CodeBlock     #Instr          Source Counts                 Machine Counts        #Compil  Inlines  #Exits   Last Opts                                                   Source                                                
                               Base/DFG/FTL/FTLOSR           Base/DFG/FTL/FTLOSR              Src/Total         Get/Put/Call
mandelbrot#DoqaAb  579          50989/4078434/0/0             50989/4078434/0/0          4       0/0      15       4/0/4     function mandelbrot(x, y, w, h, scene_i, scene_z, X, Y, iterations) { const max_z = 2.0; for (let i = 
  shade#Eqog0q     118             67/6301/0/0                   67/1911/0/0             2       2/2       0       1/0/1     function i => shades[Math.round((i * (shades.length - 1)) / max_s)]
 <global>#DMGh43   779            2543/3507/0/0                 2543/3507/0/0            2       0/0       1       3/0/3     const max_s = 255; const hysterisis = 3; function mandelbrot(x, y, w, h, scene_i, scene_z, X, Y, itera
printable#EmK4D0   135            1524/4390/0/0                 1524/4390/0/0            2       1/1       0       1/0/2     function printable(scene_i, scene_z, X, Y) { let s = ""; for (let i = 0; i < X; ++i) { for (let j = 0;
    of#A2awz5      114               0/0/0/0                       0/0/0/0               0       0/0       0        N/A      function () { "use strict"; var length = arguments.length; var array = @isConstructor(this) ? new this
   fill#AXPfsF     231               0/0/0/0                       0/0/0/0               0       0/0       0        N/A      function (value ) { "use strict"; if (this == null) @throwTypeError("Array.prototype.fill requires tha
 toLength#ESso8n    59               0/0/0/0                       0/0/0/0               0       0/0       0        N/A      function (target) { "use strict"; var length = @toInteger(target); return length > 0 ? (length < @MAX_
toInteger#BxMpe8    74               0/0/0/0                       0/0/0/0               0       0/0       0        N/A      function (target) { "use strict"; var numberValue = @Number(target); if (numberValue !== numberValue) 
> l mandelbrot
Compilation mandelbrot#DoqaAb-1-Baseline:
    Total count: 3155511  Max count: 50989
Compilation mandelbrot#DoqaAb-2-DFG:
    Total count: 530545  Max count: 5413
    EXIT: at bc#228 due to InadequateCoverage, 5 times
    Jettisoned due to BaselineLoopReoptimizationTrigger
Compilation mandelbrot#DoqaAb-3-DFG:
    Total count: 1146246  Max count: 22805
    EXIT: at bc#311 due to Overflow, 10 times
    Jettisoned due to BaselineLoopReoptimizationTrigger
Compilation mandelbrot#DoqaAb-4-DFG:
    Total count: 118896069  Max count: 4050216



That's not cool. Mandelbrot only has Number and some int32 coercion. Exit due to overflow isn't a good reason to not FTL here.

I'll investigate this at some point in time. It's not a rush, but good to fix.
Comment 1 Filip Pizlo 2017-01-26 12:18:33 PST
--verboseFTLFailure=true
Comment 2 JF Bastien 2017-01-26 12:48:29 PST
(In reply to comment #1)
> --verboseFTLFailure=true

Ah nice.

FTL rejecting node in mandelbrot#DoqaAb:[0x111984dc0->0x111984b90->0x111994c80, NoneFunctionCall, 579]:
     349:<!0:->	GetByVal(KnownCell:@342, Int32:@317, Untyped:@698, JS|MustGen|UseAsInt, Boolint32Other, ArrayStorage+OriginalArray+OutOfBounds+AsIs, R:World, W:Heap, Exits, ClobbersExit, bc#322)  predicting Boolint32Other
FTL rejecting node in printable#EmK4D0:[0x111985ae0->0x111985450->0x111994d20, NoneFunctionCall, 135]:
      94:<!0:->	GetByVal(KnownCell:@93, Int32:@74, Untyped:@313, JS|MustGen, Boolint32, ArrayStorage+OriginalArray+InBounds+AsIs, R:Butterfly_vectorLength,IndexedArrayStorageProperties, Exits, bc#65)  predicting Boolint32
FTL rejecting <global>#DMGh43:[0x111985d10->0x1119840a0->0x111994be0, NoneGlobal, 779] because it doesn't belong to a function.
Comment 3 Yusuke Suzuki 2017-05-22 00:06:24 PDT
(In reply to JF Bastien from comment #2)
> (In reply to comment #1)
> > --verboseFTLFailure=true
> 
> Ah nice.
> 
> FTL rejecting node in
> mandelbrot#DoqaAb:[0x111984dc0->0x111984b90->0x111994c80, NoneFunctionCall,
> 579]:
>      349:<!0:->	GetByVal(KnownCell:@342, Int32:@317, Untyped:@698,
> JS|MustGen|UseAsInt, Boolint32Other,
> ArrayStorage+OriginalArray+OutOfBounds+AsIs, R:World, W:Heap, Exits,
> ClobbersExit, bc#322)  predicting Boolint32Other
> FTL rejecting node in
> printable#EmK4D0:[0x111985ae0->0x111985450->0x111994d20, NoneFunctionCall,
> 135]:
>       94:<!0:->	GetByVal(KnownCell:@93, Int32:@74, Untyped:@313, JS|MustGen,
> Boolint32, ArrayStorage+OriginalArray+InBounds+AsIs,
> R:Butterfly_vectorLength,IndexedArrayStorageProperties, Exits, bc#65) 
> predicting Boolint32
> FTL rejecting <global>#DMGh43:[0x111985d10->0x1119840a0->0x111994be0,
> NoneGlobal, 779] because it doesn't belong to a function.

https://bugs.webkit.org/show_bug.cgi?id=172216
Comment 4 Yusuke Suzuki 2017-05-22 00:07:15 PDT
PutByVal support is also necessary.
Comment 5 Yusuke Suzuki 2018-07-11 01:36:53 PDT
We support it now :)