module Futhark.CodeGen.OpenCL.Heuristics
( SizeHeuristic (..)
, DeviceType (..)
, WhichSize (..)
, HeuristicValue (..)
, sizeHeuristicsTable
)
where
data DeviceType = DeviceCPU | DeviceGPU
data HeuristicValue = HeuristicConst Int
| HeuristicDeviceInfo String
data WhichSize = LockstepWidth | NumGroups | GroupSize | TileSize | Threshold
data SizeHeuristic =
SizeHeuristic { SizeHeuristic -> String
platformName :: String
, SizeHeuristic -> DeviceType
deviceType :: DeviceType
, SizeHeuristic -> WhichSize
heuristicSize :: WhichSize
, SizeHeuristic -> HeuristicValue
heuristicValue :: HeuristicValue
}
sizeHeuristicsTable :: [SizeHeuristic]
sizeHeuristicsTable :: [SizeHeuristic]
sizeHeuristicsTable =
[ String
-> DeviceType -> WhichSize -> HeuristicValue -> SizeHeuristic
SizeHeuristic String
"NVIDIA CUDA" DeviceType
DeviceGPU WhichSize
LockstepWidth (HeuristicValue -> SizeHeuristic)
-> HeuristicValue -> SizeHeuristic
forall a b. (a -> b) -> a -> b
$ Int -> HeuristicValue
HeuristicConst Int
32
, String
-> DeviceType -> WhichSize -> HeuristicValue -> SizeHeuristic
SizeHeuristic String
"AMD Accelerated Parallel Processing" DeviceType
DeviceGPU WhichSize
LockstepWidth (HeuristicValue -> SizeHeuristic)
-> HeuristicValue -> SizeHeuristic
forall a b. (a -> b) -> a -> b
$ Int -> HeuristicValue
HeuristicConst Int
32
, String
-> DeviceType -> WhichSize -> HeuristicValue -> SizeHeuristic
SizeHeuristic String
"" DeviceType
DeviceGPU WhichSize
LockstepWidth (HeuristicValue -> SizeHeuristic)
-> HeuristicValue -> SizeHeuristic
forall a b. (a -> b) -> a -> b
$ Int -> HeuristicValue
HeuristicConst Int
1
, String
-> DeviceType -> WhichSize -> HeuristicValue -> SizeHeuristic
SizeHeuristic String
"" DeviceType
DeviceGPU WhichSize
NumGroups (HeuristicValue -> SizeHeuristic)
-> HeuristicValue -> SizeHeuristic
forall a b. (a -> b) -> a -> b
$ Int -> HeuristicValue
HeuristicConst Int
256
, String
-> DeviceType -> WhichSize -> HeuristicValue -> SizeHeuristic
SizeHeuristic String
"" DeviceType
DeviceGPU WhichSize
GroupSize (HeuristicValue -> SizeHeuristic)
-> HeuristicValue -> SizeHeuristic
forall a b. (a -> b) -> a -> b
$ Int -> HeuristicValue
HeuristicConst Int
256
, String
-> DeviceType -> WhichSize -> HeuristicValue -> SizeHeuristic
SizeHeuristic String
"" DeviceType
DeviceGPU WhichSize
TileSize (HeuristicValue -> SizeHeuristic)
-> HeuristicValue -> SizeHeuristic
forall a b. (a -> b) -> a -> b
$ Int -> HeuristicValue
HeuristicConst Int
32
, String
-> DeviceType -> WhichSize -> HeuristicValue -> SizeHeuristic
SizeHeuristic String
"" DeviceType
DeviceGPU WhichSize
Threshold (HeuristicValue -> SizeHeuristic)
-> HeuristicValue -> SizeHeuristic
forall a b. (a -> b) -> a -> b
$ Int -> HeuristicValue
HeuristicConst (Int -> HeuristicValue) -> Int -> HeuristicValue
forall a b. (a -> b) -> a -> b
$ Int
32Int -> Int -> Int
forall a. Num a => a -> a -> a
*Int
1024
, String
-> DeviceType -> WhichSize -> HeuristicValue -> SizeHeuristic
SizeHeuristic String
"" DeviceType
DeviceCPU WhichSize
LockstepWidth (HeuristicValue -> SizeHeuristic)
-> HeuristicValue -> SizeHeuristic
forall a b. (a -> b) -> a -> b
$ Int -> HeuristicValue
HeuristicConst Int
1
, String
-> DeviceType -> WhichSize -> HeuristicValue -> SizeHeuristic
SizeHeuristic String
"" DeviceType
DeviceCPU WhichSize
NumGroups (HeuristicValue -> SizeHeuristic)
-> HeuristicValue -> SizeHeuristic
forall a b. (a -> b) -> a -> b
$ String -> HeuristicValue
HeuristicDeviceInfo String
"MAX_COMPUTE_UNITS"
, String
-> DeviceType -> WhichSize -> HeuristicValue -> SizeHeuristic
SizeHeuristic String
"" DeviceType
DeviceCPU WhichSize
GroupSize (HeuristicValue -> SizeHeuristic)
-> HeuristicValue -> SizeHeuristic
forall a b. (a -> b) -> a -> b
$ Int -> HeuristicValue
HeuristicConst Int
32
, String
-> DeviceType -> WhichSize -> HeuristicValue -> SizeHeuristic
SizeHeuristic String
"" DeviceType
DeviceCPU WhichSize
TileSize (HeuristicValue -> SizeHeuristic)
-> HeuristicValue -> SizeHeuristic
forall a b. (a -> b) -> a -> b
$ Int -> HeuristicValue
HeuristicConst Int
4
, String
-> DeviceType -> WhichSize -> HeuristicValue -> SizeHeuristic
SizeHeuristic String
"" DeviceType
DeviceCPU WhichSize
Threshold (HeuristicValue -> SizeHeuristic)
-> HeuristicValue -> SizeHeuristic
forall a b. (a -> b) -> a -> b
$ String -> HeuristicValue
HeuristicDeviceInfo String
"MAX_COMPUTE_UNITS"
]