{-# LANGUAGE CPP #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module Data.Array.Accelerate.LLVM.PTX.Compile.Cache (
module Data.Array.Accelerate.LLVM.Compile.Cache
) where
import Data.Array.Accelerate.LLVM.Compile.Cache
import Data.Array.Accelerate.LLVM.PTX.Target
import Control.Monad.State
import Data.Version
import Foreign.CUDA.Analysis
import System.FilePath
import Text.Printf
import qualified Data.ByteString.Short.Char8 as S8
import Paths_accelerate_llvm_ptx
instance Persistent PTX where
targetCacheTemplate :: LLVM PTX FilePath
targetCacheTemplate = do
Compute Int
m Int
n <- (PTX -> Compute) -> LLVM PTX Compute
forall s (m :: * -> *) a. MonadState s m => (s -> a) -> m a
gets (DeviceProperties -> Compute
computeCapability (DeviceProperties -> Compute)
-> (PTX -> DeviceProperties) -> PTX -> Compute
forall b c a. (b -> c) -> (a -> b) -> a -> c
. PTX -> DeviceProperties
ptxDeviceProperties)
FilePath -> LLVM PTX FilePath
forall (m :: * -> *) a. Monad m => a -> m a
return (FilePath -> LLVM PTX FilePath) -> FilePath -> LLVM PTX FilePath
forall a b. (a -> b) -> a -> b
$ FilePath
"accelerate-llvm-ptx-" FilePath -> FilePath -> FilePath
forall a. [a] -> [a] -> [a]
++ Version -> FilePath
showVersion Version
version
FilePath -> FilePath -> FilePath
</> FilePath
"llvm-hs-" FilePath -> FilePath -> FilePath
forall a. [a] -> [a] -> [a]
++ VERSION_llvm_hs
FilePath -> FilePath -> FilePath
</> ShortByteString -> FilePath
S8.unpack ShortByteString
HasCallStack => ShortByteString
ptxTargetTriple
FilePath -> FilePath -> FilePath
</> FilePath -> Int -> Int -> FilePath
forall r. PrintfType r => FilePath -> r
printf FilePath
"sm%d%d" Int
m Int
n
FilePath -> FilePath -> FilePath
</> FilePath
"morp.sass"