Project 'TerrorJack/ghc' was moved to 'haskell-wasm/ghc'. Please update any links and bookmarks that may still have the old path.
Make profiling work with multiple capabilities (+RTS -N)
This means that both time and heap profiling work for parallel programs. Main internal changes: - CCCS is no longer a global variable; it is now another pseudo-register in the StgRegTable struct. Thus every Capability has its own CCCS. - There is a new built-in CCS called "IDLE", which records ticks for Capabilities in the idle state. If you profile a single-threaded program with +RTS -N2, you'll see about 50% of time in "IDLE". - There is appropriate locking in rts/Profiling.c to protect the shared cost-centre-stack data structures. This patch does enough to get it working, I have cut one big corner: the cost-centre-stack data structure is still shared amongst all Capabilities, which means that multiple Capabilities will race when updating the "allocations" and "entries" fields of a CCS. Not only does this give unpredictable results, but it runs very slowly due to cache line bouncing. It is strongly recommended that you use -fno-prof-count-entries to disable the "entries" count when profiling parallel programs. (I shall add a note to this effect to the docs).
Showing
- compiler/cmm/CmmExpr.hs 5 additions, 1 deletioncompiler/cmm/CmmExpr.hs
- compiler/cmm/CmmLex.x 3 additions, 2 deletionscompiler/cmm/CmmLex.x
- compiler/cmm/CmmParse.y 3 additions, 2 deletionscompiler/cmm/CmmParse.y
- compiler/cmm/PprCmmExpr.hs 1 addition, 0 deletionscompiler/cmm/PprCmmExpr.hs
- compiler/codeGen/CgCase.lhs 1 addition, 1 deletioncompiler/codeGen/CgCase.lhs
- compiler/codeGen/CgClosure.lhs 4 additions, 3 deletionscompiler/codeGen/CgClosure.lhs
- compiler/codeGen/CgForeignCall.hs 2 additions, 2 deletionscompiler/codeGen/CgForeignCall.hs
- compiler/codeGen/CgProf.hs 11 additions, 11 deletionscompiler/codeGen/CgProf.hs
- compiler/codeGen/CgUtils.hs 5 additions, 1 deletioncompiler/codeGen/CgUtils.hs
- compiler/codeGen/StgCmmForeign.hs 2 additions, 2 deletionscompiler/codeGen/StgCmmForeign.hs
- compiler/codeGen/StgCmmProf.hs 7 additions, 8 deletionscompiler/codeGen/StgCmmProf.hs
- compiler/codeGen/StgCmmUtils.hs 6 additions, 2 deletionscompiler/codeGen/StgCmmUtils.hs
- includes/Cmm.h 1 addition, 1 deletionincludes/Cmm.h
- includes/RtsAPI.h 9 additions, 0 deletionsincludes/RtsAPI.h
- includes/mkDerivedConstants.c 1 addition, 0 deletionsincludes/mkDerivedConstants.c
- includes/rts/prof/CCS.h 4 additions, 3 deletionsincludes/rts/prof/CCS.h
- includes/stg/MiscClosures.h 0 additions, 1 deletionincludes/stg/MiscClosures.h
- includes/stg/Regs.h 1 addition, 0 deletionsincludes/stg/Regs.h
- rts/Apply.cmm 1 addition, 1 deletionrts/Apply.cmm
- rts/AutoApply.h 6 additions, 6 deletionsrts/AutoApply.h
Loading
Please register or sign in to comment