accelerate-llvm-native-1.2.0.1: Accelerate backend for multicore CPUs

Copyright[2016..2017] Trevor L. McDonell
LicenseBSD3
MaintainerTrevor L. McDonell <tmcdonell@cse.unsw.edu.au>
Stabilityexperimental
Portabilitynon-portable (GHC extensions)
Safe HaskellNone
LanguageHaskell2010

Data.Array.Accelerate.LLVM.Native.Foreign

Contents

Description

 
Synopsis

Documentation

data ForeignAcc f where Source #

Constructors

ForeignAcc :: String -> (a -> LLVM Native b) -> ForeignAcc (a -> b) 
Instances
Foreign ForeignAcc Source # 
Instance details

Defined in Data.Array.Accelerate.LLVM.Native.Foreign

Methods

strForeign :: ForeignAcc args -> String

liftForeign :: ForeignAcc args -> Q (TExp (ForeignAcc args))

data ForeignExp f where Source #

Constructors

ForeignExp :: String -> IRFun1 Native () (x -> y) -> ForeignExp (x -> y) 
Instances
Foreign ForeignExp Source # 
Instance details

Defined in Data.Array.Accelerate.LLVM.Native.Foreign

Methods

strForeign :: ForeignExp args -> String

liftForeign :: ForeignExp args -> Q (TExp (ForeignExp args))

data LLVM target a #

The LLVM monad, for executing array computations. This consists of a stack for the LLVM execution context as well as the per-execution target specific state target.

Instances
MonadState target (LLVM target) 
Instance details

Defined in Data.Array.Accelerate.LLVM.State

Methods

get :: LLVM target target #

put :: target -> LLVM target () #

state :: (target -> (a, target)) -> LLVM target a #

Execute arch => ExecuteAfun arch (LLVM arch b) 
Instance details

Defined in Data.Array.Accelerate.LLVM.Execute

Associated Types

type ExecAfunR arch (LLVM arch b) :: Type

Methods

executeOpenAfun :: ExecOpenAfun arch aenv (ExecAfunR arch (LLVM arch b)) -> LLVM arch (AvalR arch aenv) -> LLVM arch b

Monad (LLVM target) 
Instance details

Defined in Data.Array.Accelerate.LLVM.State

Methods

(>>=) :: LLVM target a -> (a -> LLVM target b) -> LLVM target b #

(>>) :: LLVM target a -> LLVM target b -> LLVM target b #

return :: a -> LLVM target a #

fail :: String -> LLVM target a #

Functor (LLVM target) 
Instance details

Defined in Data.Array.Accelerate.LLVM.State

Methods

fmap :: (a -> b) -> LLVM target a -> LLVM target b #

(<$) :: a -> LLVM target b -> LLVM target a #

Applicative (LLVM target) 
Instance details

Defined in Data.Array.Accelerate.LLVM.State

Methods

pure :: a -> LLVM target a #

(<*>) :: LLVM target (a -> b) -> LLVM target a -> LLVM target b #

liftA2 :: (a -> b -> c) -> LLVM target a -> LLVM target b -> LLVM target c #

(*>) :: LLVM target a -> LLVM target b -> LLVM target b #

(<*) :: LLVM target a -> LLVM target b -> LLVM target a #

MonadIO (LLVM target) 
Instance details

Defined in Data.Array.Accelerate.LLVM.State

Methods

liftIO :: IO a -> LLVM target a #

MonadMask (LLVM target) 
Instance details

Defined in Data.Array.Accelerate.LLVM.State

Methods

mask :: ((forall a. LLVM target a -> LLVM target a) -> LLVM target b) -> LLVM target b #

uninterruptibleMask :: ((forall a. LLVM target a -> LLVM target a) -> LLVM target b) -> LLVM target b #

generalBracket :: LLVM target a -> (a -> ExitCase b -> LLVM target c) -> (a -> LLVM target b) -> LLVM target (b, c) #

