module Futhark.CodeGen.ImpCode.OpenCL
( Program (..)
, Function
, FunctionT (Function)
, Code
, KernelName
, KernelArg (..)
, OpenCL (..)
, KernelTarget (..)
, module Futhark.CodeGen.ImpCode
, module Futhark.Representation.Kernels.Sizes
)
where
import qualified Data.Map as M
import Futhark.CodeGen.ImpCode hiding (Function, Code)
import Futhark.Representation.Kernels.Sizes
import qualified Futhark.CodeGen.ImpCode as Imp
import Futhark.Util.Pretty
data Program = Program { openClProgram :: String
, openClPrelude :: String
, openClKernelNames :: [KernelName]
, openClUsedTypes :: [PrimType]
, openClSizes :: M.Map Name SizeClass
, hostFunctions :: Functions OpenCL
}
type Function = Imp.Function OpenCL
type Code = Imp.Code OpenCL
type KernelName = String
data KernelArg = ValueKArg Exp PrimType
| MemKArg VName
| SharedMemoryKArg (Count Bytes)
deriving (Show)
data OpenCL = LaunchKernel KernelName [KernelArg] [Exp] [Exp]
| HostCode Code
| GetSize VName Name
| CmpSizeLe VName Name Exp
| GetSizeMax VName SizeClass
deriving (Show)
data KernelTarget = TargetOpenCL
| TargetCUDA
deriving (Eq)
instance Pretty OpenCL where
ppr = text . show