
A package I just released (arb-fft) gets about a 17% performance boost from using GHC's LLVM backend (on my machine at least). That seems a big enough gain that I put "-fllvm" into the ghc-options field in the Cabal file for the package. Unfortunately, that means the package won't install unless you have the LLVM tools installed. What's the best thing to do? Use the native code generator by default and add a Cabal flag to install using LLVM? Just take the "-fllvm" out and add a note to the Cabal file description to tell people to install using LLVM if they have it? A quick survey of packages on Hackage reveals only very few instances where the "-fllvm" flag appears in Cabal files, which makes me suspect that I'm doing it wrong. -- Ian Ross Tel: +43(0)6804451378 ian@skybluetrades.net www.skybluetrades.net

Hi Ian,
What's the best thing to do? Use the native code generator by default and add a Cabal flag to install using LLVM?
I would assume that everybody who wants to compile your package with LLVM can simply configure the build with "--ghc-option=-fllvm", no? A Cabal flag for the same purpose might make sense, IMHO, if there are other build parameters that change when compiling with LLVM (like CPP defines, etc.), but it's my understanding that this is not the case? Take care, Peter

Hi Peter,
I would assume that everybody who wants to compile your package with LLVM can simply configure the build with "--ghc-option=-fllvm", no?
Absolutely, yes. I was just wondering about it as a matter of policy, particularly in terms of reverse dependencies (not that this package has any yet). If you install package A that depends on package B and package B gets a big performance boost from LLVM, things are fine if you install package B yourself and tell Cabal to build it with LLVM, but if Cabal installs it automatically as a dependency of package A, then it won't get built with LLVM (unless you install package A with that option too, but then you end up pushing the responsibility to handle package B's peculiarities upstream to its reverse dependencies).
A Cabal flag for the same purpose might make sense, IMHO, if there are other build parameters that change when compiling with LLVM (like CPP defines, etc.), but it's my understanding that this is not the case?
Right. I think I'll add a Cabal flag and worry about the reverse dependencies issue if the package ever has any! Cheers, Ian. -- Ian Ross Tel: +43(0)6804451378 ian@skybluetrades.net www.skybluetrades.net

Ian Ross wrote:
A Cabal flag for the same purpose might make sense, IMHO, if there are other build parameters that change when compiling with LLVM (like CPP defines, etc.), but it's my understanding that this is not the case?
Right. I think I'll add a Cabal flag and worry about the reverse dependencies issue if the package ever has any!
You can specify a cabal flag to be switched on by default. Cabal will then switch off the flag automatically if it cannot satisfy the constraints. So, if you can add a dependency on the LLVM tools in the "extra-libraries" field or elsewhere, you can use this automatic flag assignment to compile the LLVM version for people who already have the LLVM tools installed. (Note that last time I checked, cabal will not try to download new packages in order to fulfill the constraints, though.) Best regards, Heinrich Apfelmus -- http://apfelmus.nfshost.com

Thanks Heinrich! That sounds like the ideal solution. I'll do that.
On 29 January 2014 10:55, Heinrich Apfelmus
Ian Ross wrote:
A Cabal flag for the same purpose might make sense, IMHO, if there are
other build parameters that change when compiling with LLVM (like CPP defines, etc.), but it's my understanding that this is not the case?
Right. I think I'll add a Cabal flag and worry about the reverse dependencies issue if the package ever has any!
You can specify a cabal flag to be switched on by default. Cabal will then switch off the flag automatically if it cannot satisfy the constraints.
So, if you can add a dependency on the LLVM tools in the "extra-libraries" field or elsewhere, you can use this automatic flag assignment to compile the LLVM version for people who already have the LLVM tools installed.
(Note that last time I checked, cabal will not try to download new packages in order to fulfill the constraints, though.)
Best regards, Heinrich Apfelmus
-- http://apfelmus.nfshost.com
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
-- Ian Ross Tel: +43(0)6804451378 ian@skybluetrades.net www.skybluetrades.net
participants (3)
-
Heinrich Apfelmus
-
Ian Ross
-
Peter Simons