accelerate-cuda 0.13.0.0 → 0.13.0.1
raw patch · 6 files changed
+86/−113 lines, 6 files
Files
- Data/Array/Accelerate/CUDA/Array/Prim.hs +6/−29
- Data/Array/Accelerate/CUDA/CodeGen/Type.hs +6/−57
- Data/Array/Accelerate/CUDA/Compile.hs +3/−13
- accelerate-cuda.cabal +2/−1
- configure +68/−12
- cubits/accelerate_cuda_shape.h +1/−1
Data/Array/Accelerate/CUDA/Array/Prim.hs view
@@ -87,11 +87,11 @@ primArrayEltAs(CShort, Int16) primArrayEltAs(CInt, Int32)-primArrayEltAs(CLong, Int64)+primArrayEltAs(CLong, HTYPE_LONG) primArrayEltAs(CLLong, Int64) primArrayEltAs(CUShort, Word16) primArrayEltAs(CUInt, Word32)-primArrayEltAs(CULong, Word64)+primArrayEltAs(CULong, HTYPE_UNSIGNED_LONG) primArrayEltAs(CULLong, Word64) primArrayElt(Float)@@ -134,8 +134,6 @@ instance TextureData CUShort where format _ = (CUDA.Word16, 1) instance TextureData CInt where format _ = (CUDA.Int32, 1) instance TextureData CUInt where format _ = (CUDA.Word32, 1)-instance TextureData CLong where format _ = (CUDA.Int32, 2)-instance TextureData CULong where format _ = (CUDA.Word32, 2) instance TextureData CLLong where format _ = (CUDA.Int32, 2) instance TextureData CULLong where format _ = (CUDA.Word32, 2) instance TextureData CFloat where format _ = (CUDA.Float, 1)@@ -143,32 +141,11 @@ instance TextureData CChar where format _ = (CUDA.Int8, 1) instance TextureData CSChar where format _ = (CUDA.Int8, 1) instance TextureData CUChar where format _ = (CUDA.Word8, 1)-#if SIZEOF_HSINT == 4-instance TextureData Int where format _ = (CUDA.Int32, 1)-instance TextureData Word where format _ = (CUDA.Word32, 1)-#elif SIZEOF_HSINT == 8-instance TextureData Int where format _ = (CUDA.Int32, 2)-instance TextureData Word where format _ = (CUDA.Word32, 2)-#else-instance TextureData Int where- format _ =- case sizeOf (undefined::Int) of- 4 -> (CUDA.Int32, 1)- 8 -> (CUDA.Int32, 2)-instance TextureData Word where- format _ =- case sizeOf (undefined::Word) of- 4 -> (CUDA.Word32, 1)- 8 -> (CUDA.Word32, 2)-#endif-#if SIZEOF_HSCHAR == 4 instance TextureData Char where format _ = (CUDA.Word32, 1)-#else-instance TextureData Char where- format _ =- case sizeOf (undefined::Char) of- 4 -> (CUDA.Word32, 1)-#endif+instance TextureData Int where format _ = (CUDA.Int32, SIZEOF_HTYPE_INT `div` 4)+instance TextureData Word where format _ = (CUDA.Word32, SIZEOF_HTYPE_WORD `div` 4)+instance TextureData CLong where format _ = (CUDA.Int32, SIZEOF_HTYPE_LONG `div` 4)+instance TextureData CULong where format _ = (CUDA.Word32, SIZEOF_HTYPE_UNSIGNED_LONG `div` 4) -- Primitive array operations
Data/Array/Accelerate/CUDA/CodeGen/Type.hs view
@@ -36,10 +36,6 @@ import Language.C.Quote.CUDA import qualified Language.C as C -#if !defined(SIZEOF_HSINT) || !defined(SIZEOF_HSCHAR)-import Foreign.Storable-#endif- #include "accelerate.h" @@ -109,26 +105,9 @@ codegenIntegralType (TypeCULong _) = [cty|unsigned long int|] codegenIntegralType (TypeCLLong _) = [cty|long long int|] codegenIntegralType (TypeCULLong _) = [cty|unsigned long long int|]-#if SIZEOF_HSINT == 4-codegenIntegralType (TypeInt _) = typename "Int32"-#elif SIZEOF_HSINT == 8-codegenIntegralType (TypeInt _) = typename "Int64"-#else-codegenIntegralType (TypeInt _) = typename- $ case sizeOf (undefined :: Int) of- 4 -> "Int32"- 8 -> "Int64"-#endif-#if SIZEOF_HSINT == 4-codegenIntegralType (TypeWord _) = typename "Word32"-#elif SIZEOF_HSINT == 8-codegenIntegralType (TypeWord _) = typename "Word64"-#else-codegenIntegralType (TypeWord _) = typename- $ case sizeOf (undefined :: Int) of- 4 -> "Word32"- 8 -> "Word64"-#endif+-- XXX: GHC's inbuilt CPP system can't handle stringification+codegenIntegralType (TypeInt _) = typename $ "Int" ++ show (SIZEOF_HTYPE_INT * 8 :: Int)+codegenIntegralType (TypeWord _) = typename $ "Word" ++ show (SIZEOF_HTYPE_INT * 8 :: Int) codegenFloatingType :: FloatingType a -> C.Type codegenFloatingType (TypeFloat _) = [cty|float|]@@ -138,13 +117,7 @@ codegenNonNumType :: NonNumType a -> C.Type codegenNonNumType (TypeBool _) = typename "Word8"-#if SIZEOF_HSCHAR == 4 codegenNonNumType (TypeChar _) = typename "Word32"-#else-codegenNonNumType (TypeChar _) = typename- $ case sizeOf (undefined :: Char) of- 4 -> "Word32"-#endif codegenNonNumType (TypeCChar _) = [cty|char|] codegenNonNumType (TypeCSChar _) = [cty|signed char|] codegenNonNumType (TypeCUChar _) = [cty|unsigned char|]@@ -189,27 +162,9 @@ codegenIntegralTex (TypeCULong _) = typename "TexCULong" codegenIntegralTex (TypeCLLong _) = typename "TexCLLong" codegenIntegralTex (TypeCULLong _) = typename "TexCULLong"-#if SIZEOF_HSINT == 4-codegenIntegralTex (TypeInt _) = typename "TexInt32"-#elif SIZEOF_HSINT == 8-codegenIntegralTex (TypeInt _) = typename "TexInt64"-#else-codegenIntegralTex (TypeInt _) = typename- $ case sizeOf (undefined :: Int) of- 4 -> "TexInt32"- 8 -> "TexInt64"-#endif-#if SIZEOF_HSINT == 4-codegenIntegralTex (TypeWord _) = typename "TexWord32"-#elif SIZEOF_HSINT == 8-codegenIntegralTex (TypeWord _) = typename "TexWord64"-#else-codegenIntegralTex (TypeWord _) = typename- $ case sizeOf (undefined :: Word) of- 4 -> "TexWord32"- 8 -> "TexWord64"-#endif-+-- XXX: GHC's inbuilt CPP system can't handle stringification+codegenIntegralTex (TypeInt _) = typename $ "TexInt" ++ show (SIZEOF_HTYPE_INT * 8 :: Int)+codegenIntegralTex (TypeWord _) = typename $ "TexWord" ++ show (SIZEOF_HTYPE_INT * 8 :: Int) codegenFloatingTex :: FloatingType a -> C.Type codegenFloatingTex (TypeFloat _) = typename "TexFloat"@@ -220,13 +175,7 @@ codegenNonNumTex :: NonNumType a -> C.Type codegenNonNumTex (TypeBool _) = typename "TexWord8"-#if SIZEOF_HSCHAR == 4 codegenNonNumTex (TypeChar _) = typename "TexWord32"-#else-codegenNonNumTex (TypeChar _) = typename- $ case sizeOf (undefined :: Char) of- 4 -> "TexWord32"-#endif codegenNonNumTex (TypeCChar _) = typename "TexCChar" codegenNonNumTex (TypeCSChar _) = typename "TexCSChar" codegenNonNumTex (TypeCUChar _) = typename "TexCUChar"
Data/Array/Accelerate/CUDA/Compile.hs view
@@ -76,10 +76,6 @@ import System.Win32.Process #endif -#ifndef SIZEOF_HSINT-import Foreign.Storable-#endif- import Paths_accelerate_cuda ( getDataDir ) @@ -456,15 +452,9 @@ , machine , cufile ] where-#if SIZEOF_HSINT == 4- machine = "-m32"-#elif SIZEOF_HSINT == 8- machine = "-m64"-#else- machine = case sizeOf (undefined :: Int) of- 4 -> "-m32"- 8 -> "-m64"-#endif+ machine = case (SIZEOF_HTYPE_INT :: Int) of+ 4 -> "-m32"+ 8 -> "-m64" -- Open a unique file in the temporary directory used for compilation
accelerate-cuda.cabal view
@@ -1,5 +1,5 @@ Name: accelerate-cuda-Version: 0.13.0.0+Version: 0.13.0.1 Cabal-version: >= 1.6 Tested-with: GHC >= 7.4 Build-type: Custom@@ -54,6 +54,7 @@ Extra-tmp-files: config.status config.log+ autom4te.cache accelerate-cuda.buildinfo -- generated by configure cubits/accelerate_cuda_shape.h -- generated by configure
configure view
@@ -589,7 +589,6 @@ LIBOBJS cpp_flags ghc_flags-type_hs_char type_hs_int OBJEXT EXEEXT@@ -2321,7 +2320,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of Int" >&5 $as_echo_n "checking size of Int... " >&6; } - sizeof_hs_Int=`$GHC -w -ignore-dot-ghci -e "Foreign.sizeOf (undefined::Int)"`+ sizeof_hs_Int=`$GHC -w -ignore-dot-ghci -e "import Foreign" -e "import Foreign.C" -e "sizeOf (undefined::Int)"` { $as_echo "$as_me:${as_lineno-$LINENO}: result: $sizeof_hs_Int" >&5 $as_echo "$sizeof_hs_Int" >&6; } @@ -2330,30 +2329,87 @@ 8) type_hs_int=Int64 ;; esac - def="-DSIZEOF_HS$(echo Int | tr [:lower:] [:upper:])=$sizeof_hs_Int"+ # The type name+ def="-DHTYPE_INT=$type_hs_int" cpp_flags="$cpp_flags $def" ghc_flags="$ghc_flags -optP$def" + # And size+ def="-DSIZEOF_HTYPE_INT=$sizeof_hs_Int"+ cpp_flags="$cpp_flags $def"+ ghc_flags="$ghc_flags -optP$def" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of Char" >&5-$as_echo_n "checking size of Char... " >&6; } - sizeof_hs_Char=`$GHC -w -ignore-dot-ghci -e "Foreign.sizeOf (undefined::Char)"`- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $sizeof_hs_Char" >&5-$as_echo "$sizeof_hs_Char" >&6; }+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of Word" >&5+$as_echo_n "checking size of Word... " >&6; } - case $sizeof_hs_Char in- 4) type_hs_char=Word32 ;;- 8) type_hs_char=Word64 ;;+ sizeof_hs_Word=`$GHC -w -ignore-dot-ghci -e "import Foreign" -e "import Foreign.C" -e "sizeOf (undefined::Word)"`+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $sizeof_hs_Word" >&5+$as_echo "$sizeof_hs_Word" >&6; }++ case $sizeof_hs_Word in+ 4) type_hs_word=Word32 ;;+ 8) type_hs_word=Word64 ;; esac - def="-DSIZEOF_HS$(echo Char | tr [:lower:] [:upper:])=$sizeof_hs_Char"+ # The type name+ def="-DHTYPE_WORD=$type_hs_word" cpp_flags="$cpp_flags $def" ghc_flags="$ghc_flags -optP$def" + # And size+ def="-DSIZEOF_HTYPE_WORD=$sizeof_hs_Word"+ cpp_flags="$cpp_flags $def"+ ghc_flags="$ghc_flags -optP$def" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of CLong" >&5+$as_echo_n "checking size of CLong... " >&6; } + sizeof_hs_CLong=`$GHC -w -ignore-dot-ghci -e "import Foreign" -e "import Foreign.C" -e "sizeOf (undefined::CLong)"`+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $sizeof_hs_CLong" >&5+$as_echo "$sizeof_hs_CLong" >&6; }++ case $sizeof_hs_CLong in+ 4) type_hs_long=Int32 ;;+ 8) type_hs_long=Int64 ;;+ esac++ # The type name+ def="-DHTYPE_LONG=$type_hs_long"+ cpp_flags="$cpp_flags $def"+ ghc_flags="$ghc_flags -optP$def"++ # And size+ def="-DSIZEOF_HTYPE_LONG=$sizeof_hs_CLong"+ cpp_flags="$cpp_flags $def"+ ghc_flags="$ghc_flags -optP$def"+++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of CULong" >&5+$as_echo_n "checking size of CULong... " >&6; }++ sizeof_hs_CULong=`$GHC -w -ignore-dot-ghci -e "import Foreign" -e "import Foreign.C" -e "sizeOf (undefined::CULong)"`+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $sizeof_hs_CULong" >&5+$as_echo "$sizeof_hs_CULong" >&6; }++ case $sizeof_hs_CULong in+ 4) type_hs_unsigned_long=Word32 ;;+ 8) type_hs_unsigned_long=Word64 ;;+ esac++ # The type name+ def="-DHTYPE_UNSIGNED_LONG=$type_hs_unsigned_long"+ cpp_flags="$cpp_flags $def"+ ghc_flags="$ghc_flags -optP$def"++ # And size+ def="-DSIZEOF_HTYPE_UNSIGNED_LONG=$sizeof_hs_CULong"+ cpp_flags="$cpp_flags $def"+ ghc_flags="$ghc_flags -optP$def"+++ # array index type in accelerate_cuda_shape.h.in cat >confcache <<\_ACEOF
cubits/accelerate_cuda_shape.h view
@@ -23,7 +23,7 @@ * future hardware gains better 64-bit support and/or we need to access very * large arrays. *- * typedef Int64 Ix;+ * typedef Int32 Ix; */ typedef Int32 Ix; typedef void* DIM0;