From dominic at steinitz.org Tue Feb 21 23:38:21 2017 From: dominic at steinitz.org (Dominic Steinitz) Date: Tue, 21 Feb 2017 15:38:21 -0800 Subject: accelerate-llvm problems Message-ID: I am trying to build accelerate-llvm but getting the ghc panics below. Here’s my config > bash-3.2$ ghc-pkg list | grep llvm > ghc-pkg list | grep llvm > llvm-general-3.8.0.0 > llvm-general-pure-3.5.0.0 > llvm-general-pure-3.5.1.0 > llvm-general-pure-3.8.0.0 > bash-3.2$ ghc-pkg list | grep acc > ghc-pkg list | grep acc > accelerate-1.0.0.0 > bash-3.2$ ghc --version > ghc --version > The Glorious Glasgow Haskell Compilation System, version 7.10.2 If anyone has any ideas, I’d be very grateful. > bash-3.2$ ~/Library/Haskell/bin/cabal build > ~/Library/Haskell/bin/cabal build > Building accelerate-llvm-1.0.0.0... > Preprocessing library accelerate-llvm-1.0.0.0... > ghc: > lookupSymbol failed in relocateSection (RELOC_GOT) > /usr/local/Cellar/llvm at 3.8/3.8.1/lib/llvm-3.8/lib/libLLVMSupport.a: unknown symbol `___dso_handle' > [24 of 52] Compiling Data.Range.Range ( Data/Range/Range.hs, dist/build/Data/Range/Range.o ) > > : > ghc: panic! (the 'impossible' happened) > (GHC version 7.10.2 for x86_64-apple-darwin): > Dynamic linker not initialised > > Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug > > [31 of 52] Compiling Data.Array.Accelerate.LLVM.Util ( Data/Array/Accelerate/LLVM/Util.hs, dist/build/Data/Array/Accelerate/LLVM/Util.o ) > > : > ghc: unable to load package `llvm-general-3.8.0.0' > [32 of 52] Compiling Data.Array.Accelerate.LLVM.CodeGen.Ptr ( Data/Array/Accelerate/LLVM/CodeGen/Ptr.hs, dist/build/Data/Array/Accelerate/LLVM/CodeGen/Ptr.o ) > > : > ghc: panic! (the 'impossible' happened) > (GHC version 7.10.2 for x86_64-apple-darwin): > Dynamic linker not initialised > > Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug > > [33 of 52] Compiling Data.Array.Accelerate.LLVM.CodeGen.Monad[boot] ( Data/Array/Accelerate/LLVM/CodeGen/Monad.hs-boot, dist/build/Data/Array/Accelerate/LLVM/CodeGen/Monad.o-boot ) > [34 of 52] Compiling Data.Array.Accelerate.LLVM.CodeGen.IR ( Data/Array/Accelerate/LLVM/CodeGen/IR.hs, dist/build/Data/Array/Accelerate/LLVM/CodeGen/IR.o ) > > : > ghc: panic! (the 'impossible' happened) > (GHC version 7.10.2 for x86_64-apple-darwin): > Dynamic linker not initialised > > Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug > > [44 of 52] Compiling Data.Array.Accelerate.LLVM.Execute.Environment ( Data/Array/Accelerate/LLVM/Execute/Environment.hs, dist/build/Data/Array/Accelerate/LLVM/Execute/Environment.o ) > > : > ghc: panic! (the 'impossible' happened) > (GHC version 7.10.2 for x86_64-apple-darwin): > Dynamic linker not initialised > > Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug -------------- next part -------------- An HTML attachment was scrubbed... URL: From trevor.mcdonell at gmail.com Tue Feb 21 23:44:37 2017 From: trevor.mcdonell at gmail.com (Trevor McDonell) Date: Tue, 21 Feb 2017 23:44:37 +0000 Subject: accelerate-llvm problems In-Reply-To: References: Message-ID: Hi Dominic, You need to build/install LLVM with shared libraries. Then, install llvm-general with -fshared-llvm (or, use my fork, which the stack.yaml files point to). -Trev P.S. On mobile, apologies for the terse reply. On Wed, 22 Feb 2017 at 10:34 AM, Dominic Steinitz wrote: > I am trying to build accelerate-llvm but getting the ghc panics below. > Here’s my config > > > bash-3.2$ ghc-pkg list | grep llvm > > ghc-pkg list | grep llvm > > llvm-general-3.8.0.0 > > llvm-general-pure-3.5.0.0 > > llvm-general-pure-3.5.1.0 > > llvm-general-pure-3.8.0.0 > > bash-3.2$ ghc-pkg list | grep acc > > ghc-pkg list | grep acc > > accelerate-1.0.0.0 > > bash-3.2$ ghc --version > > ghc --version > > The Glorious Glasgow Haskell Compilation System, version 7.10.2 > > If anyone has any ideas, I’d be very grateful. > > > bash-3.2$ ~/Library/Haskell/bin/cabal build > > ~/Library/Haskell/bin/cabal build > > Building accelerate-llvm-1.0.0.0... > > Preprocessing library accelerate-llvm-1.0.0.0... > > ghc: > > lookupSymbol failed in relocateSection (RELOC_GOT) > > /usr/local/Cellar/llvm at 3.8/3.8.1/lib/llvm-3.8/lib/libLLVMSupport.a: > unknown symbol `___dso_handle' > > [24 of 52] Compiling Data.Range.Range ( Data/Range/Range.hs, > dist/build/Data/Range/Range.o ) > > > > : > > ghc: panic! (the 'impossible' happened) > > (GHC version 7.10.2 for x86_64-apple-darwin): > > Dynamic linker not initialised > > > > Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug > > > > [31 of 52] Compiling Data.Array.Accelerate.LLVM.Util ( > Data/Array/Accelerate/LLVM/Util.hs, > dist/build/Data/Array/Accelerate/LLVM/Util.o ) > > > > : > > ghc: unable to load package `llvm-general-3.8.0.0' > > [32 of 52] Compiling Data.Array.Accelerate.LLVM.CodeGen.Ptr ( > Data/Array/Accelerate/LLVM/CodeGen/Ptr.hs, > dist/build/Data/Array/Accelerate/LLVM/CodeGen/Ptr.o ) > > > > : > > ghc: panic! (the 'impossible' happened) > > (GHC version 7.10.2 for x86_64-apple-darwin): > > Dynamic linker not initialised > > > > Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug > > > > [33 of 52] Compiling Data.Array.Accelerate.LLVM.CodeGen.Monad[boot] ( > Data/Array/Accelerate/LLVM/CodeGen/Monad.hs-boot, > dist/build/Data/Array/Accelerate/LLVM/CodeGen/Monad.o-boot ) > > [34 of 52] Compiling Data.Array.Accelerate.LLVM.CodeGen.IR ( > Data/Array/Accelerate/LLVM/CodeGen/IR.hs, > dist/build/Data/Array/Accelerate/LLVM/CodeGen/IR.o ) > > > > : > > ghc: panic! (the 'impossible' happened) > > (GHC version 7.10.2 for x86_64-apple-darwin): > > Dynamic linker not initialised > > > > Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug > > > > [44 of 52] Compiling Data.Array.Accelerate.LLVM.Execute.Environment ( > Data/Array/Accelerate/LLVM/Execute/Environment.hs, > dist/build/Data/Array/Accelerate/LLVM/Execute/Environment.o ) > > > > : > > ghc: panic! (the 'impossible' happened) > > (GHC version 7.10.2 for x86_64-apple-darwin): > > Dynamic linker not initialised > > > > Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dominic at steinitz.org Wed Feb 22 15:02:57 2017 From: dominic at steinitz.org (Dominic Steinitz) Date: Wed, 22 Feb 2017 07:02:57 -0800 Subject: accelerate-llvm problems In-Reply-To: References: Message-ID: <6A78110E-21E6-4AE0-B2A5-FAB830094C66@steinitz.org> Thanks - it seems I can only do this with home-brew for 3.9 - the flag is ignored for 3.8 - I am building now and will report back. > On 21 Feb 2017, at 15:44, Trevor McDonell wrote: > > Hi Dominic, > > You need to build/install LLVM with shared libraries. > > Then, install llvm-general with -fshared-llvm (or, use my fork, which the stack.yaml files point to). > > > -Trev > > P.S. On mobile, apologies for the terse reply. > On Wed, 22 Feb 2017 at 10:34 AM, Dominic Steinitz > wrote: > I am trying to build accelerate-llvm but getting the ghc panics below. Here’s my config > > > bash-3.2$ ghc-pkg list | grep llvm > > ghc-pkg list | grep llvm > > llvm-general-3.8.0.0 > > llvm-general-pure-3.5.0.0 > > llvm-general-pure-3.5.1.0 > > llvm-general-pure-3.8.0.0 > > bash-3.2$ ghc-pkg list | grep acc > > ghc-pkg list | grep acc > > accelerate-1.0.0.0 > > bash-3.2$ ghc --version > > ghc --version > > The Glorious Glasgow Haskell Compilation System, version 7.10.2 > > If anyone has any ideas, I’d be very grateful. > > > bash-3.2$ ~/Library/Haskell/bin/cabal build > > ~/Library/Haskell/bin/cabal build > > Building accelerate-llvm-1.0.0.0... > > Preprocessing library accelerate-llvm-1.0.0.0... > > ghc: > > lookupSymbol failed in relocateSection (RELOC_GOT) > > /usr/local/Cellar/llvm at 3.8/3.8.1/lib/llvm-3.8/lib/libLLVMSupport.a: unknown symbol `___dso_handle' > > [24 of 52] Compiling Data.Range.Range ( Data/Range/Range.hs, dist/build/Data/Range/Range.o ) > > > > : > > ghc: panic! (the 'impossible' happened) > > (GHC version 7.10.2 for x86_64-apple-darwin): > > Dynamic linker not initialised > > > > Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug > > > > [31 of 52] Compiling Data.Array.Accelerate.LLVM.Util ( Data/Array/Accelerate/LLVM/Util.hs, dist/build/Data/Array/Accelerate/LLVM/Util.o ) > > > > : > > ghc: unable to load package `llvm-general-3.8.0.0' > > [32 of 52] Compiling Data.Array.Accelerate.LLVM.CodeGen.Ptr ( Data/Array/Accelerate/LLVM/CodeGen/Ptr.hs, dist/build/Data/Array/Accelerate/LLVM/CodeGen/Ptr.o ) > > > > : > > ghc: panic! (the 'impossible' happened) > > (GHC version 7.10.2 for x86_64-apple-darwin): > > Dynamic linker not initialised > > > > Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug > > > > [33 of 52] Compiling Data.Array.Accelerate.LLVM.CodeGen.Monad[boot] ( Data/Array/Accelerate/LLVM/CodeGen/Monad.hs-boot, dist/build/Data/Array/Accelerate/LLVM/CodeGen/Monad.o-boot ) > > [34 of 52] Compiling Data.Array.Accelerate.LLVM.CodeGen.IR ( Data/Array/Accelerate/LLVM/CodeGen/IR.hs, dist/build/Data/Array/Accelerate/LLVM/CodeGen/IR.o ) > > > > : > > ghc: panic! (the 'impossible' happened) > > (GHC version 7.10.2 for x86_64-apple-darwin): > > Dynamic linker not initialised > > > > Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug > > > > [44 of 52] Compiling Data.Array.Accelerate.LLVM.Execute.Environment ( Data/Array/Accelerate/LLVM/Execute/Environment.hs, dist/build/Data/Array/Accelerate/LLVM/Execute/Environment.o ) > > > > : > > ghc: panic! (the 'impossible' happened) > > (GHC version 7.10.2 for x86_64-apple-darwin): > > Dynamic linker not initialised > > > > Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dominic at steinitz.org Wed Feb 22 15:55:18 2017 From: dominic at steinitz.org (Dominic Steinitz) Date: Wed, 22 Feb 2017 07:55:18 -0800 Subject: accelerate-llvm problems In-Reply-To: <6A78110E-21E6-4AE0-B2A5-FAB830094C66@steinitz.org> References: <6A78110E-21E6-4AE0-B2A5-FAB830094C66@steinitz.org> Message-ID: <686DB703-2CE6-4009-A939-0BCF4AE99576@steinitz.org> No go at the moment - I am using my tiny macbook on holiday which is on too old a version of Xcode. When I try to upgrade it tells me I am out of space. I think rather than fight I will wait until I get back to a machine with more resources. > On 22 Feb 2017, at 07:02, Dominic Steinitz wrote: > > Thanks - it seems I can only do this with home-brew for 3.9 - the flag is ignored for 3.8 - I am building now and will report back. > >> On 21 Feb 2017, at 15:44, Trevor McDonell > wrote: >> >> Hi Dominic, >> >> You need to build/install LLVM with shared libraries. >> >> Then, install llvm-general with -fshared-llvm (or, use my fork, which the stack.yaml files point to). >> >> >> -Trev >> >> P.S. On mobile, apologies for the terse reply. >> On Wed, 22 Feb 2017 at 10:34 AM, Dominic Steinitz > wrote: >> I am trying to build accelerate-llvm but getting the ghc panics below. Here’s my config >> >> > bash-3.2$ ghc-pkg list | grep llvm >> > ghc-pkg list | grep llvm >> > llvm-general-3.8.0.0 >> > llvm-general-pure-3.5.0.0 >> > llvm-general-pure-3.5.1.0 >> > llvm-general-pure-3.8.0.0 >> > bash-3.2$ ghc-pkg list | grep acc >> > ghc-pkg list | grep acc >> > accelerate-1.0.0.0 >> > bash-3.2$ ghc --version >> > ghc --version >> > The Glorious Glasgow Haskell Compilation System, version 7.10.2 >> >> If anyone has any ideas, I’d be very grateful. >> >> > bash-3.2$ ~/Library/Haskell/bin/cabal build >> > ~/Library/Haskell/bin/cabal build >> > Building accelerate-llvm-1.0.0.0... >> > Preprocessing library accelerate-llvm-1.0.0.0... >> > ghc: >> > lookupSymbol failed in relocateSection (RELOC_GOT) >> > /usr/local/Cellar/llvm at 3.8/3.8.1/lib/llvm-3.8/lib/libLLVMSupport.a: unknown symbol `___dso_handle' >> > [24 of 52] Compiling Data.Range.Range ( Data/Range/Range.hs, dist/build/Data/Range/Range.o ) >> > >> > : >> > ghc: panic! (the 'impossible' happened) >> > (GHC version 7.10.2 for x86_64-apple-darwin): >> > Dynamic linker not initialised >> > >> > Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug >> > >> > [31 of 52] Compiling Data.Array.Accelerate.LLVM.Util ( Data/Array/Accelerate/LLVM/Util.hs, dist/build/Data/Array/Accelerate/LLVM/Util.o ) >> > >> > : >> > ghc: unable to load package `llvm-general-3.8.0.0' >> > [32 of 52] Compiling Data.Array.Accelerate.LLVM.CodeGen.Ptr ( Data/Array/Accelerate/LLVM/CodeGen/Ptr.hs, dist/build/Data/Array/Accelerate/LLVM/CodeGen/Ptr.o ) >> > >> > : >> > ghc: panic! (the 'impossible' happened) >> > (GHC version 7.10.2 for x86_64-apple-darwin): >> > Dynamic linker not initialised >> > >> > Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug >> > >> > [33 of 52] Compiling Data.Array.Accelerate.LLVM.CodeGen.Monad[boot] ( Data/Array/Accelerate/LLVM/CodeGen/Monad.hs-boot, dist/build/Data/Array/Accelerate/LLVM/CodeGen/Monad.o-boot ) >> > [34 of 52] Compiling Data.Array.Accelerate.LLVM.CodeGen.IR ( Data/Array/Accelerate/LLVM/CodeGen/IR.hs, dist/build/Data/Array/Accelerate/LLVM/CodeGen/IR.o ) >> > >> > : >> > ghc: panic! (the 'impossible' happened) >> > (GHC version 7.10.2 for x86_64-apple-darwin): >> > Dynamic linker not initialised >> > >> > Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug >> > >> > [44 of 52] Compiling Data.Array.Accelerate.LLVM.Execute.Environment ( Data/Array/Accelerate/LLVM/Execute/Environment.hs, dist/build/Data/Array/Accelerate/LLVM/Execute/Environment.o ) >> > >> > : >> > ghc: panic! (the 'impossible' happened) >> > (GHC version 7.10.2 for x86_64-apple-darwin): >> > Dynamic linker not initialised >> > >> > Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mail at joachim-breitner.de Tue Feb 28 19:25:12 2017 From: mail at joachim-breitner.de (Joachim Breitner) Date: Tue, 28 Feb 2017 11:25:12 -0800 Subject: Folding over short static lists Message-ID: <1488309912.10360.1.camel@joachim-breitner.de> Hi, a common pattern is x `elem` [a,b,c] or x `elem` "/!#" instead of x == a || x == b || x == c or x == '/' || x == '!' || x == '#'. This used to be also what hlint suggested, although that hint was removed https://github.com/ndmitchell/hlint/issues/31. Upon closer inspection it seems that the compiler is not optimizing the former to the latter (more efficient, as allocation-free) form, which mildly surprised me. I guess the problem is described in this note in GHC/Base.hs: -- The foldr/cons rule looks nice, but it can give disastrously -- bloated code when commpiling --      array (a,b) [(1,2), (2,2), (3,2), ...very long list... ] -- i.e. when there are very very long literal lists -- So I've disabled it for now. We could have special cases -- for short lists, I suppose. -- "foldr/cons" forall k z x xs. foldr k z (x:xs) = k x (foldr k z xs) Now I am quite demanding of my compiler, and in particular I expect it to make a more informed choice here. Is there a good way of making an informed choice here? Up to what length of the list is it a good idea to do this? And can we implement it? Maybe simply with a few static rules for list lengths up to a certain, short length? (Maybe I should try that on a branch and see what perf.haskell.org has to say about it.) Greetings, Joachim -- Joachim “nomeata” Breitner   mail at joachim-breitner.de • https://www.joachim-breitner.de/   XMPP: nomeata at joachim-breitner.de • OpenPGP-Key: 0xF0FBF51F   Debian Developer: nomeata at debian.org -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: This is a digitally signed message part URL: