Opened 10 years ago

Closed 10 years ago

#2355 closed bug (fixed)

Building NDP fails with GHC panic on x86_64

Reported by: Nolari Owned by:
Priority: normal Milestone:
Component: Compiler Version: 6.9
Keywords: ndp ghc panic Cc: rl@…
Operating System: Linux Architecture: x86_64 (amd64)
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description

With the latest GHC and NDP from darcs I get the following during the compilation of NDP on my Intel Core 2 Quad (x86_64) system:

[ 7 of 78] Compiling Data.Array.Parallel.Base.Rebox ( Data/Array/Parallel/Base/Rebox.hs, dist/build/Data/Array/Parallel/Base/Rebox.o )
ghc-6.9.20080605: panic! (the 'impossible' happened)
  (GHC version 6.9.20080605 for x86_64-unknown-linux):
	initC: srt_lbl

Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug

This is what I did to get to that point:

$ darcs get --partial http://darcs.haskell.org/ghc
$ cd ghc
$ chmod a+x darcs-all
$ ./darcs-all get

I then copied mk/build.mk.sample to mk/build.mk, uncommenting the line "BuildFlavour = perf", after which:

$ sh boot
$ ./configure
$ make
$ cd libraries
$ darcs get http://darcs.haskell.org/packages/ndp/
$ make make.library.ndp

Change History (11)

comment:1 Changed 10 years ago by Nolari

Having found out about the http://darcs.haskell.org/ghc-2008-06-02/ branch I decided to give that a go. That got me a bit further along, but a panic still occurs in a different place:

[16 of 78] Compiling Data.Array.Parallel.Stream.Segmented ( Data/Array/Parallel/Stream/Segmented.hs, dist/build/Data/Array/Parallel/Stream/Segmented.p_o )
GHC error in desugarer lookup in ndp:Data.Array.Parallel.Stream.Segmented:
  attempting to use module `ndp:Data.Array.Parallel.Lifted.PArray' (./Data/Array/Parallel/Lifted/PArray.hs) which is not loaded
ghc-6.9.20080602: panic! (the 'impossible' happened)
  (GHC version 6.9.20080602 for x86_64-unknown-linux):
	initDs user error (IOEnv failure)

Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug

comment:2 Changed 10 years ago by simonpj

difficulty: Unknown

Always use dcore-lint; you often get more informative messages that way. And if you have made any significant change, make sure you start from clean.

Simon

comment:3 Changed 10 years ago by rl

I'm getting the initC error, too. This module isn't NDP-specific (and isn't vectorised) so it looks like a GHC bug. I guess it's been introduced by

Thu Jun 5 05:44:23 PDT 2008 simonpj@…

  • Desugar multiple polymorphic bindings more intelligently

since adding -fno-ds-multi-tyvar fixes it. -dcore-lint says:

* Core Lint Errors: in result of Simplifier phase gentle, iteration 1 out of 10 * <no location info>:

In the expression: Data.Array.Parallel.Base.Rebox.:DRebox

@ (Data.Array.Parallel.Base.Rebox.Box a_adV) (rebox_siX @ a_adV)

rebox_siX is out of scope

Simon, could you please take a look.

comment:4 Changed 10 years ago by simonpj

Sorry about that. It turned out to be a subtle simplifier scoping bug, triggered by the desugarer changes, which meant it took a while to find.

I have a patch, but I have not had time to validate it, and I'm about to go away. For now, just use -fno-ds-multi-tyvar

Simon

comment:5 Changed 10 years ago by Nolari

It's not clear to me how to build NDP with -dcore-lint turned on (or -fno-ds-multi-tyvar for that matter). I tried fiddling with the Makefiles and ndp.mk but they didn't seem to have any effect on make make.library.ndp, and neither did adding {-# OPTIONS_GHC -dcore-lint #-} to the offending file. I also haven't really figured out what the exact GHC invocation is to build the file by hand.

On a whim, I tried to just do a clean build (make remake.library.ndp) and then the compilation actually got past the file where it got stuck before! It then gave the same "error in desugarer lookup"-panic on a different file, I added {-# OPTIONS_GHC -dcore-lint #-} to that file and did a new remake, and it got further again.

In this way I've been able to finally build NDP. :) But the process seems to be non-deterministic! Doing a remake sometimes succeeds and sometimes doesn't, and if it doesn't then the offending file isn't even always the same. Sometimes it's one of the files where I added {-# OPTIONS_GHC -dcore-lint #-}, but even then I'm still not getting any extra output such as rl provided.

comment:6 Changed 10 years ago by rl

You can set the commmand line options in ndp.cabal. I also suggest that you try make [re]build.library.ndp instead of [re]make, I suspect that'll solve your build problems. You only get output from -dcore-lint if the lint pass actually detects any errors.

comment:7 Changed 10 years ago by Nolari

Thanks! Editing the cabal file indeed works. By the way, which branch of GHC should I be using with NDP? I'm trying both the http://darcs.haskell.org/ghc/ and http://darcs.haskell.org/ghc-2008-06-02/ branches.

The ghc-2008-06-02 one doesn't seem to understand the -fno-ds-multi-tyvar option, and -dcore-lint gives no additional output. Here's the result of my last 3 make rebuild.library.ndp runs:

[29 of 78] Compiling Data.Array.Parallel.Unlifted.Flat.Enum ( Data/Array/Parallel/Unlifted/Flat/Enum.hs, dist/build/Data/Array/Parallel/Unlifted/Flat/Enum.p_o )
GHC error in desugarer lookup in ndp:Data.Array.Parallel.Unlifted.Flat.Enum:
  attempting to use module `ndp:Data.Array.Parallel.Lifted.PArray' (./Data/Array/Parallel/Lifted/PArray.hs) which is not loaded
