Opened 3 years ago

Last modified 9 months ago

#13346 new task

Run nofib with -fspec-constr-keen

Reported by: dfeuer Owned by:
Priority: normal Milestone: 8.10.1
Component: Compiler Version: 8.0.1
Keywords: SpecConstr Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description

Per Ben Gamari's comment on https://phabricator.haskell.org/D3186, we should try running nofib with -fspec-constr-keen.

Change History (9)

comment:1 Changed 2 years ago by bgamari

I quickly gave this a shot (testing with 140a2d1c463bd314c9afbeb8d60e739163ce576a). On the whole the results were surprisingly poor. In particular, allocations of several testcases increased markedly.

Here are the results,

--------------------------------------------------------------------------------
        Program           Size    Allocs   Runtime   Elapsed  TotalMem
--------------------------------------------------------------------------------
           anna          +5.5%     +3.5%     0.070     0.070      0.0%
           ansi          +0.2%     -0.0%     0.000     0.000      0.0%
           atom          +0.1%     +0.0%     0.147     0.147      0.0%
         awards          +0.4%     -0.0%     0.000     0.000      0.0%
         banner          +0.0%      0.0%     0.000     0.000      0.0%
     bernouilli          -0.0%     -0.0%     0.093     0.093      0.0%
   binary-trees           0.0%      0.0%     -0.2%     -0.2%      0.0%
          boyer          +0.6%     -2.1%     0.027     0.027      0.0%
         boyer2          +1.7%     +2.2%     0.006     0.006      0.0%
           bspt          +0.7%     +0.0%     0.007     0.007      0.0%
      cacheprof          +3.2%     +0.8%     +1.4%     +1.4%     +6.4%
       calendar           0.0%      0.0%     0.000     0.000      0.0%
       cichelli          +0.4%     +3.0%     0.052     0.052    +11.4%
        circsim          +0.3%     +0.7%     +0.3%     +0.3%      0.0%
       clausify          +0.0%     -3.8%     0.027     0.027      0.0%
  comp_lab_zift          -0.0%     -0.2%     0.112     0.112      0.0%
       compress          -0.1%     -0.0%     0.076     0.076      0.0%
      compress2          -0.0%     -0.0%     0.086     0.087     +3.8%
    constraints          +0.1%     -0.0%     -1.8%     -1.8%      0.0%
   cryptarithm1           0.0%      0.0%     +5.7%     +5.6%      0.0%
   cryptarithm2          +2.5%    +18.1%     0.008     0.008      0.0%
            cse           0.0%      0.0%     0.001     0.001      0.0%
   digits-of-e1           0.0%      0.0%     -0.1%     -0.1%      0.0%
   digits-of-e2           0.0%      0.0%     -2.3%     -2.2%      0.0%
          eliza          +0.5%     +0.0%     0.001     0.001      0.0%
          event          -0.0%     +0.1%     0.093     0.093      0.0%
         exp3_8          -0.0%      0.0%     0.102     0.102      0.0%
         expert          +1.0%     +0.2%     0.000     0.000      0.0%
 fannkuch-redux          +0.1%      0.0%     -0.8%     -0.8%      0.0%
          fasta          +0.1%     +1.6%     0.184     0.184      0.0%
            fem          +0.9%     +1.7%     0.016     0.016      0.0%
            fft          +0.0%     -0.1%     0.023     0.023      0.0%
           fft2           0.0%      0.0%     0.032     0.032      0.0%
       fibheaps          +0.5%     +4.0%     0.019     0.019      0.0%
           fish          -0.0%     -1.7%     0.008     0.008      0.0%
          fluid          +4.1%     +0.2%     0.006     0.006      0.0%
         fulsom          +1.4%     +0.1%     0.180     0.180      0.0%
         gamteb          -0.4%     +0.3%     0.024     0.024      0.0%
            gcd           0.0%      0.0%     0.028     0.028      0.0%
    gen_regexps          +0.2%      0.0%     0.000     0.000      0.0%
         genfft          +0.1%     +0.9%     0.021     0.021      0.0%
             gg          +1.3%     +1.7%     0.008     0.008      0.0%
           grep          -0.4%     -0.0%     0.000     0.000      0.0%
         hidden          +0.2%     +0.0%     +1.3%     +1.2%      0.0%
            hpg          +0.6%     -0.0%     0.076     0.076      0.0%
            ida          +0.8%     +0.7%     0.070     0.070   +166.7%
          infer          -0.3%     +4.1%     0.043     0.043    +27.3%
        integer          +0.1%     +6.6%     -1.3%     -1.3%      0.0%
      integrate          -0.0%     -0.0%     0.066     0.066      0.0%
   k-nucleotide          +0.6%     +0.0%     -1.6%     -1.6%      0.0%
          kahan           0.0%      0.0%     0.181     0.181      0.0%
        knights          +0.3%      0.0%     0.005     0.005      0.0%
         lambda          -0.0%      0.0%     -0.1%     -0.1%      0.0%
     last-piece          +1.4%     -1.4%     -2.0%     -2.0%      0.0%
           lcss          +0.3%     +0.0%     -4.7%     -4.8%      0.0%
           life          -0.0%     +0.0%     0.131     0.131      0.0%
           lift          +2.2%     +0.4%     0.001     0.001      0.0%
         linear          +0.3%     +0.0%     -0.1%     -0.1%      0.0%
      listcompr          +0.5%     -0.3%     0.061     0.061      0.0%
       listcopy          +0.5%     -0.3%     0.071     0.071      0.0%
       maillist           0.0%      0.0%     0.029     0.029     -0.4%
         mandel          +0.1%     -0.2%     0.049     0.049      0.0%
        mandel2           0.0%      0.0%     0.002     0.002      0.0%
           mate          +0.0%     -0.8%     -1.4%     -1.4%      0.0%
        minimax          +0.2%      0.0%     0.002     0.002      0.0%
        mkhprog           0.0%      0.0%     0.001     0.001      0.0%
     multiplier          +0.1%     +0.6%     0.070     0.070      0.0%
         n-body          -0.0%      0.0%     -0.0%     -0.1%      0.0%
       nucleic2          +0.1%     +0.1%     0.053     0.053      0.0%
           para          -0.3%     -0.7%     0.194     0.194      0.0%
      paraffins           0.0%      0.0%     0.065     0.065      0.0%
         parser          +4.7%     +0.0%     0.021     0.021      0.0%
        parstof          +0.9%    +10.6%     0.006     0.006      0.0%
            pic          +0.0%     +0.0%     0.005     0.005      0.0%
       pidigits          +0.2%     +0.0%     -1.5%     -1.7%    -20.0%
          power          +0.4%     +0.6%     -2.3%     -2.4%      0.0%
         pretty          +0.1%     +0.0%     0.000     0.000      0.0%
         primes           0.0%      0.0%     0.034     0.034      0.0%
      primetest          +0.1%     -0.2%     0.058     0.058      0.0%
         prolog          +0.3%     +0.0%     0.001     0.001      0.0%
         puzzle          +0.0%     -0.0%     0.097     0.097      0.0%
         queens           0.0%      0.0%     0.012     0.012      0.0%
        reptile          +0.2%     +0.0%     0.008     0.008      0.0%
reverse-complem           0.0%      0.0%     0.082     0.082      0.0%
        rewrite          +0.5%     -0.8%     0.016     0.016      0.0%
           rfib           0.0%      0.0%     0.013     0.013      0.0%
            rsa           0.0%      0.0%     0.016     0.016      0.0%
            scc          +0.6%     +0.7%     0.000     0.000      0.0%
          sched          +0.0%     -1.5%     0.018     0.018      0.0%
            scs          -0.1%     -0.0%     +1.0%     +1.0%      0.0%
         simple          +0.4%     +0.5%     0.102     0.102      0.0%
          solid          +0.2%     +0.0%     0.078     0.078      0.0%
        sorting          +0.3%      0.0%     0.001     0.001      0.0%
  spectral-norm           0.0%      0.0%     +0.2%     +0.2%      0.0%
         sphere          +0.2%     +0.4%     0.033     0.033      0.0%
         symalg          +0.2%      0.0%     0.007     0.007      0.0%
            tak           0.0%      0.0%     0.012     0.012      0.0%
      transform          -0.2%     +1.9%     -1.3%     -1.5%      0.0%
       treejoin          +0.3%     -1.1%     0.077     0.077      0.0%
      typecheck          -0.4%     +0.4%     0.161     0.161      0.0%
        veritas          +4.2%     -0.0%     0.001     0.001      0.0%
           wang          +0.0%     -0.5%     0.054     0.054      0.0%
      wave4main          +0.8%     -0.0%     0.191     0.191      0.0%
   wheel-sieve1          +0.0%     +0.0%     0.118     0.118      0.0%
   wheel-sieve2           0.0%      0.0%     0.105     0.105      0.0%
           x2n1           0.0%      0.0%     0.002     0.002      0.0%
--------------------------------------------------------------------------------
            Min          -0.4%     -3.8%     -4.7%     -4.8%    -20.0%
            Max          +5.5%    +18.1%     +5.7%     +5.6%   +166.7%
 Geometric Mean          +0.4%     +0.5%     -0.5%     -0.6%     +1.1%

Last edited 2 years ago by bgamari (previous) (diff)

comment:2 Changed 2 years ago by bgamari

I had a brief look at the Core and ticky profiles for one of the larger regressors, cryptarithm2, but unfortunately the differences are quite great so it's hard to tell precisely what is going wrong. I'm going to put this aside for now; at least we have characterized the situation.

comment:3 Changed 2 years ago by bgamari

Milestone: 8.2.18.4.1

Given that 8.2.1-rc1 is imminent, I'm bumping these off to the 8.4

comment:4 Changed 2 years ago by mpickering

Increased allocations could be due to reboxing as described in section 6.1 of the original paper.

In a few experiments, it does seem that flag causes quite aggressive optimisation in the case of static arguments.

For example:

main = drop 2 [1,2,3]

leads to

-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
Foo.main1 :: Integer
[GblId,
 Caf=NoCafRefs,
 Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
         WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 100 0}]
Foo.main1 = 3

-- RHS size: {terms: 3, types: 2, coercions: 0, joins: 0/0}
main :: [Integer]
[GblId,
 Caf=NoCafRefs,
 Str=m2,
 Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
         WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 30}]
main = GHC.Types.: @ Integer Foo.main1 (GHC.Types.[] @ Integer)

Notice that drop has been fully evaluated even though it is self-recursive.

comment:5 Changed 2 years ago by mpickering

Keywords: SpecConstr added

comment:6 Changed 20 months ago by bgamari

Milestone: 8.4.18.6.1

This ticket won't be resolved in 8.4; remilestoning for 8.6. Do holler if you are affected by this or would otherwise like to work on it.

comment:7 Changed 15 months ago by bgamari

This will not be addressed in GHC 8.6.

comment:8 Changed 15 months ago by bgamari

Milestone: 8.6.18.8.1

These will not be addressed in GHC 8.6.

comment:9 Changed 9 months ago by osa1

Milestone: 8.8.18.10.1

Bumping milestones of low-priority tickets.

Note: See TracTickets for help on using tickets.