futhark-0.23.1: An optimising compiler for a functional, array-oriented language.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Futhark.CodeGen.ImpGen.Multicore.Base

Synopsis

Documentation

extractAllocations :: MCCode -> (MCCode, MCCode) Source #

Try to extract invariant allocations. If we assume that the given MCCode is the body of a SegOp, then it is always safe to move the immediate allocations to the prebody.

data Locks Source #

Information about the locks available for accumulators.

Constructors

Locks 

type AtomicBinOp = BinOp -> Maybe (VName -> VName -> Count Elements (TExp Int32) -> Exp -> AtomicOp) Source #

Is there an atomic BinOp corresponding to this BinOp?

data AtomicUpdate rep r Source #

The mechanism that will be used for performing the atomic update. Approximates how efficient it will be. Ordered from most to least efficient.

Constructors

AtomicPrim (DoAtomicUpdate rep r) 
AtomicCAS (DoAtomicUpdate rep r)

Can be done by efficient swaps.

AtomicLocking (Locking -> DoAtomicUpdate rep r)

Requires explicit locking.

type DoAtomicUpdate rep r = [VName] -> [TExp Int64] -> MulticoreGen () Source #

A function for generating code for an atomic update. Assumes that the bucket is in-bounds.

data Locking Source #

Locking strategy used for an atomic update.

Constructors

Locking 

Fields

data ChunkLoopVectorization Source #

Indicates whether to vectorize a chunk loop or keep it sequential. We use this to allow falling back to sequential chunk loops in cases we don't care about trying to vectorize.

Constructors

Vectorized 
Scalar 

generateChunkLoop :: String -> ChunkLoopVectorization -> (TExp Int64 -> MulticoreGen ()) -> MulticoreGen () Source #

Emit code for the chunk loop, given an action that generates code for a single iteration.

The action is called with the (symbolic) index of the current iteration.

generateUniformizeLoop :: (TExp Int64 -> MulticoreGen ()) -> MulticoreGen () Source #

Emit code for a sequential loop over each vector lane, given and action that generates code for a single iteration. The action is called with the symbolic index of the current iteration.

extractVectorLane :: TExp Int64 -> MulticoreGen MCCode -> MulticoreGen () Source #

Given a piece of code, if that code performs an assignment, turn that assignment into an extraction of element from a vector on the right hand side, using a passed index for the extraction. Other code is left as is.

inISPC :: MulticoreGen () -> MulticoreGen () Source #

Given an action that may generate some code, put that code into an ISPC kernel.

sLoopNestVectorized :: Shape -> ([TExp Int64] -> MulticoreGen ()) -> MulticoreGen () Source #

Like sLoopNest, but puts a vectorized loop at the innermost layer.