[GHC] #14880: GHC panic: updateRole

GHC ghc-devs at haskell.org
Tue Jul 17 10:30:57 UTC 2018


#14880: GHC panic: updateRole
-------------------------------------+-------------------------------------
        Reporter:  RyanGlScott       |                Owner:  goldfire
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler (Type    |              Version:  8.2.2
  checker)                           |
      Resolution:                    |             Keywords:  TypeInType
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Compile-time      |  Unknown/Multiple
  crash or panic                     |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  #15076            |  Differential Rev(s):  Phab:D4769
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by tdammers):

 Replying to [comment:37 simonpj]:
 > Can we compare the numbers with and without the patch?  That should show
 differences.

 And it does.

 Before patch:
 {{{
         Tue Jul 17 12:17 2018 Time and Allocation Profiling Report
 (Final)

            ghc-stage2 +RTS -p -RTS -B/home/tobias/well-typed/devel/ghc-
 phab/inplace/lib -c T5631.hs -fforce-recomp

         total time  =        1.28 secs   (1278 ticks @ 1000 us, 1
 processor)
         total alloc = 1,146,867,328 bytes  (excludes profiling overheads)

 COST CENTRE        MODULE     SRC
 %time %alloc

 tc_rn_src_decls    TcRnDriver
 compiler/typecheck/TcRnDriver.hs:(491,4)-(553,7)     40.7   55.4
 setSessionDynFlags GHC        compiler/main/GHC.hs:(578,1)-(584,16)
 8.7    0.7
 zonkTopDecls       TcRnDriver
 compiler/typecheck/TcRnDriver.hs:(442,16)-(443,43)    7.0    9.2
 tcRnSrcDecls       TcRnDriver compiler/typecheck/TcRnDriver.hs:255:25-65
 4.5    0.4
 writeIface         HscMain    compiler/main/HscMain.hs:1283:9-45
 3.4    0.2
 withCleanupSession GHC        compiler/main/GHC.hs:(466,1)-(475,37)
 2.9    0.1
 CorePrep           HscMain    compiler/main/HscMain.hs:(1317,24)-(1318,57)
 2.8    4.1
 deSugar            HscMain    compiler/main/HscMain.hs:512:7-44
 2.5    2.7
 pprNativeCode      AsmCodeGen
 compiler/nativeGen/AsmCodeGen.hs:(529,37)-(530,65)    2.3    1.9
 simplifyTop        TcRnDriver compiler/typecheck/TcRnDriver.hs:409:25-39
 1.6    2.3
 CoreTidy           HscMain    compiler/main/HscMain.hs:1257:27-67
 1.6    1.8

 [...]

                tc_rn_src_decls                   TcRnDriver
 compiler/typecheck/TcRnDriver.hs:(491,4)-(553,7)   1575          1   40.7
 55.4    42.8   57.3
                 Digraph.topSort                  Digraph
 compiler/utils/Digraph.hs:350:48-75                1586        341    0.0
 0.0     0.0    0.0
                 solveSimples                     TcInteract
 compiler/typecheck/TcInteract.hs:(241,5)-(242,21)  1587        266    0.0
 0.0     1.9    1.6
                  solve_loop                      TcInteract
 compiler/typecheck/TcInteract.hs:(246,9)-(250,44)  1589          0    1.5
 1.1     1.9    1.6
                   canNC                          TcCanonical
 compiler/typecheck/TcCanonical.hs:(84,5)-(90,45)   1590       1206    0.4
 0.5     0.4    0.5
                   canClass                       TcCanonical
 compiler/typecheck/TcCanonical.hs:98:5-31          1591         15    0.0
 0.0     0.0    0.0
                   canEqLeafTyVarEq               TcCanonical
 compiler/typecheck/TcCanonical.hs:105:5-39         1592          3    0.0
 0.0     0.0    0.0
                 Digraph.scc                      Digraph
 compiler/utils/Digraph.hs:285:44-67                1576         25    0.0
 0.0     0.0    0.0
                 bin_anns                         HscTypes
 compiler/main/HscTypes.hs:1093:47-56               1581         12    0.0
 0.0     0.0    0.0
                 bin_exports                      HscTypes
 compiler/main/HscTypes.hs:1088:50-55               1578         12    0.0
 0.0     0.0    0.0
                 bin_fam_insts                    HscTypes
 compiler/main/HscTypes.hs:1096:52-57               1584         12    0.0
 0.0     0.0    0.0
                 bin_fixities                     HscTypes
 compiler/main/HscTypes.hs:1091:51-56               1579         12    0.0
 0.0     0.0    0.0
                 bin_insts                        HscTypes
 compiler/main/HscTypes.hs:1095:48-53               1583         12    0.0
 0.0     0.0    0.0
                 bin_rules                        HscTypes
 compiler/main/HscTypes.hs:1097:48-57               1585         12    0.0
 0.0     0.0    0.0
                 bin_tycldecls                    HscTypes
 compiler/main/HscTypes.hs:1094:52-57               1582         12    0.2
 0.2     0.2    0.2
                 bin_usages                       HscTypes
 compiler/main/HscTypes.hs:1087:49-58               1577         12    0.0
 0.0     0.0    0.0
                 bin_warns                        HscTypes
 compiler/main/HscTypes.hs:1092:48-57               1580         12    0.0
 0.0     0.0    0.0
                 substTyWith                      TyCoRep
 compiler/types/TyCoRep.hs:(2191,23)-(2192,50)      1616          4    0.0
 0.0     0.0    0.0
 }}}

 After:

 {{{
 tc_rn_src_decls    TcRnDriver
 compiler/typecheck/TcRnDriver.hs:(491,4)-(553,7)     49.3   55.9
 zonkTopDecls       TcRnDriver
 compiler/typecheck/TcRnDriver.hs:(442,16)-(443,43)    7.6    8.7
 CorePrep           HscMain    compiler/main/HscMain.hs:(1317,24)-(1318,57)
 3.9    4.9
 deSugar            HscMain    compiler/main/HscMain.hs:512:7-44
 3.3    2.5
 setSessionDynFlags GHC        compiler/main/GHC.hs:(578,1)-(584,16)
 2.9    0.7
 CoreTidy           HscMain    compiler/main/HscMain.hs:1257:27-67
 2.2    2.3
 simplifyTop        TcRnDriver compiler/typecheck/TcRnDriver.hs:409:25-39
 2.1    2.2
 withCleanupSession GHC        compiler/main/GHC.hs:(466,1)-(475,37)
 2.1    0.1
 pprNativeCode      AsmCodeGen
 compiler/nativeGen/AsmCodeGen.hs:(529,37)-(530,65)    2.0    1.8
 Parser             HscMain    compiler/main/HscMain.hs:(317,5)-(385,20)
 1.7    2.6
 solve_loop         TcInteract
 compiler/typecheck/TcInteract.hs:(246,9)-(250,44)     1.6    1.1

 [...]


                tc_rn_src_decls                   TcRnDriver
 compiler/typecheck/TcRnDriver.hs:(491,4)-(553,7)   1584          1   49.3
 55.9    52.2   57.7
                 Digraph.topSort                  Digraph
 compiler/utils/Digraph.hs:350:48-75                1595        341    0.1
 0.0     0.1    0.0
                 solveSimples                     TcInteract
 compiler/typecheck/TcInteract.hs:(241,5)-(242,21)  1596        266    0.2
 0.0     2.5    1.5
                  solve_loop                      TcInteract
 compiler/typecheck/TcInteract.hs:(246,9)-(250,44)  1598          0    1.6
 1.0     2.3    1.5
                   canNC                          TcCanonical
 compiler/typecheck/TcCanonical.hs:(84,5)-(90,45)   1599       1206    0.7
 0.5     0.7    0.5
                   canClass                       TcCanonical
 compiler/typecheck/TcCanonical.hs:98:5-31          1600         15    0.0
 0.0     0.0    0.0
                   canEqLeafTyVarEq               TcCanonical
 compiler/typecheck/TcCanonical.hs:105:5-39         1601          3    0.0
 0.0     0.0    0.0
                 Digraph.scc                      Digraph
 compiler/utils/Digraph.hs:285:44-67                1585         25    0.0
 0.0     0.0    0.0
                 bin_anns                         HscTypes
 compiler/main/HscTypes.hs:1093:47-56               1590         12    0.0
 0.0     0.0    0.0
                 bin_exports                      HscTypes
 compiler/main/HscTypes.hs:1088:50-55               1587         12    0.0
 0.0     0.0    0.0
                 bin_fam_insts                    HscTypes
 compiler/main/HscTypes.hs:1096:52-57               1593         12    0.0
 0.0     0.0    0.0
                 bin_fixities                     HscTypes
 compiler/main/HscTypes.hs:1091:51-56               1588         12    0.0
 0.0     0.0    0.0
                 bin_insts                        HscTypes
 compiler/main/HscTypes.hs:1095:48-53               1592         12    0.0
 0.0     0.0    0.0
                 bin_rules                        HscTypes
 compiler/main/HscTypes.hs:1097:48-57               1594         12    0.0
 0.0     0.0    0.0
                 bin_tycldecls                    HscTypes
 compiler/main/HscTypes.hs:1094:52-57               1591         12    0.3
 0.2     0.3    0.2
                 bin_usages                       HscTypes
 compiler/main/HscTypes.hs:1087:49-58               1586         12    0.1
 0.0     0.1    0.0
                 bin_warns                        HscTypes
 compiler/main/HscTypes.hs:1092:48-57               1589         12    0.0
 0.0     0.0    0.0
                 substTyWith                      TyCoRep
 compiler/types/TyCoRep.hs:(2274,23)-(2275,50)      1625          4    0.0
 0.0     0.0    0.0
 }}}

 So apparently `tc_rn_src_decls` is responsible for the entire performance
 hit here, however the calls it makes that we track seem to be identical,
 and none of its children contributes significantly.

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


More information about the ghc-tickets mailing list