Changeset 201866 in webkit


Ignore:
Timestamp:
Jun 9, 2016 9:31:38 AM (8 years ago)
Author:
Chris Dumez
Message:

Unreviewed, rolling out r201836, r201845, and r201848.

Looks like a 1-2% PLT regression on iOS

Reverted changesets:

"[JSC] Change some parameters based on a random search"
https://bugs.webkit.org/show_bug.cgi?id=158514
http://trac.webkit.org/changeset/201836

"Tempory fix for the debug bots"
http://trac.webkit.org/changeset/201845

"Change thresholdForOptimizeSoon to match
thresholdForOptimizeAfterWarmUp"
http://trac.webkit.org/changeset/201848

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r201861 r201866  
     12016-06-09  Chris Dumez  <cdumez@apple.com>
     2
     3        Unreviewed, rolling out r201836, r201845, and r201848.
     4
     5        Looks like a 1-2% PLT regression on iOS
     6
     7        Reverted changesets:
     8
     9        "[JSC] Change some parameters based on a random search"
     10        https://bugs.webkit.org/show_bug.cgi?id=158514
     11        http://trac.webkit.org/changeset/201836
     12
     13        "Tempory fix for the debug bots"
     14        http://trac.webkit.org/changeset/201845
     15
     16        "Change thresholdForOptimizeSoon to match
     17        thresholdForOptimizeAfterWarmUp"
     18        http://trac.webkit.org/changeset/201848
     19
    1202016-06-09  Commit Queue  <commit-queue@webkit.org>
    221
  • trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp

    r201836 r201866  
    36173617double CodeBlock::optimizationThresholdScalingFactor()
    36183618{
    3619     // We want a good threshold based on the instruction count.
    3620     // Here, we are trying to optimize the following formula:
    3621     //     F[x_] =: a * Sqrt[x + b] + Abs[c * x] + d
     3619    // This expression arises from doing a least-squares fit of
    36223620    //
    3623     // The parameters were chosen by testing random values
    3624     // between 1 and 2 and keeping the best combination.
    3625     const double a = Options::optimizationThresholdScalingFactorA();
    3626     const double b = Options::optimizationThresholdScalingFactorB();
    3627     const double c = Options::optimizationThresholdScalingFactorC();
    3628     const double d = Options::optimizationThresholdScalingFactorD();
     3621    // F[x_] =: a * Sqrt[x + b] + Abs[c * x] + d
     3622    //
     3623    // against the data points:
     3624    //
     3625    //    x       F[x_]
     3626    //    10       0.9          (smallest reasonable code block)
     3627    //   200       1.0          (typical small-ish code block)
     3628    //   320       1.2          (something I saw in 3d-cube that I wanted to optimize)
     3629    //  1268       5.0          (something I saw in 3d-cube that I didn't want to optimize)
     3630    //  4000       5.5          (random large size, used to cause the function to converge to a shallow curve of some sort)
     3631    // 10000       6.0          (similar to above)
     3632    //
     3633    // I achieve the minimization using the following Mathematica code:
     3634    //
     3635    // MyFunctionTemplate[x_, a_, b_, c_, d_] := a*Sqrt[x + b] + Abs[c*x] + d
     3636    //
     3637    // samples = {{10, 0.9}, {200, 1}, {320, 1.2}, {1268, 5}, {4000, 5.5}, {10000, 6}}
     3638    //
     3639    // solution =
     3640    //     Minimize[Plus @@ ((MyFunctionTemplate[#[[1]], a, b, c, d] - #[[2]])^2 & /@ samples),
     3641    //         {a, b, c, d}][[2]]
     3642    //
     3643    // And the code below (to initialize a, b, c, d) is generated by:
     3644    //
     3645    // Print["const double " <> ToString[#[[1]]] <> " = " <>
     3646    //     If[#[[2]] < 0.00001, "0.0", ToString[#[[2]]]] <> ";"] & /@ solution
     3647    //
     3648    // We've long known the following to be true:
     3649    // - Small code blocks are cheap to optimize and so we should do it sooner rather
     3650    //   than later.
     3651    // - Large code blocks are expensive to optimize and so we should postpone doing so,
     3652    //   and sometimes have a large enough threshold that we never optimize them.
     3653    // - The difference in cost is not totally linear because (a) just invoking the
     3654    //   DFG incurs some base cost and (b) for large code blocks there is enough slop
     3655    //   in the correlation between instruction count and the actual compilation cost
     3656    //   that for those large blocks, the instruction count should not have a strong
     3657    //   influence on our threshold.
     3658    //
     3659    // I knew the goals but I didn't know how to achieve them; so I picked an interesting
     3660    // example where the heuristics were right (code block in 3d-cube with instruction
     3661    // count 320, which got compiled early as it should have been) and one where they were
     3662    // totally wrong (code block in 3d-cube with instruction count 1268, which was expensive
     3663    // to compile and didn't run often enough to warrant compilation in my opinion), and
     3664    // then threw in additional data points that represented my own guess of what our
     3665    // heuristics should do for some round-numbered examples.
     3666    //
     3667    // The expression to which I decided to fit the data arose because I started with an
     3668    // affine function, and then did two things: put the linear part in an Abs to ensure
     3669    // that the fit didn't end up choosing a negative value of c (which would result in
     3670    // the function turning over and going negative for large x) and I threw in a Sqrt
     3671    // term because Sqrt represents my intution that the function should be more sensitive
     3672    // to small changes in small values of x, but less sensitive when x gets large.
     3673   
     3674    // Note that the current fit essentially eliminates the linear portion of the
     3675    // expression (c == 0.0).
     3676    const double a = 0.061504;
     3677    const double b = 1.02406;
     3678    const double c = 0.0;
     3679    const double d = 0.825914;
    36293680   
    36303681    double instructionCount = this->instructionCount();
  • trunk/Source/JavaScriptCore/runtime/Options.h

    r201848 r201866  
    254254    v(double, jitPolicyScale, 1.0, Normal, "scale JIT thresholds to this specified ratio between 0.0 (compile ASAP) and 1.0 (compile like normal).") \
    255255    v(bool, forceEagerCompilation, false, Normal, nullptr) \
    256     v(int32, thresholdForJITAfterWarmUp, 373, Normal, nullptr) \
    257     v(int32, thresholdForJITSoon, 169, Normal, nullptr) \
    258     \
    259     v(int32, thresholdForOptimizeAfterWarmUp, 511, Normal, nullptr) \
    260     v(int32, thresholdForOptimizeAfterLongWarmUp, 885, Normal, nullptr) \
    261     v(int32, thresholdForOptimizeSoon, 511, Normal, nullptr) \
    262     v(int32, executionCounterIncrementForLoop, 2, Normal, nullptr) \
    263     v(int32, executionCounterIncrementForEntry, 28, Normal, nullptr) \
    264     \
    265     v(int32, thresholdForFTLOptimizeAfterWarmUp, 99566, Normal, nullptr) \
    266     v(int32, thresholdForFTLOptimizeSoon, 1566, Normal, nullptr) \
    267     v(int32, ftlTierUpCounterIncrementForLoop, 6, Normal, nullptr) \
    268     v(int32, ftlTierUpCounterIncrementForReturn, 13, Normal, nullptr) \
     256    v(int32, thresholdForJITAfterWarmUp, 500, Normal, nullptr) \
     257    v(int32, thresholdForJITSoon, 100, Normal, nullptr) \
     258    \
     259    v(int32, thresholdForOptimizeAfterWarmUp, 1000, Normal, nullptr) \
     260    v(int32, thresholdForOptimizeAfterLongWarmUp, 1000, Normal, nullptr) \
     261    v(int32, thresholdForOptimizeSoon, 1000, Normal, nullptr) \
     262    v(int32, executionCounterIncrementForLoop, 1, Normal, nullptr) \
     263    v(int32, executionCounterIncrementForEntry, 15, Normal, nullptr) \
     264    \
     265    v(int32, thresholdForFTLOptimizeAfterWarmUp, 100000, Normal, nullptr) \
     266    v(int32, thresholdForFTLOptimizeSoon, 1000, Normal, nullptr) \
     267    v(int32, ftlTierUpCounterIncrementForLoop, 1, Normal, nullptr) \
     268    v(int32, ftlTierUpCounterIncrementForReturn, 15, Normal, nullptr) \
    269269    v(unsigned, ftlOSREntryFailureCountForReoptimization, 15, Normal, nullptr) \
    270270    v(unsigned, ftlOSREntryRetryThreshold, 100, Normal, nullptr) \
    271271    \
    272     v(double, optimizationThresholdScalingFactorA, 0.1785461740514816, Normal, nullptr) \
    273     v(double, optimizationThresholdScalingFactorB, 1.2691392484494950, Normal, nullptr) \
    274     v(double, optimizationThresholdScalingFactorC, 0.0003675505121227, Normal, nullptr) \
    275     v(double, optimizationThresholdScalingFactorD, 1.5838284192987762, Normal, nullptr) \
    276     \
    277     v(int32, evalThresholdMultiplier, 8, Normal, nullptr) \
     272    v(int32, evalThresholdMultiplier, 10, Normal, nullptr) \
    278273    v(unsigned, maximumEvalCacheableSourceLength, 256, Normal, nullptr) \
    279274    \
  • trunk/Tools/ChangeLog

    r201863 r201866  
     12016-06-09  Chris Dumez  <cdumez@apple.com>
     2
     3        Unreviewed, rolling out r201836, r201845, and r201848.
     4
     5        Looks like a 1-2% PLT regression on iOS
     6
     7        Reverted changesets:
     8
     9        "[JSC] Change some parameters based on a random search"
     10        https://bugs.webkit.org/show_bug.cgi?id=158514
     11        http://trac.webkit.org/changeset/201836
     12
     13        "Tempory fix for the debug bots"
     14        http://trac.webkit.org/changeset/201845
     15
     16        "Change thresholdForOptimizeSoon to match
     17        thresholdForOptimizeAfterWarmUp"
     18        http://trac.webkit.org/changeset/201848
     19
    1202016-06-09  Michael Saboff  <msaboff@apple.com>
    221
  • trunk/Tools/Scripts/run-jsc-stress-tests

    r201836 r201866  
    429429BASE_OPTIONS = ["--useFTLJIT=false", "--useFunctionDotArguments=true"]
    430430EAGER_OPTIONS = ["--thresholdForJITAfterWarmUp=10", "--thresholdForJITSoon=10", "--thresholdForOptimizeAfterWarmUp=20", "--thresholdForOptimizeAfterLongWarmUp=20", "--thresholdForOptimizeSoon=20", "--thresholdForFTLOptimizeAfterWarmUp=20", "--thresholdForFTLOptimizeSoon=20", "--maximumEvalCacheableSourceLength=150000"]
    431 NO_CJIT_OPTIONS = ["--useConcurrentJIT=false", "--thresholdForJITAfterWarmUp=100", "--thresholdForJITSoon=100", "--thresholdForOptimizeAfterWarmUp=1000", "--thresholdForOptimizeAfterLongWarmUp=1000", "--thresholdForOptimizeSoon=1000", "--executionCounterIncrementForLoop=1", "--executionCounterIncrementForEntry=15", "--thresholdForFTLOptimizeAfterWarmUp=100000", "--thresholdForFTLOptimizeSoon=1000", "--ftlTierUpCounterIncrementForLoop=1", "--ftlTierUpCounterIncrementForReturn=15", "--evalThresholdMultiplier=10", "--optimizationThresholdScalingFactorA=0.061504", "--optimizationThresholdScalingFactorB=1.02406", "--optimizationThresholdScalingFactorC=0.0", "--optimizationThresholdScalingFactorD=0.825914"]
     431NO_CJIT_OPTIONS = ["--useConcurrentJIT=false", "--thresholdForJITAfterWarmUp=100"]
    432432FTL_OPTIONS = ["--useFTLJIT=true"]
    433433
Note: See TracChangeset for help on using the changeset viewer.