accelerate-llvm-native 1.2.0.0 → 1.2.0.1
raw patch · 6 files changed
+100/−45 lines, 6 filesdep +lockfree-queuedep ~basedep ~containersdep ~llvm-hs
Dependencies added: lockfree-queue
Dependency ranges changed: base, containers, llvm-hs, llvm-hs-pure
Files
- CHANGELOG.md +14/−0
- README.md +18/−14
- accelerate-llvm-native.cabal +11/−10
- src/Data/Array/Accelerate/LLVM/Native/Distribution/Simple/Build.hs +25/−9
- src/Data/Array/Accelerate/LLVM/Native/Distribution/Simple/GHC.hs +32/−11
- src/Data/Array/Accelerate/LLVM/Native/Execute.hs +0/−1
CHANGELOG.md view
@@ -6,6 +6,19 @@ project adheres to the [Haskell Package Versioning Policy (PVP)](https://pvp.haskell.org) +## [1.2.0.1] - 2019-04-29+### Added+ * support for GHC-8.6+ * support for LLVM-7+ * support for LLVM-8++### Contributors++Special thanks to those who contributed patches as part of this release:++ * Trevor L. McDonell (@tmcdonell)+ * Viktor Kronvall (@considerate)+ ## [1.2.0.0] - 2018-04-03 ### Fixed * LLVM native throws "SIGSEGV: invalid address" due to fused FP operation ([#409])@@ -50,6 +63,7 @@ * initial release +[1.2.0.1]: https://github.com/AccelerateHS/accelerate-llvm/compare/v1.2.0.0...v1.2.0.1 [1.2.0.0]: https://github.com/AccelerateHS/accelerate-llvm/compare/1.1.0.1-native...v1.2.0.0 [1.1.0.1]: https://github.com/AccelerateHS/accelerate-llvm/compare/1.1.0.0...1.1.0.1-native [1.1.0.0]: https://github.com/AccelerateHS/accelerate-llvm/compare/1.0.0.0...1.1.0.0
README.md view
@@ -67,7 +67,7 @@ Example using [Homebrew](http://brew.sh) on macOS: ```sh-$ brew install llvm-hs/homebrew-llvm/llvm-6.0+$ brew install llvm-hs/llvm/llvm-8 ``` ## Debian/Ubuntu@@ -78,17 +78,17 @@ then: ```sh-$ apt-get install llvm-6.0-dev+$ apt-get install llvm-8-dev ``` ## Building from source If your OS does not have an appropriate LLVM distribution available, you can also build from source. Detailed build instructions are available on the [LLVM.org website](http://releases.llvm.org/6.0.0/docs/CMake.html). Note that you will require at least [CMake 3.4.3](http://www.cmake.org/cmake/resources/software.html) and a recent C++ compiler; at least Clang 3.1, GCC 4.8, or Visual Studio 2015 (update 3). - 1. Download and unpack the [LLVM-6.0 source code](http://releases.llvm.org/6.0.0/llvm-6.0.0.src.tar.xz). We'll refer to+ 1. Download and unpack the [LLVM-8.0 source code](http://releases.llvm.org/8.0.0/llvm-8.0.0.src.tar.xz). We'll refer to the path that the source tree was unpacked to as `LLVM_SRC`. Only the main LLVM source tree is required, but you can optionally add other components- such as the Clang compiler or Polly loop optimiser. See the [LLVM releases](http://releases.llvm.org/download.html#6.0.0)+ such as the Clang compiler or Polly loop optimiser. See the [LLVM releases](http://releases.llvm.org/download.html#8.0.0) page for the complete list. 2. Create a temporary build directory and `cd` into it, for example:@@ -116,7 +116,7 @@ to [System Integrity Protection](https://en.wikipedia.org/wiki/System_Integrity_Protection): ```sh cd $INSTALL_PREFIX/lib- ln -s libLLVM.dylib libLLVM-6.0.dylib+ ln -s libLLVM.dylib libLLVM-8.0.dylib install_name_tool -id $PWD/libLTO.dylib libLTO.dylib install_name_tool -id $PWD/libLLVM.dylib libLLVM.dylib install_name_tool -change '@rpath/libLLVM.dylib' $PWD/libLLVM.dylib libLTO.dylib@@ -131,13 +131,13 @@ For example, installation using [`stack`](http://docs.haskellstack.org/en/stable/README.html) just requires you to point it to the appropriate configuration file: ```sh-$ ln -s stack-8.2.yaml stack.yaml+$ ln -s stack-8.6.yaml stack.yaml $ stack setup $ stack install ``` Note that the version of [`llvm-hs`](https://hackage.haskell.org/package/llvm-hs)-used must match the installed version of LLVM, which is currently 6.0.+used must match the installed version of LLVM, which is currently 8.0. ## libNVVM@@ -155,12 +155,16 @@ on the version of the CUDA toolkit you have installed. The following table shows some combinations: -| | LLVM-3.3 | LLVM-3.4 | LLVM-3.5 | LLVM-3.8 | LLVM-3.9 | LLVM-4.0 | LLVM-5.0 |-|:------------:|:--------:|:--------:|:--------:|:--------:|:--------:|:--------:|:--------:|-| **CUDA-7.0** | ⭕ | ❌ | | | | | |-| **CUDA-7.5** | | ⭕ | ⭕ | ❌ | | | |-| **CUDA-8.0** | | | ⭕ | ⭕ | ❌ | ❌ | |-| **CUDA-9.0** | | | | | | ❌ | ❌ |+| | LLVM-3.3 | LLVM-3.4 | LLVM-3.5 | LLVM-3.8 | LLVM-3.9 | LLVM-4.0 | LLVM-5.0 | LLVM-6.0 | LLVM-7.0 | LLVM-8.0 |+|:-------------:|:--------:|:--------:|:--------:|:--------:|:--------:|:--------:|:--------:|:--------:|:--------:|:--------:|+| **CUDA-7.0** | ⭕ | ❌ | | | | | | | | |+| **CUDA-7.5** | | ⭕ | ⭕ | ❌ | | | | | | |+| **CUDA-8.0** | | | ⭕ | ⭕ | ❌ | ❌ | | | | |+| **CUDA-9.0** | | | | | | ❌ | ❌ | | | |+| **CUDA-9.1** | | | | | | | | | | |+| **CUDA-9.2** | | | | | | | | | | |+| **CUDA-10.0** | | | | | | | | | | |+| **CUDA-10.1** | | | | | | | | | | | Where ⭕ = Works, and ❌ = Does not work. @@ -168,7 +172,7 @@ want to use the NVVM component. Otherwise, you should be free to use any combination of CUDA and LLVM. -Also note that `accelerate-llvm-ptx` itself currently requires at least LLVM-3.5.+Also note that `accelerate-llvm-ptx` itself currently requires at least LLVM-4.0. Using `stack`, either edit the `stack.yaml` and add the following section:
accelerate-llvm-native.cabal view
@@ -1,7 +1,7 @@ name: accelerate-llvm-native-version: 1.2.0.0+version: 1.2.0.1 cabal-version: >= 1.10-tested-with: GHC >= 7.10+tested-with: GHC >= 8.0 build-type: Simple synopsis: Accelerate backend for multicore CPUs@@ -26,7 +26,7 @@ . Example using Homebrew on macOS: .- > brew install llvm-hs/homebrew-llvm/llvm-6.0+ > brew install llvm-hs/llvm/llvm-8 . /Debian & Ubuntu/ .@@ -35,13 +35,13 @@ instructions for adding the correct package database for your OS version, and then: .- > apt-get install llvm-6.0-dev+ > apt-get install llvm-8-dev . /Building from source/ . If your OS does not have an appropriate LLVM distribution available, you can also build from source. Detailed build instructions are available on- <http://releases.llvm.org/6.0.0/docs/CMake.html LLVM.org>. Make sure to+ <http://releases.llvm.org/8.0.0/docs/CMake.html LLVM.org>. Make sure to include the cmake build options @-DLLVM_BUILD_LLVM_DYLIB=ON -DLLVM_LINK_LLVM_DYLIB=ON@ so that the @libLLVM@ shared library will be built.@@ -127,21 +127,22 @@ Paths_accelerate_llvm_native build-depends:- base >= 4.7 && < 4.12+ base >= 4.7 && < 4.13 , accelerate == 1.2.* , accelerate-llvm == 1.2.* , bytestring >= 0.10.4 , Cabal >= 2.0 , cereal >= 0.4- , containers >= 0.5 && < 0.6+ , containers >= 0.5 && < 0.7 , directory >= 1.0 , dlist >= 0.6 , filepath >= 1.0 , ghc , hashable >= 1.0 , libffi >= 0.1- , llvm-hs >= 4.1 && < 6.1- , llvm-hs-pure >= 4.1 && < 6.1+ , llvm-hs >= 4.1 && < 8.1+ , llvm-hs-pure >= 4.1 && < 8.1+ , lockfree-queue >= 0.2 , mtl >= 2.2.1 , template-haskell , time >= 1.4@@ -230,7 +231,7 @@ source-repository this type: git- tag: 1.2.0.0+ tag: v1.2.0.1 location: https://github.com/AccelerateHS/accelerate-llvm.git -- vim: nospell
src/Data/Array/Accelerate/LLVM/Native/Distribution/Simple/Build.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} -- | -- Module : Data.Array.Accelerate.LLVM.Native.Distribution.Simple.Build -- Copyright : [2017] Trevor L. McDonell@@ -36,8 +37,6 @@ import Distribution.Backpack.DescribeUnitId import qualified Distribution.Simple.GHC as GHC import qualified Distribution.Simple.GHCJS as GHCJS-import qualified Distribution.Simple.JHC as JHC-import qualified Distribution.Simple.LHC as LHC import qualified Distribution.Simple.UHC as UHC import qualified Distribution.Simple.HaskellSuite as HaskellSuite import qualified Distribution.Simple.PackageIndex as Index@@ -63,6 +62,11 @@ import Distribution.Simple.Utils import Distribution.Text+#if MIN_VERSION_Cabal(2,4,0)+import Distribution.System (buildPlatform, Platform)+#else+import Distribution.System (buildPlatform)+#endif import Distribution.Verbosity import Distribution.Compat.Graph (IsNode(..))@@ -268,7 +272,24 @@ } testSuiteExeV10AsExe TestSuite{} = error "testSuiteExeV10AsExe: wrong kind" +#if MIN_VERSION_Cabal(2,4,0)+setBuildDepends :: [Dependency] -> PackageDescription -> PackageDescription+setBuildDepends deps pkg_descr@PackageDescription{ setupBuildInfo = Just buildInfo'}+ = pkg_descr { setupBuildInfo = Just (buildInfo' {setupDepends = deps})}+setBuildDepends deps pkg_descr@PackageDescription{ setupBuildInfo = Nothing}+ = pkg_descr+ { setupBuildInfo = Just (SetupBuildInfo {setupDepends = deps, defaultSetupDepends = True})+ }+exeExtension' :: Platform -> String+exeExtension' = exeExtension+#else+setBuildDepends :: [Dependency] -> PackageDescription -> PackageDescription+setBuildDepends deps pkg_descr = pkg_descr {buildDepends = deps}+exeExtension' :: a -> String+exeExtension' _ = exeExtension+#endif + -- | Translate a lib-style 'TestSuite' component into a lib + exe for building testSuiteLibV09AsLibAndExe :: PackageDescription -> TestSuite@@ -315,9 +336,8 @@ , componentCompatPackageKey = compat_key , componentExposedModules = [IPI.ExposedModule m Nothing] }- pkg = pkg_descr {+ pkg = setBuildDepends (targetBuildDepends $ testBuildInfo test) $ pkg_descr { package = (package pkg_descr) { pkgName = mkPackageName $ unMungedPackageName compat_name }- , buildDepends = targetBuildDepends $ testBuildInfo test , executables = [] , testSuites = [] , subLibraries = [lib]@@ -406,7 +426,7 @@ [ simpleConfiguredProgram toolName' (FoundOnSystem toolLocation) | toolName <- getAllInternalToolDependencies pkg bi , let toolName' = unUnqualComponentName toolName- , let toolLocation = buildDir lbi </> toolName' </> toolName' <.> exeExtension ]+ , let toolLocation = buildDir lbi </> toolName' </> toolName' <.> exeExtension' buildPlatform ] -- TODO: build separate libs in separate dirs so that we can build@@ -418,8 +438,6 @@ case compilerFlavor (compiler lbi) of GHC -> Acc.buildLib verbosity numJobs pkg_descr lbi lib clbi -- XXX only change here GHCJS -> GHCJS.buildLib verbosity numJobs pkg_descr lbi lib clbi- JHC -> JHC.buildLib verbosity pkg_descr lbi lib clbi- LHC -> LHC.buildLib verbosity pkg_descr lbi lib clbi UHC -> UHC.buildLib verbosity pkg_descr lbi lib clbi HaskellSuite {} -> HaskellSuite.buildLib verbosity pkg_descr lbi lib clbi _ -> die' verbosity "Building is not supported with this compiler."@@ -443,8 +461,6 @@ case compilerFlavor (compiler lbi) of GHC -> GHC.buildExe verbosity numJobs pkg_descr lbi exe clbi GHCJS -> GHCJS.buildExe verbosity numJobs pkg_descr lbi exe clbi- JHC -> JHC.buildExe verbosity pkg_descr lbi exe clbi- LHC -> LHC.buildExe verbosity pkg_descr lbi exe clbi UHC -> UHC.buildExe verbosity pkg_descr lbi exe clbi _ -> die' verbosity "Building is not supported with this compiler."
src/Data/Array/Accelerate/LLVM/Native/Distribution/Simple/GHC.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} -- | -- Module : Data.Array.Accelerate.LLVM.Native.Distribution.Simple.GHC -- Copyright : [2017] Trevor L. McDonell@@ -38,6 +39,7 @@ import Distribution.System import Distribution.Verbosity import Distribution.Text+import Distribution.Types.UnitId(UnitId) import Distribution.Utils.NubList import Language.Haskell.Extension @@ -56,6 +58,27 @@ buildLib = buildOrReplLib False replLib = buildOrReplLib True ++#if MIN_VERSION_Cabal(2,4,0)+nubList :: a -> a+nubList = id++overNubListR' :: a -> a+overNubListR' = id++mkSharedLibName' :: Platform -> CompilerId -> UnitId -> String +mkSharedLibName' = mkSharedLibName+#else+nubList :: (Ord a) => [a] -> NubListR a+nubList = toNubListR++overNubListR' :: (Ord a) => ([a] -> [a]) -> NubListR a -> NubListR a+overNubListR' = overNubListR++mkSharedLibName' :: Platform -> CompilerId -> UnitId -> String +mkSharedLibName' _ compiler_uid path = mkSharedLibName compiler_uid path+#endif+ buildOrReplLib :: Bool -> Verbosity -> Cabal.Flag (Maybe Int) -> PackageDescription -> LocalBuildInfo -> Library -> ComponentLocalBuildInfo -> IO ()@@ -120,7 +143,7 @@ (withProfLibDetail lbi), ghcOptHiSuffix = toFlag "p_hi", ghcOptObjSuffix = toFlag "p_o",- ghcOptExtra = toNubListR $ hcProfOptions GHC libBi,+ ghcOptExtra = nubList $ hcProfOptions GHC libBi, ghcOptHPCDir = hpcdir Hpc.Prof } @@ -129,12 +152,12 @@ ghcOptFPic = toFlag True, ghcOptHiSuffix = toFlag "dyn_hi", ghcOptObjSuffix = toFlag "dyn_o",- ghcOptExtra = toNubListR $ hcSharedOptions GHC libBi,+ ghcOptExtra = nubList $ hcSharedOptions GHC libBi, ghcOptHPCDir = hpcdir Hpc.Dyn } linkerOpts = mempty {- ghcOptLinkOptions = toNubListR $ PD.ldOptions libBi,- ghcOptLinkLibs = toNubListR $ extraLibs libBi,+ ghcOptLinkOptions = nubList $ PD.ldOptions libBi,+ ghcOptLinkLibs = nubList $ extraLibs libBi, ghcOptLinkLibPath = toNubListR $ extraLibDirs libBi, ghcOptLinkFrameworks = toNubListR $ PD.frameworks libBi,@@ -144,8 +167,7 @@ [libTargetDir </> x | x <- cObjs] } replOpts = vanillaOpts {- ghcOptExtra = overNubListR- Internal.filterGhciFlags $+ ghcOptExtra = overNubListR' Internal.filterGhciFlags $ ghcOptExtra vanillaOpts, ghcOptNumJobs = mempty }@@ -239,10 +261,10 @@ compiler_id = compilerId (compiler lbi) vanillaLibFilePath = libTargetDir </> mkLibName uid profileLibFilePath = libTargetDir </> mkProfLibName uid- sharedLibFilePath = libTargetDir </> mkSharedLibName compiler_id uid+ sharedLibFilePath = libTargetDir </> mkSharedLibName' buildPlatform compiler_id uid ghciLibFilePath = libTargetDir </> Internal.mkGHCiLibName uid libInstallPath = libdir $ absoluteComponentInstallDirs pkg_descr lbi uid NoCopyDest- sharedLibInstallPath = libInstallPath </> mkSharedLibName compiler_id uid+ sharedLibInstallPath = libInstallPath </> mkSharedLibName' buildPlatform compiler_id uid stubObjs <- catMaybes <$> sequenceA [ findFileWithExtension [objExtension] [libTargetDir]@@ -312,8 +334,7 @@ ghcOptDynLinkMode = toFlag GhcDynamicOnly, ghcOptInputFiles = toNubListR dynamicObjectFiles, ghcOptOutputFile = toFlag sharedLibFilePath,- ghcOptExtra = toNubListR $- hcSharedOptions GHC libBi,+ ghcOptExtra = nubList $ hcSharedOptions GHC libBi, -- For dynamic libs, Mac OS/X needs to know the install location -- at build time. This only applies to GHC < 7.8 - see the -- discussion in #1660.@@ -340,7 +361,7 @@ _ -> [], ghcOptPackages = toNubListR $ Internal.mkGhcOptPackages clbi ,- ghcOptLinkLibs = toNubListR $ extraLibs libBi,+ ghcOptLinkLibs = nubList $ extraLibs libBi, ghcOptLinkLibPath = toNubListR $ extraLibDirs libBi, ghcOptLinkFrameworks = toNubListR $ PD.frameworks libBi, ghcOptLinkFrameworkDirs =
src/Data/Array/Accelerate/LLVM/Native/Execute.hs view
@@ -58,7 +58,6 @@ import Text.Printf ( printf ) import Prelude hiding ( map, sum, scanl, scanr, init ) import qualified Data.ByteString.Short.Char8 as S8-import qualified Prelude as P import Foreign.C import Foreign.LibFFI