MonadCatch (LLVM target) 
Instance details

Defined in Data.Array.Accelerate.LLVM.State

Methods

catch :: Exception e => LLVM target a -> (e -> LLVM target a) -> LLVM target a #

MonadThrow (LLVM target) 
Instance details

Defined in Data.Array.Accelerate.LLVM.State

Methods

throwM :: Exception e => e -> LLVM target a #

type ExecAfunR arch (LLVM arch b) 
Instance details

Defined in Data.Array.Accelerate.LLVM.Execute

type ExecAfunR arch (LLVM arch b) = b

data Native Source #

Native machine code JIT execution target

Constructors

Native 

Fields

Instances
Skeleton Native 
Instance details

Defined in Data.Array.Accelerate.LLVM.Native.CodeGen

Methods

generate :: (Shape sh, Elt e) => Native -> UID -> Gamma aenv -> IRFun1 Native aenv (sh -> e) -> CodeGen (IROpenAcc Native aenv (Array sh e))

transform :: (Shape sh, Shape sh', Elt a, Elt b) => Native -> UID -> Gamma aenv -> IRFun1 Native aenv (sh' -> sh) -> IRFun1 Native aenv (a -> b) -> IRDelayed Native aenv (Array sh a) -> CodeGen (IROpenAcc Native aenv (Array sh' b))

map :: (Shape sh, Elt a, Elt b) => Native -> UID -> Gamma aenv -> IRFun1 Native aenv (a -> b) -> IRDelayed Native aenv (Array sh a) -> CodeGen (IROpenAcc Native aenv (Array sh b))

fold :: (Shape sh, Elt e) => Native -> UID -> Gamma aenv -> IRFun2 Native aenv (e -> e -> e) -> IRExp Native aenv e -> IRDelayed Native aenv (Array (sh :. Int) e) -> CodeGen (IROpenAcc Native aenv (Array sh e))

fold1 :: (Shape sh, Elt e) => Native -> UID -> Gamma aenv -> IRFun2 Native aenv (e -> e -> e) -> IRDelayed Native aenv (Array (sh :. Int) e) -> CodeGen (IROpenAcc Native aenv (Array sh e))

foldSeg :: (Shape sh, Elt e, Elt i, IsIntegral i) => Native -> UID -> Gamma aenv -> IRFun2 Native aenv (e -> e -> e) -> IRExp Native aenv e -> IRDelayed Native aenv (Array (sh :. Int) e) -> IRDelayed Native aenv (Segments i) -> CodeGen (IROpenAcc Native aenv (Array (sh :. Int) e))

fold1Seg :: (Shape sh, Elt e, Elt i, IsIntegral i) => Native -> UID -> Gamma aenv -> IRFun2 Native aenv (e -> e -> e) -> IRDelayed Native aenv (Array (sh :. Int) e) -> IRDelayed Native aenv (Segments i) -> CodeGen (IROpenAcc Native aenv (Array (sh :. Int) e))

scanl :: (Shape sh, Elt e) => Native -> UID -> Gamma aenv -> IRFun2 Native aenv (e -> e -> e) -> IRExp Native aenv e -> IRDelayed Native aenv (Array (sh :. Int) e) -> CodeGen (IROpenAcc Native aenv (Array (sh :. Int) e))

scanl' :: (Shape sh, Elt e) => Native -> UID -> Gamma aenv -> IRFun2 Native aenv (e -> e -> e) -> IRExp Native aenv e -> IRDelayed Native aenv (Array (sh :. Int) e) -> CodeGen (IROpenAcc Native aenv (Array (sh :. Int) e, Array sh e))

scanl1 :: (Shape sh, Elt e) => Native -> UID -> Gamma aenv -> IRFun2 Native aenv (e -> e -> e) -> IRDelayed Native aenv (Array (sh :. Int) e) -> CodeGen (IROpenAcc Native aenv (Array (sh :. Int) e))

scanr :: (Shape sh, Elt e) => Native -> UID -> Gamma aenv -> IRFun2 Native aenv (e -> e -> e) -> IRExp Native aenv e -> IRDelayed Native aenv (Array (sh :. Int) e) -> CodeGen (IROpenAcc Native aenv (Array (sh :. Int) e))

scanr' :: (Shape sh, Elt e) => Native -> UID -> Gamma aenv -> IRFun2 Native aenv (e -> e -> e) -> IRExp Native aenv e -> IRDelayed Native aenv (Array (sh :. Int) e) -> CodeGen (IROpenAcc Native aenv (Array (sh :. Int) e, Array sh e))

scanr1 :: (Shape sh, Elt e) => Native -> UID -> Gamma aenv -> IRFun2 Native aenv (e -> e -> e) -> IRDelayed Native aenv (Array (sh :. Int) e) -> CodeGen (IROpenAcc Native aenv (Array (sh :. Int) e))

permute :: (Shape sh, Shape sh', Elt e) => Native -> UID -> Gamma aenv -> IRPermuteFun Native aenv (e -> e -> e) -> IRFun1 Native aenv (sh -> sh') -> IRDelayed Native aenv (Array sh e) -> CodeGen (IROpenAcc Native aenv (Array sh' e))

backpermute :: (Shape sh, Shape sh', Elt e) => Native -> UID -> Gamma aenv -> IRFun1 Native aenv (sh' -> sh) -> IRDelayed Native aenv (Array sh e) -> CodeGen (IROpenAcc Native aenv (Array sh' e))

stencil :: (Stencil sh a stencil, Elt b) => Native -> UID -> Gamma aenv -> IRFun1 Native aenv (stencil -> b) -> IRBoundary Native aenv (Array sh a) -> IRDelayed Native aenv (Array sh a) -> CodeGen (IROpenAcc Native aenv (Array sh b))

stencil2 :: (Stencil sh a stencil1, Stencil sh b stencil2, Elt c) => Native -> UID -> Gamma aenv -> IRFun2 Native aenv (stencil1 -> stencil2 -> c) -> IRBoundary Native aenv (Array sh a) -> IRDelayed Native aenv (Array sh a) -> IRBoundary Native aenv (Array sh b) -> IRDelayed Native aenv (Array sh b) -> CodeGen (IROpenAcc Native aenv (Array sh c))

Persistent Native 
Instance details

Defined in Data.Array.Accelerate.LLVM.Native.Compile.Cache

Embed Native 
Instance details

Defined in Data.Array.Accelerate.LLVM.Native.Embed

Methods

embedForTarget :: Native -> ObjectR Native -> Q (TExp (ExecutableR Native))

Execute Native 
Instance details

Defined in Data.Array.Accelerate.LLVM.Native.Execute

Methods

map :: (Shape sh, Elt b) => ExecutableR Native -> Gamma aenv -> AvalR Native aenv -> StreamR Native -> sh -> LLVM Native (Array sh b)

generate :: (Shape sh, Elt e) => ExecutableR Native -> Gamma aenv -> AvalR Native aenv -> StreamR Native -> sh -> LLVM Native (Array sh e)

transform :: (Shape sh, Elt e) => ExecutableR Native -> Gamma aenv -> AvalR Native aenv -> StreamR Native -> sh -> LLVM Native (Array sh e)

backpermute :: (Shape sh, Elt e) => ExecutableR Native -> Gamma aenv -> AvalR Native aenv -> StreamR Native -> sh -> LLVM Native (Array sh e)

fold :: (Shape sh, Elt e) => ExecutableR Native -> Gamma aenv -> AvalR Native aenv -> StreamR Native -> (sh :. Int) -> LLVM Native (Array sh e)

fold1 :: (Shape sh, Elt e) => ExecutableR Native -> Gamma aenv -> AvalR Native aenv -> StreamR Native -> (sh :. Int) -> LLVM Native (Array sh e)

foldSeg :: (Shape sh, Elt e) => ExecutableR Native -> Gamma aenv -> AvalR Native aenv -> StreamR Native -> (sh :. Int) -> DIM1 -> LLVM Native (Array (sh :. Int) e)

fold1Seg :: (Shape sh, Elt e) => ExecutableR Native -> Gamma aenv -> AvalR Native aenv -> StreamR Native -> (sh :. Int) -> DIM1 -> LLVM Native (Array (sh :. Int) e)

scanl :: (Shape sh, Elt e) => ExecutableR Native -> Gamma aenv -> AvalR Native aenv -> StreamR Native -> (sh :. Int) -> LLVM Native (Array (sh :. Int) e)

scanl1 :: (Shape sh, Elt e) => ExecutableR Native -> Gamma aenv -> AvalR Native aenv -> StreamR Native -> (sh :. Int) -> LLVM Native (Array (sh :. Int) e)

scanl' :: (Shape sh, Elt e) => ExecutableR Native -> Gamma aenv -> AvalR Native aenv -> StreamR Native -> (sh :. Int) -> LLVM Native (Array (sh :. Int) e, Array sh e)

scanr :: (Shape sh, Elt e) => ExecutableR Native -> Gamma aenv -> AvalR Native aenv -> StreamR Native -> (sh :. Int) -> LLVM Native (Array (sh :. Int) e)

scanr1 :: (Shape sh, Elt e) => ExecutableR Native -> Gamma aenv -> AvalR Native aenv -> StreamR Native -> (sh :. Int) -> LLVM Native (Array (sh :. Int) e)

scanr' :: (Shape sh, Elt e) => ExecutableR Native -> Gamma aenv -> AvalR Native aenv -> StreamR Native -> (sh :. Int) -> LLVM Native (Array (sh :. Int) e, Array sh e)

permute :: (Shape sh, Shape sh', Elt e) => ExecutableR Native -> Gamma aenv -> AvalR Native aenv -> StreamR Native -> Bool -> sh -> Array sh' e -> LLVM Native (Array sh' e)

stencil1 :: (Shape sh, Elt e) => ExecutableR Native -> Gamma aenv -> AvalR Native aenv -> StreamR Native -> sh -> LLVM Native (Array sh e)

stencil2 :: (Shape sh, Elt e) => ExecutableR Native -> Gamma aenv -> AvalR Native aenv -> StreamR Native -> sh -> sh -> LLVM Native (Array sh e)

aforeign :: (Arrays as, Arrays bs) => String -> (StreamR Native -> as -> LLVM Native bs) -> StreamR Native -> as -> LLVM Native bs

Link Native 
Instance details

Defined in Data.Array.Accelerate.LLVM.Native.Link

Associated Types

data ExecutableR Native :: Type

Methods

linkForTarget :: ObjectR Native -> LLVM Native (ExecutableR Native)

Compile Native 
Instance details

Defined in Data.Array.Accelerate.LLVM.Native.Compile

Associated Types

data ObjectR Native :: Type

Methods

compileForTarget :: DelayedOpenAcc aenv a -> Gamma aenv -> LLVM Native (ObjectR Native)

Foreign Native 
Instance details

Defined in Data.Array.Accelerate.LLVM.Native.Foreign

Methods

foreignAcc :: (Foreign asm, Typeable a, Typeable b) => Native -> asm (a -> b) -> Maybe (StreamR Native -> a -> LLVM Native b)

foreignExp :: (Foreign asm, Typeable x, Typeable y) => Native -> asm (x -> y) -> Maybe (IRFun1 Native () (x -> y))

Intrinsic Native 
Instance details

Defined in Data.Array.Accelerate.LLVM.Native.Compile

Target Native Source # 
Instance details

Defined in Data.Array.Accelerate.LLVM.Native.Target

Remote Native

Data instance for arrays in the native backend. We assume a shared-memory machine, and just manipulate the underlying Haskell array directly.

Instance details

Defined in Data.Array.Accelerate.LLVM.Native.Array.Data

Methods

allocateRemote :: (Shape sh, Elt e) => sh -> LLVM Native (Array sh e)

useRemoteR :: (ArrayElt e, ArrayPtrs e ~ Ptr a, Storable a, Typeable a, Typeable e) => Int -> Maybe (StreamR Native) -> ArrayData e -> LLVM Native ()

copyToRemoteR :: (ArrayElt e, ArrayPtrs e ~ Ptr a, Storable a, Typeable a, Typeable e) => Int -> Int -> Maybe (StreamR Native) -> ArrayData e -> LLVM Native ()

copyToHostR :: (ArrayElt e, ArrayPtrs e ~ Ptr a, Storable a, Typeable a, Typeable e) => Int -> Int -> Maybe (StreamR Native) -> ArrayData e -> LLVM Native ()

copyToPeerR :: (ArrayElt e, ArrayPtrs e ~ Ptr a, Storable a, Typeable a, Typeable e) => Int -> Int -> Native -> Maybe (StreamR Native) -> ArrayData e -> LLVM Native ()

indexRemote :: Array sh e -> Int -> LLVM Native e

Async Native 
Instance details

Defined in Data.Array.Accelerate.LLVM.Native.Execute.Async

Associated Types

type StreamR Native :: Type

type EventR Native :: Type

Methods

fork :: LLVM Native (StreamR Native)

join :: StreamR Native -> LLVM Native ()

checkpoint :: StreamR Native -> LLVM Native (EventR Native)

after :: StreamR Native -> EventR Native -> LLVM Native ()

block :: EventR Native -> LLVM Native ()

Marshalable Native Int 
Instance details

Defined in Data.Array.Accelerate.LLVM.Native.Execute.Marshal

Methods

marshal' :: Native -> StreamR Native -> Int -> IO (DList (ArgR Native))

ArrayElt e => Marshalable Native (ArrayData e) 
Instance details

Defined in Data.Array.Accelerate.LLVM.Native.Execute.Marshal

Methods

marshal' :: Native -> StreamR Native -> ArrayData e -> IO (DList (ArgR Native))

data ExecutableR Native 
Instance details

Defined in Data.Array.Accelerate.LLVM.Native.Link

data ExecutableR Native = NativeR {}
data ObjectR Native 
Instance details

Defined in Data.Array.Accelerate.LLVM.Native.Compile

type ArgR Native 
Instance details

Defined in Data.Array.Accelerate.LLVM.Native.Execute.Marshal

type ArgR Native = Arg
type EventR Native 
Instance details

Defined in Data.Array.Accelerate.LLVM.Native.Execute.Async

type EventR Native = ()
type StreamR Native 
Instance details

Defined in Data.Array.Accelerate.LLVM.Native.Execute.Async

type StreamR Native = ()
data KernelMetadata Native 
Instance details

Defined in Data.Array.Accelerate.LLVM.Native.CodeGen.Base

data KernelMetadata Native = KM_Native ()

liftIO :: MonadIO m => IO a -> m a #

Lift a computation from the IO monad.

cloneArray :: (Shape sh, Elt e) => Array sh e -> LLVM Native (Array sh e) Source #

Copy an array into a newly allocated array. This uses memcpy.

Orphan instances

Foreign Native Source # 
Instance details

Methods

foreignAcc :: (Foreign asm, Typeable a, Typeable b) => Native -> asm (a -> b) -> Maybe (StreamR Native -> a -> LLVM Native b)

foreignExp :: (Foreign asm, Typeable x, Typeable y) => Native -> asm (x -> y) -> Maybe (IRFun1 Native () (x -> y))