futhark-0.25.32: An optimising compiler for a functional, array-oriented language.

Safe Haskell | None
Language | GHC2021

Futhark.CodeGen.OpenCL.Heuristics

Description

Some GPU platforms have a SIMDwarpwavefront-based execution model that execute blocks of threads in lockstep, permitting us to perform cross-thread synchronisation within each such block without the use of barriers. Unfortunately, there seems to be no reliable way to query these sizes at runtime. Instead, we use builtin tables to figure out which size we should use for a specific platform and device. If nothing matches here, the wave size should be set to one.

We also use this to select reasonable default block sizes and block counts.

Synopsis

- data SizeHeuristic = SizeHeuristic {
  - platformName :: String
  - deviceType :: DeviceType
  - heuristicSize :: WhichSize
  - heuristicValue :: TPrimExp Int32 DeviceInfo
  }
- data DeviceType
  - = DeviceCPU
  - | DeviceGPU
- data WhichSize
  - = LockstepWidth
  - | NumBlocks
  - | BlockSize
  - | TileSize
  - | RegTileSize
  - | Threshold
- newtype DeviceInfo = DeviceInfo String
- sizeHeuristicsTable :: [SizeHeuristic]

# Documentation

data SizeHeuristic Source #

A heuristic for setting the default value for something.

Constructors

SizeHeuristic |

Fields

- platformName :: String
- deviceType :: DeviceType
- heuristicSize :: WhichSize
- heuristicValue :: TPrimExp Int32 DeviceInfo

data DeviceType Source #

The type of OpenCL device that this heuristic applies to.

Constructors

DeviceCPU |
DeviceGPU |

data WhichSize Source #

A size that can be assigned a default.

Constructors

LockstepWidth |
NumBlocks |
BlockSize |
TileSize |
RegTileSize |
Threshold |

newtype DeviceInfo Source #

The value supplies by a heuristic can depend on some device information. This will be translated into a call to `clGetDeviceInfo()`. Make sure to only request info that can be casted to a scalar type.

Constructors

DeviceInfo String |

#### Instances

Instances details

Pretty DeviceInfo Source # |
Instance details Defined in Futhark.CodeGen.OpenCL.Heuristics Methods pretty :: DeviceInfo -> Doc ann Source # prettyList :: [DeviceInfo] -> Doc ann Source #

sizeHeuristicsTable :: [SizeHeuristic] Source #

All of our heuristics.