[GHC] #15891: Excessive system time during execution of GHC-built executables on macOS

#15891: Excessive system time during execution of GHC-built executables on macOS ----------------------------------------+--------------------------------- Reporter: goldfire | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.6.3 Component: Compiler | Version: 8.6.2 Keywords: | Operating System: MacOS X Architecture: Unknown/Multiple | Type of failure: None/Unknown Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: ----------------------------------------+--------------------------------- It seems that the executables built by GHC on my configuration of macOS are slow, clocking in 80% of my machine's cycles in system time. Here is what I know. - Everything tested bootstrapping with both GHC 8.6.1 and GHC 8.6.2. There is no observable difference between these bootstrapping compilers. The detailed data reported is all from GHC 8.6.1. - When I try to build GHC, stage 1 builds snappily. But once stage-1 gets used, it slows to a crawl. - Activity Monitor reports that my computer is spending roughly 80% of its time in the System space, not the User space. (While building ghc-stage1 itself, there is barely any system activity.) - I have sampled ghc-stage1 during a rts_dist_HC call. Samples are at https://gist.github.com/goldfirere/7316920ad37d776c25c15dbb0ed5996f - I then `dtruss`d the same, with output at https://gist.github.com/goldfirere/621ce9072e1204d30e96e7daecc80d02 - System information: * macOS High Sierra, 10.13.6 * Processor: 3.5 GHz Intel Core i5 * Memory: 16 GB 2400 MHz DDR4 * SSD main storage, formatted with APFS * happy 1.19.9 * alex 3.2.4 * XCode 10.1 * gcc is clang-1000.11.45.5, Apple LLVM version 10.0.0, thread model: posix Others (see [https://mail.haskell.org/pipermail/ghc- devs/2018-November/016507.html thread]) have not been able to repro, but this is very reliable for me. Any ideas? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15891 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15891: Excessive system time during execution of GHC-built executables on macOS ---------------------------------+---------------------------------------- Reporter: goldfire | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.6.3 Component: Compiler | Version: 8.6.2 Resolution: | Keywords: Operating System: MacOS X | Architecture: Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | ---------------------------------+---------------------------------------- Changes (by gridaphobe): * cc: gridaphobe (added) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15891#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15891: Excessive system time during execution of GHC-built executables on macOS ---------------------------------+---------------------------------------- Reporter: goldfire | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.6.3 Component: Compiler | Version: 8.6.2 Resolution: | Keywords: Operating System: MacOS X | Architecture: Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | ---------------------------------+---------------------------------------- Changes (by maoe): * cc: maoe (added) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15891#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15891: Excessive system time during execution of GHC-built executables on macOS ---------------------------------+---------------------------------------- Reporter: goldfire | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.6.3 Component: Compiler | Version: 8.6.2 Resolution: | Keywords: Operating System: MacOS X | Architecture: Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | ---------------------------------+---------------------------------------- Comment (by goldfire): I'm glad to see some folks are cc'ing themselves to this ticket, so it's of more general interest. If anyone has observed similar behavior on their own machines, that would be incredibly helpful. Right now, my machine is the only known example of this phenomenon, and so it's quite hard to know where to look. If the problem can be repro'd elsewhere, then we'd really have something to go on. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15891#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15891: Excessive system time during execution of GHC-built executables on macOS ---------------------------------+---------------------------------------- Reporter: goldfire | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.6.3 Component: Compiler | Version: 8.6.2 Resolution: | Keywords: Operating System: MacOS X | Architecture: Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | ---------------------------------+---------------------------------------- Comment (by gridaphobe): I'm noticing similar behavior on my macbook. System information: {{{ macOS Mojave, 10.14 Processor: 2.6 GHz Intel Core i7 Memory: 16 GB 2133 MHz LPDDR3 SSD main storage, formatted with APFS happy 1.19.9 alex 3.2.4 gcc is clang-1000.11.45.5, Apple LLVM version 10.0.0, thread model: posix bootstrap ghc is 8.4.4 BuildFlavour = devel2 }}} Just like Richard, the stage1 build is snappy, but things slow down when I start using ghc-stage1. I also noticed a sudden jump to 40% system time (compared to 10% user time and 50% idle) when I started using ghc-stage1. I'm not sure how to sample ghc, but I ran the [https://gist.github.com/gridaphobe/dd3df6616720c571548584160912b950 dtruss command]. I don't really know what to make of the dtruss output, but I'm happy to run any other suggested tests. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15891#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15891: Excessive system time during execution of GHC-built executables on macOS ---------------------------------+---------------------------------------- Reporter: goldfire | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.6.3 Component: Compiler | Version: 8.6.2 Resolution: | Keywords: Operating System: MacOS X | Architecture: Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | ---------------------------------+---------------------------------------- Comment (by goldfire): I should add a few details, inspired by comment:4 - My BuildFlavour = devel2 - Used `make -j5` I needed to `chmod u+s` `dtruss` to get it to work... but then, later, had trouble and so had to revert this change. Just posting here to avoid @gridaphobe problems later. To sample, I ran `sample ghc-stage1` while GHC was compiling in another terminal session. Glad to know I'm not alone here! -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15891#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15891: Excessive system time during execution of GHC-built executables on macOS ---------------------------------+---------------------------------------- Reporter: goldfire | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.6.3 Component: Compiler | Version: 8.6.2 Resolution: | Keywords: Operating System: MacOS X | Architecture: Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | ---------------------------------+---------------------------------------- Comment (by gridaphobe): So I tried a build with gcc as the C compiler, to see if the issue was somehow related to Apple's build of clang. I kicked it off with {{{
./configure CC=gcc-8 # installed with `brew` ... Configure completed successfully.
Building GHC version : 8.7.20181114 Git commit id : 89fa34ecd326de879145e6d854306eb17722bf6c Build platform : x86_64-apple-darwin Host platform : x86_64-apple-darwin Target platform : x86_64-apple-darwin Bootstrapping using : /usr/local/bin/ghc which is version : 8.4.4 Using (for bootstrapping) : clang # why? Using gcc : gcc-8 which is version : 8.2.0 Building a cross compiler : NO Unregisterised : NO hs-cpp : gcc-8 hs-cpp-flags : -E -undef -traditional ar : ar ld : ld nm : nm libtool : libtool objdump : objdump ranlib : ranlib windres : dllwrap : genlib : Happy : /Users/eseidel13/.local/bin/happy (1.19.9) Alex : /Users/eseidel13/.local/bin/alex (3.2.4) Perl : /usr/bin/perl sphinx-build : xelatex : Using LLVM tools clang : clang llc : opt : HsColour : /Users/eseidel13/.cabal/bin/HsColour Tools to build Sphinx HTML documentation available: NO Tools to build Sphinx PDF documentation available: NO }}} Curiously, even though I specified `CC=gcc-8`, the build insists on using `clang` for some portion of bootstrapping. I'm not sure what exactly that means. The build of `ghc-stage1` went smoothly, as before, but I again started to notice a major uptick in system time once ghc-stage1 was used. The build also failed during the RTS portion, with {{{ rts_dist_HC rts/dist/build/StgCRun.o <unknown>:0:0: error: error: this directive must appear between .cfi_startproc and .cfi_endproc directives }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15891#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15891: Excessive system time during execution of GHC-built executables on macOS ---------------------------------+---------------------------------------- Reporter: goldfire | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.6.3 Component: Compiler | Version: 8.6.2 Resolution: | Keywords: Operating System: MacOS X | Architecture: Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | ---------------------------------+---------------------------------------- Comment (by gridaphobe): Ah, I just noticed there's a separate `CC_STAGE0` flag that controls the bootstrapping C compiler. I rebuilt GHC with gcc as the bootstrapping C compiler, but it didn't seem to change anything. I did manage to collect a sample of ghc-stage1 this time though. https://gist.github.com/gridaphobe/2ce36816c41568b4317173d016dc73c0 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15891#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC