[GHC] #13900: Core lint in BuildFlavour=perf-llvm

#13900: Core lint in BuildFlavour=perf-llvm -------------------------------------+------------------------------------- Reporter: bgamari | Owner: (none) Type: bug | Status: new Priority: high | Milestone: 8.4.1 Component: Compiler | Version: 8.3 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: Compile-time Unknown/Multiple | crash or panic Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- I found the following Core lint failure when compiling c9977385dca9536f18374242f713b1048a38dec5 with `BuildFlavour=perf-llvm`, {{{ "inplace/bin/ghc-stage1" -hisuf dyn_hi -osuf dyn_o -hcsuf dyn_hc -fPIC -dynamic -O -H64m -fllvm -Wall -hide-all-packages -i -ighc/. -ighc/stage2/build -Ighc/stage2/build -ighc/stage2/build/ghc/autogen -Ighc/stage2/build/ghc/autogen -optP-DGHCI -optP-include -optPghc/stage2/build/ghc/autogen/cabal_macros.h -package-id base-4.10.0.0 -package-id array-0.5.1.2 -package-id bytestring-0.10.8.2 -package-id directory-1.3.0.2 -package-id process-1.6.0.0 -package-id filepath-1.4.1.2 -package-id ghc-boot-8.3 -package-id ghc-8.3 -package-id unix-2.7.2.2 -package-id containers-0.5.10.2 -package-id deepseq-1.4.3.0 -package-id ghci-8.3 -package-id haskeline-0.7.4.0 -package-id time-1.8.0.1 -package- id transformers-0.5.2.0 -Wall -fno-warn-name-shadowing -XHaskell2010 -O2 -dcore-lint -dcmm-lint -no-hs-main -threaded -no-user-package-db -rtsopts -Wnoncanonical-monad-instances -odir ghc/stage2/build -hidir ghc/stage2/build -stubdir ghc/stage2/build -c ghc/./GHCi/UI/Tags.hs -o ghc/stage2/build/GHCi/UI/Tags.dyn_o *** Core Lint errors : in result of Simplifier *** <no location info>: warning: [RHS of $wgo_XtpE :: [Name] -> Session -> State# RealWorld -> (# State# RealWorld, [[TagInfo]] #)] Rule "SC:$wgo0": lhs type: (# State# RealWorld, [[TagInfo]] #) rhs type: (# State# RealWorld, [Maybe TyThing] #) *** Offending Program *** (see attached) }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13900 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13900: Core lint in BuildFlavour=perf-llvm -------------------------------------+------------------------------------- Reporter: bgamari | Owner: (none) Type: bug | Status: new Priority: high | Milestone: 8.4.1 Component: Compiler | Version: 8.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Compile-time | Unknown/Multiple crash or panic | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * Attachment "log.xz" added. Full compiler output -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13900 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13900: Core lint in BuildFlavour=perf-llvm -------------------------------------+------------------------------------- Reporter: bgamari | Owner: (none) Type: bug | Status: new Priority: high | Milestone: 8.4.1 Component: Compiler | Version: 8.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Compile-time | Unknown/Multiple crash or panic | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Description changed by bgamari: @@ -2,1 +2,2 @@ - c9977385dca9536f18374242f713b1048a38dec5 with `BuildFlavour=perf-llvm`, + c9977385dca9536f18374242f713b1048a38dec5 with `BuildFlavour=perf-llvm` and + `GhcStage2HcOpts += -dcore-lint -dcmm-lint`, New description: I found the following Core lint failure when compiling c9977385dca9536f18374242f713b1048a38dec5 with `BuildFlavour=perf-llvm` and `GhcStage2HcOpts += -dcore-lint -dcmm-lint`, {{{ "inplace/bin/ghc-stage1" -hisuf dyn_hi -osuf dyn_o -hcsuf dyn_hc -fPIC -dynamic -O -H64m -fllvm -Wall -hide-all-packages -i -ighc/. -ighc/stage2/build -Ighc/stage2/build -ighc/stage2/build/ghc/autogen -Ighc/stage2/build/ghc/autogen -optP-DGHCI -optP-include -optPghc/stage2/build/ghc/autogen/cabal_macros.h -package-id base-4.10.0.0 -package-id array-0.5.1.2 -package-id bytestring-0.10.8.2 -package-id directory-1.3.0.2 -package-id process-1.6.0.0 -package-id filepath-1.4.1.2 -package-id ghc-boot-8.3 -package-id ghc-8.3 -package-id unix-2.7.2.2 -package-id containers-0.5.10.2 -package-id deepseq-1.4.3.0 -package-id ghci-8.3 -package-id haskeline-0.7.4.0 -package-id time-1.8.0.1 -package- id transformers-0.5.2.0 -Wall -fno-warn-name-shadowing -XHaskell2010 -O2 -dcore-lint -dcmm-lint -no-hs-main -threaded -no-user-package-db -rtsopts -Wnoncanonical-monad-instances -odir ghc/stage2/build -hidir ghc/stage2/build -stubdir ghc/stage2/build -c ghc/./GHCi/UI/Tags.hs -o ghc/stage2/build/GHCi/UI/Tags.dyn_o *** Core Lint errors : in result of Simplifier *** <no location info>: warning: [RHS of $wgo_XtpE :: [Name] -> Session -> State# RealWorld -> (# State# RealWorld, [[TagInfo]] #)] Rule "SC:$wgo0": lhs type: (# State# RealWorld, [[TagInfo]] #) rhs type: (# State# RealWorld, [Maybe TyThing] #) *** Offending Program *** (see attached) }}} -- -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13900#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13900: Core lint in BuildFlavour=perf-llvm -------------------------------------+------------------------------------- Reporter: bgamari | Owner: bgamari Type: bug | Status: new Priority: high | Milestone: 8.4.1 Component: Compiler | Version: 8.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Compile-time | Unknown/Multiple crash or panic | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * owner: (none) => bgamari Comment: I'm now looking at this. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13900#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13900: Core lint in BuildFlavour=perf-llvm -------------------------------------+------------------------------------- Reporter: bgamari | Owner: bgamari Type: bug | Status: new Priority: highest | Milestone: 8.6.1 Component: Compiler | Version: 8.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Compile-time | Unknown/Multiple crash or panic | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * priority: high => highest * milestone: 8.4.1 => 8.6.1 Comment: Indeed this is still reproducible on `master`. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13900#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13900: Core lint in BuildFlavour=perf-llvm -------------------------------------+------------------------------------- Reporter: bgamari | Owner: bgamari Type: bug | Status: new Priority: highest | Milestone: 8.6.1 Component: Compiler | Version: 8.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Compile-time | Unknown/Multiple crash or panic | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by dfeuer): bgamari, what stage 0 compiler are you using? What version of LLVM? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13900#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13900: Core lint in BuildFlavour=perf-llvm -------------------------------------+------------------------------------- Reporter: bgamari | Owner: bgamari Type: bug | Status: new Priority: highest | Milestone: 8.6.1 Component: Compiler | Version: 8.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Compile-time | Unknown/Multiple crash or panic | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by dfeuer): Also, are you passing `-fPIC` specifically somewhere? I'm only asking these picky questions because if this is LLVM-only, it seems awfully likely to be something horrible going wrong generating code for the stage 1 compiler. I don't think we really do anything LLVM specific in the specializer or the simplifier, although I could be missing something. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13900#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13900: Core lint in BuildFlavour=perf-llvm -------------------------------------+------------------------------------- Reporter: bgamari | Owner: bgamari Type: bug | Status: new Priority: highest | Milestone: 8.6.1 Component: Compiler | Version: 8.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Compile-time | Unknown/Multiple crash or panic | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by dfeuer): Another question: what exactly am I supposed to do about the fact that the stage 0 compiler and the stage 1 compiler each want ''only'' their preferred LLVM versions, and those are different? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13900#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13900: Core lint in BuildFlavour=perf-llvm -------------------------------------+------------------------------------- Reporter: bgamari | Owner: bgamari Type: bug | Status: new Priority: highest | Milestone: 8.6.1 Component: Compiler | Version: 8.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Compile-time | Unknown/Multiple crash or panic | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by dfeuer): * cc: dfeuer (added) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13900#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13900: Core lint in BuildFlavour=perf-llvm -------------------------------------+------------------------------------- Reporter: bgamari | Owner: bgamari Type: bug | Status: new Priority: highest | Milestone: 8.6.1 Component: Compiler | Version: 8.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Compile-time | Unknown/Multiple crash or panic | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by bgamari): Replying to [comment:4 dfeuer]:
bgamari, what stage 0 compiler are you using? What version of LLVM?
GHC 8.2.1; LLVM 5.0.0.
Also, are you passing -fPIC specifically somewhere?
Another question: what exactly am I supposed to do about the fact that
Nope; I made only the changes described in the summary. the stage 0 compiler and the stage 1 compiler each want only their preferred LLVM versions, and those are different? Both should use version-suffixed LLVM executable names. `configure` uses such executables preferentially when searching for LLVM. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13900#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13900: Core lint in BuildFlavour=perf-llvm -------------------------------------+------------------------------------- Reporter: bgamari | Owner: bgamari Type: bug | Status: new Priority: highest | Milestone: 8.6.1 Component: Compiler | Version: 8.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Compile-time | Unknown/Multiple crash or panic | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by dfeuer): I can also reproduce this using ghc-8.3 as the stage 0 compiler. Oh well. I'll keep digging. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13900#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13900: Core lint in BuildFlavour=perf-llvm -------------------------------------+------------------------------------- Reporter: bgamari | Owner: bgamari Type: bug | Status: new Priority: highest | Milestone: 8.6.1 Component: Compiler | Version: 8.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Compile-time | Unknown/Multiple crash or panic | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by dfeuer): I can cut down `GHCi.UI.Tags` and still get a similar core lint error. As I cut it down, the mismatched types shifted around a bit; unfortunately I didn't capture the intermediate steps, so I can't show them. This version is cut down about as far as I could cut it: {{{#!hs module GHCi.UI.Tags ( createTagsFile ) where import GHC import GHCi.UI.Monad data TagsKind data TagInfo createTagsFile :: TagsKind -> FilePath -> GHCi () createTagsFile _tagskind _tagsFile = do _graph <- GHC.getModuleGraph mapM_ (listModuleTags . GHC.ms_mod) $ [undefined] {-# NOINLINE listModuleTags #-} listModuleTags :: GHC.Module -> GHCi [TagInfo] listModuleTags m = let {-# NOINLINE names #-} names = [] localNames = filter ((m ==) . nameModule) names in mapM GHC.lookupName localNames >> return [] }}} Lots of the little bits remaining seem to be necessary: the `filter`, the `GHC.getModuleGraph`, the `mapM` in `listModuleTags` rather than `mapM_`. I'll keep digging now that I've cut it down, but I figured I should record this. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13900#comment:10 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13900: Core lint in BuildFlavour=perf-llvm -------------------------------------+------------------------------------- Reporter: bgamari | Owner: bgamari Type: bug | Status: new Priority: highest | Milestone: 8.6.1 Component: Compiler | Version: 8.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Compile-time | Unknown/Multiple crash or panic | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by dfeuer): Actually, the `GHC.getModuleGraph` is ''not'' necessary. I can replace that line by {{{#!hs _graph <- return () }}} but ''not'' by {{{#!hs return () }}} That's subtle.... -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13900#comment:11 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13900: Core lint in BuildFlavour=perf-llvm -------------------------------------+------------------------------------- Reporter: bgamari | Owner: bgamari Type: bug | Status: new Priority: highest | Milestone: 8.6.1 Component: Compiler | Version: 8.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Compile-time | Unknown/Multiple crash or panic | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by dfeuer): As best I can tell, everything is fine for long, long time. After SpecConstr, the simplifier runs iteration 1 successfully, but then the next round blows up. It looks like the problematic binding is converted to a join point here, if I'm reading it right. Around when that happens, its type signature changes. The specialization rule for it, however, still rewrites it to something with its original type, causing the lint error. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13900#comment:12 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13900: Core lint in BuildFlavour=perf-llvm -------------------------------------+------------------------------------- Reporter: bgamari | Owner: bgamari Type: bug | Status: new Priority: highest | Milestone: 8.6.1 Component: Compiler | Version: 8.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Compile-time | Unknown/Multiple crash or panic | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by dfeuer): Simon thinks it's most likely that we have trouble with `case` of `join`: {{{#!hs case (join j x= .... in ....) of ... ===> join j x = case ... of ... in case ... of ... }}} This goes wrong if `j` has a `RULE` attached. We either need to apply the transformation in the `RULE` one way or another (Simon thinks he remembers there being a reason not to) or drop the `RULE`. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13900#comment:13 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13900: Core lint in BuildFlavour=perf-llvm
-------------------------------------+-------------------------------------
Reporter: bgamari | Owner: bgamari
Type: bug | Status: new
Priority: highest | Milestone: 8.6.1
Component: Compiler | Version: 8.3
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
Type of failure: Compile-time | Unknown/Multiple
crash or panic | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Simon Peyton Jones

#13900: Core lint in BuildFlavour=perf-llvm -------------------------------------+------------------------------------- Reporter: bgamari | Owner: bgamari Type: bug | Status: new Priority: highest | Milestone: 8.6.1 Component: Compiler | Version: 8.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Compile-time | Unknown/Multiple crash or panic | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by simonpj): I believe I've nailed this. Can you check if it's now fixed for you? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13900#comment:15 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13900: Core lint in BuildFlavour=perf-llvm -------------------------------------+------------------------------------- Reporter: bgamari | Owner: bgamari Type: bug | Status: closed Priority: highest | Milestone: 8.6.1 Component: Compiler | Version: 8.3 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Compile-time | Unknown/Multiple crash or panic | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: new => closed * resolution: => fixed Comment: This indeed appears to be fixed. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13900#comment:16 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC