Add flags that allow for optional inclusion of stack frame info tables and info tables with defaulted source locations in the info table map
Fixes #23702 (closed)
Introduces -finfo-table-map-with-stack
and -finfo-table-map-with-fallback
flags, implied by -finfo-table-map
. Respectively, these flags result in the inclusion of STACK
info tables and info tables for which no provenance exists in the program source in the info table map. The negative versions of these flags (-fno-info-table-map-with-stack
, -fno-info-table-map-with-fallback
) are useful for reducing the size of build results with info table profiling information.
In testing on the Agda codebase, omitting STACK
and fallback tables shrunk build results by about 10% (118M down to 105M). This was tested by running
cabal build Agda:exe:agda --ghc-options="-Wno-x-partial -Wno-deprecations -finfo-table-map
and then
du -hc dist-newstyle/build/aarch64-osx/ghc-9.9.20230720/Agda-2.6.4/build/**/*.o
then repeating with -fno-info-table-map-with-stack
and -fno-info-table-map-with-fallback
.
This MR also significantly refactors the construction of the info table map, and derives an Ord
instance for CmmInfoTable
so it could be used as a key in a Data.Map.Map
.
Merge request reports
Activity
assigned to @FinleyMcIlwaine
- Resolved by Finley McIlwaine
@mpickering should I add a test for this? I left the skipped count in the IPE stats because I actually found it useful while testing this. I also made sure it was properly tracked even with the skipping of stack tables in
generateCgIPEStub
.
- Resolved by Finley McIlwaine
I think it's better if
-finfo-table-map
implies-finfo-table-map-fallback
and-finfo-table-map-with-stack
so that the old behaviour is maintained after this patch. Then if you don't want these parts of the info table map you can write-fno-info-table-map-fallback
and-fno-info-table-map-with-stack
.That is how I implemented the patch the first time so do you disagree?
added 1 commit
- 9237c77f - Add -finfo-table-map-omit-fallback -finfo-table-map-omit-stack
added 1 commit
- 5d6137c6 - Add -finfo-table-map-omit-fallback -finfo-table-map-omit-stack
added 1 commit
- 8f9554b8 - Add -finfo-table-map-omit-fallback -finfo-table-map-omit-stack
added 1 commit
- 8248bef4 - Add -finfo-table-map-with-fallback -finfo-table-map-with-stack
added 1 commit
- 4cca7a11 - Add -finfo-table-map-with-fallback -finfo-table-map-with-stack
added 19 commits
-
4cca7a11...a7349217 - 17 commits from branch
master
- 202641b3 - Add -dipe-stats flag
- 56606da4 - Add -finfo-table-map-with-fallback -finfo-table-map-with-stack
-
4cca7a11...a7349217 - 17 commits from branch
added 1 commit
- da89ae76 - Add -finfo-table-map-with-fallback -finfo-table-map-with-stack
added 14 commits
-
da89ae76...bb408936 - 12 commits from branch
master
- 96816683 - Add -dipe-stats flag
- 27a472d4 - Add -finfo-table-map-with-fallback -finfo-table-map-with-stack
-
da89ae76...bb408936 - 12 commits from branch
added 1 commit
- 2e7f7466 - Add -finfo-table-map-with-fallback -finfo-table-map-with-stack
mentioned in merge request !10958
1 [1 of 1] Compiling Control.Lens.Fold ( Fold.hs, Fold.o ) 2 3 ==================== IPE Stats for module Control.Lens.Fold ==================== changed this line in version 11 of the diff
635 instance Outputable IPEStats where 636 ppr = pprIPEStats 637 638 pprIPEStats :: IPEStats -> SDoc 639 pprIPEStats (IPEStats{..}) = 640 vcat $ [ text "Tables with info:" <+> ppr ipe_total 641 , text "Tables with fallback:" <+> ppr ipe_fallback 642 , text "Tables skipped:" <+> ppr ipe_skipped 643 ] ++ [ text "Info(" <> ppr k <> text "):" <+> ppr n | (k, n) <- I.assocs ipe_closure_types ] 644 610 645 -- | Convert source information collected about identifiers in 'GHC.STG.Debug' 611 646 -- to entries suitable for placing into the info table provenance table. 612 convertInfoProvMap :: [CmmInfoTable] -> Module -> InfoTableProvMap -> [InfoProvEnt] 613 convertInfoProvMap defns this_mod (InfoTableProvMap (UniqMap dcenv) denv infoTableToSourceLocationMap) = 614 map (\cmit -> 647 convertInfoProvMap :: StgToCmmConfig -> Module -> InfoTableProvMap -> (IPEStats, [InfoProvEnt]) -> CmmInfoTable -> (IPEStats, [InfoProvEnt]) This function is folded over a
[CmmInfoTable]
ininitInfoTableProv
, accumulating bothInfoProvEnt
s andIPEStats
. The accumulated entries are given toemitIpeBufferListNode
. The stats may contain counts per closure type as well, as the fold progresses. Though initially they will only contain skipped stack tables. I've added some comments to make this clearer in the code!changed this line in version 13 of the diff