ghc-6.9.20080602: panic! (the 'impossible' happened)
  (GHC version 6.9.20080602 for x86_64-unknown-linux):
	initDs user error (IOEnv failure)
[12 of 78] Compiling Data.Array.Parallel.Stream.Flat.Combinators ( Data/Array/Parallel/Stream/Flat/Combinators.hs, dist/build/Data/Array/Parallel/Stream/Flat/Combinators.o )
GHC error in desugarer lookup in ndp:Data.Array.Parallel.Stream.Flat.Combinators:
  attempting to use module `ndp:Data.Array.Parallel.Lifted.PArray' (./Data/Array/Parallel/Lifted/PArray.hs) which is not loaded
ghc-6.9.20080602: panic! (the 'impossible' happened)
  (GHC version 6.9.20080602 for x86_64-unknown-linux):
	initDs user error (IOEnv failure)
[27 of 78] Compiling Data.Array.Parallel.Unlifted.Flat.Combinators ( Data/Array/Parallel/Unlifted/Flat/Combinators.hs, dist/build/Data/Array/Parallel/Unlifted/Flat/Combinators.o )
GHC error in desugarer lookup in ndp:Data.Array.Parallel.Unlifted.Flat.Combinators:
  attempting to use module `ndp:Data.Array.Parallel.Lifted.PArray' (./Data/Array/Parallel/Lifted/PArray.hs) which is not loaded
ghc-6.9.20080602: panic! (the 'impossible' happened)
  (GHC version 6.9.20080602 for x86_64-unknown-linux):
	initDs user error (IOEnv failure)

On the ghc branch the option -fno-ds-multi-tyvar is understood, and gives me the following on make rebuild.library.ndp:

[21 of 78] Compiling Data.Array.Parallel.Unlifted.Flat.UArr ( Data/Array/Parallel/Unlifted/Flat/UArr.hs, dist/build/Data/Array/Parallel/Unlifted/Flat/UArr.o )

Data/Array/Parallel/Unlifted/Flat/UArr.hs:423:25:
    A newtype constructor cannot have a strictness annotation,
      but `UAChar' does
    In the definition of data constructor `UAChar'
    In the newtype instance declaration for `UArr'
    In the instance declaration for `UA Char'

Data/Array/Parallel/Unlifted/Flat/UArr.hs:424:25:
    A newtype constructor cannot have a strictness annotation,
      but `MUAChar' does
    In the definition of data constructor `MUAChar'
    In the newtype instance declaration for `MUArr'
    In the instance declaration for `UA Char'

Data/Array/Parallel/Unlifted/Flat/UArr.hs:445:24:
    A newtype constructor cannot have a strictness annotation,
      but `UAInt' does
    In the definition of data constructor `UAInt'
    In the newtype instance declaration for `UArr'
    In the instance declaration for `UA Int'

Data/Array/Parallel/Unlifted/Flat/UArr.hs:446:24:
    A newtype constructor cannot have a strictness annotation,
      but `MUAInt' does
    In the definition of data constructor `MUAInt'
    In the newtype instance declaration for `MUArr'
    In the instance declaration for `UA Int'

Data/Array/Parallel/Unlifted/Flat/UArr.hs:473:26:
    A newtype constructor cannot have a strictness annotation,
      but `UAFloat' does
    In the definition of data constructor `UAFloat'
    In the newtype instance declaration for `UArr'
    In the instance declaration for `UA Float'

Data/Array/Parallel/Unlifted/Flat/UArr.hs:474:26:
    A newtype constructor cannot have a strictness annotation,
      but `MUAFloat' does
    In the definition of data constructor `MUAFloat'
    In the newtype instance declaration for `MUArr'
    In the instance declaration for `UA Float'

Data/Array/Parallel/Unlifted/Flat/UArr.hs:495:27:
    A newtype constructor cannot have a strictness annotation,
      but `UADouble' does
    In the definition of data constructor `UADouble'
    In the newtype instance declaration for `UArr'
    In the instance declaration for `UA Double'

Data/Array/Parallel/Unlifted/Flat/UArr.hs:496:27:
    A newtype constructor cannot have a strictness annotation,
      but `MUADouble' does
    In the definition of data constructor `MUADouble'
    In the newtype instance declaration for `MUArr'
    In the instance declaration for `UA Double'

comment:8 Changed 10 years ago by rl

I've just pushed a patch to package ndp which fixes the strictness annotation issue. As to the initDs errors, I really don't know why that happens. If this happens with the current HEAD, could you please send me the complete output from make rebuild.library.ndp.

comment:9 Changed 10 years ago by simonpj

Check out http://hackage.haskell.org/trac/ghc/wiki/Building/Hacking, esp the bit about build.mk. Adding -dcore-lint to GhcLibHcOpts will do the job for all libraries. I have that set all the time.

Simon

comment:10 Changed 10 years ago by simonpj

Cc: rl@… added

Should be fixed by

Sat Jun 14 03:39:37 BST 2008  simonpj@microsoft.com
  * Fix nasty Simplifier scoping bug

Roman, can you check this now works, and then close the bug? Thanks.

Simon

comment:11 Changed 10 years ago by rl

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.