[GHC] #15113: Do not make CAFs from literal strings

GHC ghc-devs at haskell.org
Mon Oct 1 14:44:47 UTC 2018


#15113: Do not make CAFs from literal strings
-------------------------------------+-------------------------------------
        Reporter:  simonpj           |                Owner:  (none)
            Type:  bug               |               Status:  patch
        Priority:  normal            |            Milestone:  8.8.1
       Component:  Compiler          |              Version:  8.2.2
      Resolution:                    |             Keywords:  CAFs
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):  Phab:D4717
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by osa1):

 I managed to get nofib running. Here's an example output for runtime SRT
 traversals:

 {{{
 NoFib Results

 --------------------------------------------------------------------------------
         Program           Size    Allocs   Runtime   Elapsed  TotalMem
 SRTScavs
 --------------------------------------------------------------------------------
 ...
         circsim           0.0%      0.0%      0.0%      0.0%      0.0%
 0.0%
        clausify           0.0%      0.0%     0.013     0.013      0.0%
 0.0%
   comp_lab_zift           0.0%      0.0%     0.068     0.068      0.0%
 0.0%
        compress           0.0%      0.0%     0.054     0.054      0.0%
 0.0%
       compress2           0.0%      0.0%     0.047     0.047      0.0%
 0.0%
     constraints           0.0%      0.0%      0.0%      0.0%      0.0%
 0.0%
 ...


 Scavenged SRTs

 -------------------------------------------------------------------------------
         Program            nofib-log        nofib-log
 -------------------------------------------------------------------------------
              CS                  627             0.0%
             CSD                  622             0.0%
              FS                  629             0.0%
               S             16363319             0.0%
              VS                 2529             0.0%
             VSD                  310             0.0%
             VSM                  628             0.0%
            anna                 7951             0.0%
            ansi                  310             0.0%
            atom                 2102             0.0%
          awards                  310             0.0%
 ...
 }}}

 (all 0.0% becuase I used same file twice to run nofib-analyse)

 I have another program to parse compile-time numbers and generate this:

 {{{
 PGM                  | SRTs  | SRT size
 fluid                | 5     | 25
 wave4main            | 25    | 112
 integer              | 17    | 74
 ...
 }}}

 The code is here: https://github.com/osa1/nofib/tree/print_srt_stuff

 I also have a GHC branch that implements a new flag `-favoid-
 cafs=[0|1|2|3]` where 0 means compile as before, 1 means avoid making CAFs
 for top-level `unpackCString#`s, 2 means in addition to 1 avoid making
 CAFs for non-top-level `unpackCString#`s, 3 means in addition to 2 avoid
 making CAFs for CONLIKEs too. Code is here:
 https://github.com/osa1/ghc/tree/print_srt_stuff

 However for some reason the flag doesn't actually change number of SRTs or
 SRT sizes. I don't know why yet, I'll debug further. I think it may be
 because it's too late to change CAFFY-ness of values in CoreToStg
 (remember that CAFFY-enss of values are computed in CorePrep, which is
 before CoreToStg). I'll debug further.

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15113#comment:7>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list