Skip to content

Previous iteration of simplifier kept alive throughout next iteration

If we consult this eras profile, which is zoomed in to show one iteration of the simplifier, we can see that the brown band (result of previous iteration), is retained throughout the whole of the next simplifier iteration.

2024-01-11-124722_868x735

After inspecting this in ghc-debug this is because the name_ppr_ctx which is bound at the start of do_core_pass contains a reference to the ModGuts of the previous iteration. Forcing this field access before commencing the iteration leads to an improvement in memory behaviour.

   let updateBindsM f = f (mg_binds guts) >>= \b' -> return $ guts { mg_binds = b' }
+      !rdr_env = mg_rdr_env guts
   let name_ppr_ctx =
         mkNamePprCtx
           (initPromotionTickContext dflags)
           (hsc_unit_env hsc_env)
-          (mg_rdr_env guts)
+          rdr_env

After the change, see the yellow band, is released half-way through the phase.

2024-01-11-125020_790x733

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information