Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
A simple representation with SOACs and nested parallelism.
Synopsis
- data SOACS
- type Body = Body SOACS
- type Stm = Stm SOACS
- type Pat = Pat SOACS
- type Exp = Exp SOACS
- type Lambda = Lambda SOACS
- type FParam = FParam SOACS
- type LParam = LParam SOACS
- type RetType = RetType SOACS
- type PatElem = PatElem SOACS
- module Futhark.IR.Prop
- module Futhark.IR.Traversals
- module Futhark.IR.Pretty
- data Int8
- data Int16
- data Int32
- data Int64
- data Word8
- data Word16
- data Word32
- data Word64
- data Half
- srclocOf :: Located a => a -> SrcLoc
- data Loc
- data SrcLoc
- class Located a where
- pretty :: Pretty a => a -> String
- data ConvOp
- data CmpOp
- data BinOp
- = Add IntType Overflow
- | FAdd FloatType
- | Sub IntType Overflow
- | FSub FloatType
- | Mul IntType Overflow
- | FMul FloatType
- | UDiv IntType Safety
- | UDivUp IntType Safety
- | SDiv IntType Safety
- | SDivUp IntType Safety
- | FDiv FloatType
- | FMod FloatType
- | UMod IntType Safety
- | SMod IntType Safety
- | SQuot IntType Safety
- | SRem IntType Safety
- | SMin IntType
- | UMin IntType
- | FMin FloatType
- | SMax IntType
- | UMax IntType
- | FMax FloatType
- | Shl IntType
- | LShr IntType
- | AShr IntType
- | And IntType
- | Or IntType
- | Xor IntType
- | Pow IntType
- | FPow FloatType
- | LogAnd
- | LogOr
- data Safety
- data Overflow
- data UnOp
- data PrimValue
- data FloatValue
- data IntValue
- = Int8Value !Int8
- | Int16Value !Int16
- | Int32Value !Int32
- | Int64Value !Int64
- data PrimType
- data FloatType
- data IntType
- allIntTypes :: [IntType]
- allFloatTypes :: [FloatType]
- allPrimTypes :: [PrimType]
- intValue :: Integral int => IntType -> int -> IntValue
- intValueType :: IntValue -> IntType
- valueIntegral :: Integral int => IntValue -> int
- floatValue :: Real num => FloatType -> num -> FloatValue
- floatValueType :: FloatValue -> FloatType
- primValueType :: PrimValue -> PrimType
- blankPrimValue :: PrimType -> PrimValue
- allUnOps :: [UnOp]
- allBinOps :: [BinOp]
- allCmpOps :: [CmpOp]
- allConvOps :: [ConvOp]
- doUnOp :: UnOp -> PrimValue -> Maybe PrimValue
- doComplement :: IntValue -> IntValue
- doAbs :: IntValue -> IntValue
- doFAbs :: FloatValue -> FloatValue
- doSSignum :: IntValue -> IntValue
- doUSignum :: IntValue -> IntValue
- doBinOp :: BinOp -> PrimValue -> PrimValue -> Maybe PrimValue
- doAdd :: IntValue -> IntValue -> IntValue
- doMul :: IntValue -> IntValue -> IntValue
- doSDiv :: IntValue -> IntValue -> Maybe IntValue
- doSMod :: IntValue -> IntValue -> Maybe IntValue
- doPow :: IntValue -> IntValue -> Maybe IntValue
- doConvOp :: ConvOp -> PrimValue -> Maybe PrimValue
- flipConvOp :: ConvOp -> ConvOp
- doZExt :: IntValue -> IntType -> IntValue
- doSExt :: IntValue -> IntType -> IntValue
- doFPConv :: FloatValue -> FloatType -> FloatValue
- doFPToUI :: FloatValue -> IntType -> IntValue
- doFPToSI :: FloatValue -> IntType -> IntValue
- doUIToFP :: IntValue -> FloatType -> FloatValue
- doSIToFP :: IntValue -> FloatType -> FloatValue
- doCmpOp :: CmpOp -> PrimValue -> PrimValue -> Maybe Bool
- doCmpEq :: PrimValue -> PrimValue -> Bool
- doCmpUlt :: IntValue -> IntValue -> Bool
- doCmpUle :: IntValue -> IntValue -> Bool
- doCmpSlt :: IntValue -> IntValue -> Bool
- doCmpSle :: IntValue -> IntValue -> Bool
- doFCmpLt :: FloatValue -> FloatValue -> Bool
- doFCmpLe :: FloatValue -> FloatValue -> Bool
- intToWord64 :: IntValue -> Word64
- intToInt64 :: IntValue -> Int64
- binOpType :: BinOp -> PrimType
- cmpOpType :: CmpOp -> PrimType
- unOpType :: UnOp -> PrimType
- convOpType :: ConvOp -> (PrimType, PrimType)
- primFuns :: Map String ([PrimType], PrimType, [PrimValue] -> Maybe PrimValue)
- zeroIsh :: PrimValue -> Bool
- oneIsh :: PrimValue -> Bool
- negativeIsh :: PrimValue -> Bool
- zeroIshInt :: IntValue -> Bool
- oneIshInt :: IntValue -> Bool
- primBitSize :: PrimType -> Int
- primByteSize :: Num a => PrimType -> a
- intByteSize :: Num a => IntType -> a
- floatByteSize :: Num a => FloatType -> a
- commutativeBinOp :: BinOp -> Bool
- convOpFun :: ConvOp -> String
- prettySigned :: Bool -> PrimType -> String
- data VName = VName !Name !Int
- data Name
- data Uniqueness
- defaultEntryPoint :: Name
- nameToString :: Name -> String
- nameFromString :: String -> Name
- nameToText :: Name -> Text
- nameFromText :: Text -> Name
- locStr :: Located a => a -> String
- locStrRel :: (Located a, Located b) => a -> b -> String
- prettyStacktrace :: Int -> [String] -> String
- baseTag :: VName -> Int
- baseName :: VName -> Name
- baseString :: VName -> String
- quote :: String -> String
- pquote :: Doc -> Doc
- data ErrorMsgPart a
- newtype ErrorMsg a = ErrorMsg [ErrorMsgPart a]
- data PatElemT dec
- data FlatSlice d = FlatSlice d [FlatDimIndex d]
- data FlatDimIndex d = FlatDimIndex d d
- newtype Slice d = Slice {}
- data DimIndex d
- data Param dec = Param {}
- data SubExp
- newtype Certs = Certs {}
- data Ident = Ident {}
- data Diet
- type DeclExtType = TypeBase ExtShape Uniqueness
- type DeclType = TypeBase Shape Uniqueness
- type ExtType = TypeBase ExtShape NoUniqueness
- type Type = TypeBase Shape NoUniqueness
- data TypeBase shape u
- data NoUniqueness = NoUniqueness
- type SpaceId = String
- data Space
- class (Monoid a, Eq a, Ord a) => ArrayShape a where
- newtype Rank = Rank Int
- type ExtShape = ShapeBase ExtSize
- type ExtSize = Ext SubExp
- data Ext a
- type Shape = ShapeBase SubExp
- newtype ShapeBase d = Shape {
- shapeDims :: [d]
- data Commutativity
- dimFix :: DimIndex d -> Maybe d
- sliceIndices :: Slice d -> Maybe [d]
- sliceDims :: Slice d -> [d]
- unitSlice :: Num d => d -> d -> DimIndex d
- fixSlice :: Num d => Slice d -> [d] -> [d]
- sliceSlice :: Num d => Slice d -> Slice d -> Slice d
- flatSliceDims :: FlatSlice d -> [d]
- flatSliceStrides :: FlatSlice d -> [d]
- errorMsgArgTypes :: ErrorMsg a -> [PrimType]
- class (Show rt, Eq rt, Ord rt, DeclExtTyped rt) => IsRetType rt where
- primRetType :: PrimType -> rt
- applyRetType :: Typed dec => [rt] -> [Param dec] -> [(SubExp, Type)] -> Maybe [rt]
- class (Show rt, Eq rt, Ord rt, ExtTyped rt) => IsBodyType rt where
- primBodyType :: PrimType -> rt
- expectedTypes :: Typed t => [VName] -> [t] -> [SubExp] -> [Type]
- class (Show (LetDec l), Show (ExpDec l), Show (BodyDec l), Show (FParamInfo l), Show (LParamInfo l), Show (RetType l), Show (BranchType l), Show (Op l), Eq (LetDec l), Eq (ExpDec l), Eq (BodyDec l), Eq (FParamInfo l), Eq (LParamInfo l), Eq (RetType l), Eq (BranchType l), Eq (Op l), Ord (LetDec l), Ord (ExpDec l), Ord (BodyDec l), Ord (FParamInfo l), Ord (LParamInfo l), Ord (RetType l), Ord (BranchType l), Ord (Op l), IsRetType (RetType l), IsBodyType (BranchType l), Typed (FParamInfo l), Typed (LParamInfo l), Typed (LetDec l), DeclTyped (FParamInfo l)) => RepTypes l where
- type LetDec l :: Type
- type ExpDec l :: Type
- type BodyDec l :: Type
- type FParamInfo l :: Type
- type LParamInfo l :: Type
- type BranchType l :: Type
- type Op l :: Type
- data Prog rep = Prog {
- progConsts :: Stms rep
- progFuns :: [FunDef rep]
- type EntryPoint = (Name, [EntryParam], [EntryPointType])
- data EntryParam = EntryParam {}
- data EntryPointType
- data FunDef rep = FunDef {
- funDefEntryPoint :: Maybe EntryPoint
- funDefAttrs :: Attrs
- funDefName :: Name
- funDefRetType :: [RetType rep]
- funDefParams :: [FParam rep]
- funDefBody :: BodyT rep
- data LambdaT rep
- data IfSort
- data IfDec rt = IfDec {}
- data LoopForm rep
- data ExpT rep
- data BasicOp
- = SubExp SubExp
- | Opaque OpaqueOp SubExp
- | ArrayLit [SubExp] Type
- | UnOp UnOp SubExp
- | BinOp BinOp SubExp SubExp
- | CmpOp CmpOp SubExp SubExp
- | ConvOp ConvOp SubExp
- | Assert SubExp (ErrorMsg SubExp) (SrcLoc, [SrcLoc])
- | Index VName (Slice SubExp)
- | Update Safety VName (Slice SubExp) SubExp
- | FlatIndex VName (FlatSlice SubExp)
- | FlatUpdate VName (FlatSlice SubExp) VName
- | Concat Int VName [VName] SubExp
- | Copy VName
- | Manifest [Int] VName
- | Iota SubExp SubExp SubExp IntType
- | Replicate Shape SubExp
- | Scratch PrimType [SubExp]
- | Reshape (ShapeChange SubExp) VName
- | Rearrange [Int] VName
- | Rotate [SubExp] VName
- | UpdateAcc VName [SubExp] [SubExp]
- data OpaqueOp
- type ShapeChange d = [DimChange d]
- data DimChange d
- = DimCoercion d
- | DimNew d
- data BodyT rep
- type Result = [SubExpRes]
- data SubExpRes = SubExpRes {}
- type Stms rep = Seq (Stm rep)
- pattern Let :: Pat rep -> StmAux (ExpDec rep) -> Exp rep -> Stm rep
- stmExp :: Stm rep -> Exp rep
- stmPat :: Stm rep -> Pat rep
- stmAux :: Stm rep -> StmAux (ExpDec rep)
- data StmAux dec = StmAux {
- stmAuxCerts :: !Certs
- stmAuxAttrs :: Attrs
- stmAuxDec :: dec
- data PatT dec
- newtype Attrs = Attrs {}
- data Attr
- oneAttr :: Attr -> Attrs
- inAttrs :: Attr -> Attrs -> Bool
- withoutAttrs :: Attrs -> Attrs -> Attrs
- oneStm :: Stm rep -> Stms rep
- stmsFromList :: [Stm rep] -> Stms rep
- stmsToList :: Stms rep -> [Stm rep]
- stmsHead :: Stms rep -> Maybe (Stm rep, Stms rep)
- subExpRes :: SubExp -> SubExpRes
- varRes :: VName -> SubExpRes
- subExpsRes :: [SubExp] -> Result
- varsRes :: [VName] -> Result
- module Futhark.IR.SOACS.SOAC
- data LambdaT rep = Lambda [LParam rep] (BodyT rep) [Type]
- data BodyT rep = Body (BodyDec rep) (Stms rep) Result
- newtype PatT dec = Pat [PatElemT dec]
- data PatElemT dec = PatElem VName dec
Documentation
The rep for the basic representation.
Instances
Syntax types
Module re-exports
module Futhark.IR.Prop
module Futhark.IR.Traversals
module Futhark.IR.Pretty
8-bit signed integer type
Instances
16-bit signed integer type
Instances
32-bit signed integer type
Instances
64-bit signed integer type
Instances
8-bit unsigned integer type
Instances
16-bit unsigned integer type
Instances
32-bit unsigned integer type
Instances
64-bit unsigned integer type
Instances
Instances
Location type, consisting of a beginning position and an end position.
Instances
Eq Loc | |
Data Loc | |
Defined in Data.Loc gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Loc -> c Loc # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Loc # dataTypeOf :: Loc -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Loc) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Loc) # gmapT :: (forall b. Data b => b -> b) -> Loc -> Loc # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Loc -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Loc -> r # gmapQ :: (forall d. Data d => d -> u) -> Loc -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Loc -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Loc -> m Loc # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Loc -> m Loc # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Loc -> m Loc # | |
Ord Loc | |
Read Loc | |
Show Loc | |
Semigroup Loc | |
Monoid Loc | |
Pretty Loc | |
IsLocation Loc | |
Located Loc | |
Source location type. Source location are all equal, which allows AST nodes to be compared modulo location information.
Instances
Eq SrcLoc | |
Data SrcLoc | |
Defined in Data.Loc gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> SrcLoc -> c SrcLoc # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c SrcLoc # toConstr :: SrcLoc -> Constr # dataTypeOf :: SrcLoc -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c SrcLoc) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c SrcLoc) # gmapT :: (forall b. Data b => b -> b) -> SrcLoc -> SrcLoc # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> SrcLoc -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> SrcLoc -> r # gmapQ :: (forall d. Data d => d -> u) -> SrcLoc -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> SrcLoc -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> SrcLoc -> m SrcLoc # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> SrcLoc -> m SrcLoc # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> SrcLoc -> m SrcLoc # | |
Ord SrcLoc | |
Read SrcLoc | |
Show SrcLoc | |
Semigroup SrcLoc | |
Monoid SrcLoc | |
IsLocation SrcLoc | |
Located SrcLoc | |
ToIdent (SrcLoc -> Id) | |
Located values have a location.
Instances
Conversion operators try to generalise the from t0 x to t1
instructions from LLVM.
ZExt IntType IntType | Zero-extend the former integer type to the latter. If the new type is smaller, the result is a truncation. |
SExt IntType IntType | Sign-extend the former integer type to the latter. If the new type is smaller, the result is a truncation. |
FPConv FloatType FloatType | Convert value of the former floating-point type to the latter. If the new type is smaller, the result is a truncation. |
FPToUI FloatType IntType | Convert a floating-point value to the nearest unsigned integer (rounding towards zero). |
FPToSI FloatType IntType | Convert a floating-point value to the nearest signed integer (rounding towards zero). |
UIToFP IntType FloatType | Convert an unsigned integer to a floating-point value. |
SIToFP IntType FloatType | Convert a signed integer to a floating-point value. |
IToB IntType | Convert an integer to a boolean value. Zero becomes false; anything else is true. |
BToI IntType | Convert a boolean to an integer. True is converted to 1 and False to 0. |
Comparison operators are like BinOp
s, but they always return a
boolean value. The somewhat ugly constructor names are straight
out of LLVM.
CmpEq PrimType | All types equality. |
CmpUlt IntType | Unsigned less than. |
CmpUle IntType | Unsigned less than or equal. |
CmpSlt IntType | Signed less than. |
CmpSle IntType | Signed less than or equal. |
FCmpLt FloatType | Floating-point less than. |
FCmpLe FloatType | Floating-point less than or equal. |
CmpLlt | Boolean less than. |
CmpLle | Boolean less than or equal. |
Binary operators. These correspond closely to the binary operators in LLVM. Most are parametrised by their expected input and output types.
Add IntType Overflow | Integer addition. |
FAdd FloatType | Floating-point addition. |
Sub IntType Overflow | Integer subtraction. |
FSub FloatType | Floating-point subtraction. |
Mul IntType Overflow | Integer multiplication. |
FMul FloatType | Floating-point multiplication. |
UDiv IntType Safety | Unsigned integer division. Rounds towards negativity infinity. Note: this is different from LLVM. |
UDivUp IntType Safety | Unsigned integer division. Rounds towards positive infinity. |
SDiv IntType Safety | Signed integer division. Rounds towards negativity infinity. Note: this is different from LLVM. |
SDivUp IntType Safety | Signed integer division. Rounds towards positive infinity. |
FDiv FloatType | Floating-point division. |
FMod FloatType | Floating-point modulus. |
UMod IntType Safety | Unsigned integer modulus; the countepart to |
SMod IntType Safety | Signed integer modulus; the countepart to |
SQuot IntType Safety | Signed integer division. Rounds towards zero. This
corresponds to the |
SRem IntType Safety | Signed integer division. Rounds towards zero. This
corresponds to the |
SMin IntType | Returns the smallest of two signed integers. |
UMin IntType | Returns the smallest of two unsigned integers. |
FMin FloatType | Returns the smallest of two floating-point numbers. |
SMax IntType | Returns the greatest of two signed integers. |
UMax IntType | Returns the greatest of two unsigned integers. |
FMax FloatType | Returns the greatest of two floating-point numbers. |
Shl IntType | Left-shift. |
LShr IntType | Logical right-shift, zero-extended. |
AShr IntType | Arithmetic right-shift, sign-extended. |
And IntType | Bitwise and. |
Or IntType | Bitwise or. |
Xor IntType | Bitwise exclusive-or. |
Pow IntType | Integer exponentiation. |
FPow FloatType | Floating-point exponentiation. |
LogAnd | Boolean and - not short-circuiting. |
LogOr | Boolean or - not short-circuiting. |
Whether something is safe or unsafe (mostly function calls, and
in the context of whether operations are dynamically checked).
When we inline an Unsafe
function, we remove all safety checks in
its body. The Ord
instance picks Unsafe
as being less than
Safe
.
For operations like integer division, a safe division will not explode the computer in case of division by zero, but instead return some unspecified value. This always involves a run-time check, so generally the unsafe variant is what the compiler will insert, but guarded by an explicit assertion elsewhere. Safe operations are useful when the optimiser wants to move e.g. a division to a location where the divisor may be zero, but where the result will only be used when it is non-zero (so it doesn't matter what result is provided with a zero divisor, as long as the program keeps running).
What to do in case of arithmetic overflow. Futhark's semantics are that overflow does wraparound, but for generated code (like address arithmetic), it can be beneficial for overflow to be undefined behaviour, as it allows better optimisation of things such as GPU kernels.
Note that all values of this type are considered equal for Eq
and
Ord
.
Various unary operators. It is a bit ad-hoc what is a unary operator and what is a built-in function. Perhaps these should all go away eventually.
Not | E.g., |
Complement IntType | E.g., |
Abs IntType |
|
FAbs FloatType |
|
SSignum IntType | Signed sign function: |
USignum IntType | Unsigned sign function: |
FSignum FloatType | Floating-point sign function. |
Non-array values.
IntValue !IntValue | |
FloatValue !FloatValue | |
BoolValue !Bool | |
UnitValue | The only value of type |
data FloatValue Source #
A floating-point value.
Instances
Eq FloatValue Source # | |
Defined in Futhark.IR.Primitive (==) :: FloatValue -> FloatValue -> Bool # (/=) :: FloatValue -> FloatValue -> Bool # | |
Ord FloatValue Source # | |
Defined in Futhark.IR.Primitive compare :: FloatValue -> FloatValue -> Ordering # (<) :: FloatValue -> FloatValue -> Bool # (<=) :: FloatValue -> FloatValue -> Bool # (>) :: FloatValue -> FloatValue -> Bool # (>=) :: FloatValue -> FloatValue -> Bool # max :: FloatValue -> FloatValue -> FloatValue # min :: FloatValue -> FloatValue -> FloatValue # | |
Show FloatValue Source # | |
Defined in Futhark.IR.Primitive showsPrec :: Int -> FloatValue -> ShowS # show :: FloatValue -> String # showList :: [FloatValue] -> ShowS # | |
ToExp FloatValue Source # | |
Defined in Futhark.CodeGen.Backends.SimpleRep toExp :: FloatValue -> SrcLoc -> Exp # | |
Pretty FloatValue Source # | |
Defined in Futhark.IR.Primitive | |
IsValue FloatValue Source # | |
Defined in Futhark.IR.Prop.Constants value :: FloatValue -> PrimValue Source # |
An integer value.
Low-level primitive types.
Instances
Bounded PrimType Source # | |
Enum PrimType Source # | |
Eq PrimType Source # | |
Ord PrimType Source # | |
Defined in Futhark.IR.Primitive | |
Show PrimType Source # | |
Pretty PrimType Source # | |
FreeIn PrimType Source # | |
Substitute PrimType Source # | |
Defined in Futhark.Transform.Substitute | |
Rename PrimType Source # | |
Simplifiable PrimType Source # | |
Defined in Futhark.Optimise.Simplify.Engine |
A floating point type.
Instances
Bounded FloatType Source # | |
Enum FloatType Source # | |
Defined in Futhark.IR.Primitive succ :: FloatType -> FloatType # pred :: FloatType -> FloatType # fromEnum :: FloatType -> Int # enumFrom :: FloatType -> [FloatType] # enumFromThen :: FloatType -> FloatType -> [FloatType] # enumFromTo :: FloatType -> FloatType -> [FloatType] # enumFromThenTo :: FloatType -> FloatType -> FloatType -> [FloatType] # | |
Eq FloatType Source # | |
Ord FloatType Source # | |
Defined in Futhark.IR.Primitive | |
Show FloatType Source # | |
Pretty FloatType Source # | |
An integer type, ordered by size. Note that signedness is not a property of the type, but a property of the operations performed on values of these types.
Instances
Bounded IntType Source # | |
Enum IntType Source # | |
Eq IntType Source # | |
Ord IntType Source # | |
Show IntType Source # | |
Pretty IntType Source # | |
allIntTypes :: [IntType] Source #
A list of all integer types.
allFloatTypes :: [FloatType] Source #
A list of all floating-point types.
allPrimTypes :: [PrimType] Source #
A list of all primitive types.
intValueType :: IntValue -> IntType Source #
The type of an integer value.
floatValue :: Real num => FloatType -> num -> FloatValue Source #
Create a FloatValue
from a type and a Rational
.
floatValueType :: FloatValue -> FloatType Source #
The type of a floating-point value.
primValueType :: PrimValue -> PrimType Source #
The type of a basic value.
blankPrimValue :: PrimType -> PrimValue Source #
A "blank" value of the given primitive type - this is zero, or whatever is close to it. Don't depend on this value, but use it for e.g. creating arrays to be populated by do-loops.
allConvOps :: [ConvOp] Source #
A list of all conversion operators for all types.
doComplement :: IntValue -> IntValue Source #
E.g., ~(~1) = 1
.
doFAbs :: FloatValue -> FloatValue Source #
abs(-2.0) = 2.0
.
doSDiv :: IntValue -> IntValue -> Maybe IntValue Source #
Signed integer division. Rounds towards negativity infinity. Note: this is different from LLVM.
doSMod :: IntValue -> IntValue -> Maybe IntValue Source #
Signed integer modulus; the countepart to SDiv
.
flipConvOp :: ConvOp -> ConvOp Source #
Turn the conversion the other way around. Note that most conversions are lossy, so there is no guarantee the value will round-trip.
doZExt :: IntValue -> IntType -> IntValue Source #
Zero-extend the given integer value to the size of the given type. If the type is smaller than the given value, the result is a truncation.
doSExt :: IntValue -> IntType -> IntValue Source #
Sign-extend the given integer value to the size of the given type. If the type is smaller than the given value, the result is a truncation.
doFPConv :: FloatValue -> FloatType -> FloatValue Source #
Convert the former floating-point type to the latter.
doFPToUI :: FloatValue -> IntType -> IntValue Source #
Convert a floating-point value to the nearest unsigned integer (rounding towards zero).
doFPToSI :: FloatValue -> IntType -> IntValue Source #
Convert a floating-point value to the nearest signed integer (rounding towards zero).
doUIToFP :: IntValue -> FloatType -> FloatValue Source #
Convert an unsigned integer to a floating-point value.
doSIToFP :: IntValue -> FloatType -> FloatValue Source #
Convert a signed integer to a floating-point value.
doCmpEq :: PrimValue -> PrimValue -> Bool Source #
Compare any two primtive values for exact equality.
doFCmpLt :: FloatValue -> FloatValue -> Bool Source #
Floating-point less than.
doFCmpLe :: FloatValue -> FloatValue -> Bool Source #
Floating-point less than or equal.
intToWord64 :: IntValue -> Word64 Source #
convOpType :: ConvOp -> (PrimType, PrimType) Source #
The input and output types of a conversion operator.
primFuns :: Map String ([PrimType], PrimType, [PrimValue] -> Maybe PrimValue) Source #
A mapping from names of primitive functions to their parameter types, their result type, and a function for evaluating them.
negativeIsh :: PrimValue -> Bool Source #
Is the given value kind of negative?
zeroIshInt :: IntValue -> Bool Source #
Is the given integer value kind of zero?
primBitSize :: PrimType -> Int Source #
The size of a value of a given primitive type in bites.
primByteSize :: Num a => PrimType -> a Source #
The size of a value of a given primitive type in eight-bit bytes.
intByteSize :: Num a => IntType -> a Source #
The size of a value of a given integer type in eight-bit bytes.
floatByteSize :: Num a => FloatType -> a Source #
The size of a value of a given floating-point type in eight-bit bytes.
commutativeBinOp :: BinOp -> Bool Source #
True if the given binary operator is commutative.
prettySigned :: Bool -> PrimType -> String Source #
True if signed. Only makes a difference for integer types.
A name tagged with some integer. Only the integer is used in
comparisons, no matter the type of vn
.
Instances
The abstract (not really) type representing names in the Futhark
compiler. String
s, being lists of characters, are very slow,
while Text
s are based on byte-arrays.
Instances
data Uniqueness Source #
The uniqueness attribute of a type. This essentially indicates
whether or not in-place modifications are acceptable. With respect
to ordering, Unique
is greater than Nonunique
.
Instances
defaultEntryPoint :: Name Source #
The name of the default program entry point (main).
nameToString :: Name -> String Source #
Convert a name to the corresponding list of characters.
nameFromString :: String -> Name Source #
Convert a list of characters to the corresponding name.
locStr :: Located a => a -> String Source #
A human-readable location string, of the form
filename:lineno:columnno
. This follows the GNU coding standards
for error messages:
https://www.gnu.org/prep/standards/html_node/Errors.html
This function assumes that both start and end position is in the same file (it is not clear what the alternative would even mean).
locStrRel :: (Located a, Located b) => a -> b -> String Source #
Like locStr
, but locStrRel prev now
prints the location now
with the file name left out if the same as prev
. This is useful
when printing messages that are all in the context of some
initially printed location (e.g. the first mention contains the
file name; the rest just line and column name).
prettyStacktrace :: Int -> [String] -> String Source #
Given a list of strings representing entries in the stack trace and the index of the frame to highlight, produce a final newline-terminated string for showing to the user. This string should also be preceded by a newline. The most recent stack frame must come first in the list.
quote :: String -> String Source #
Enclose a string in the prefered quotes used in error messages. These are picked to not collide with characters permitted in identifiers.
data ErrorMsgPart a Source #
A part of an error message.
ErrorString String | A literal string. |
ErrorVal PrimType a | A run-time value. |
Instances
An error message is a list of error parts, which are concatenated to form the final message.
ErrorMsg [ErrorMsgPart a] |
Instances
Functor ErrorMsg Source # | |
Foldable ErrorMsg Source # | |
Defined in Futhark.IR.Syntax.Core fold :: Monoid m => ErrorMsg m -> m # foldMap :: Monoid m => (a -> m) -> ErrorMsg a -> m # foldMap' :: Monoid m => (a -> m) -> ErrorMsg a -> m # foldr :: (a -> b -> b) -> b -> ErrorMsg a -> b # foldr' :: (a -> b -> b) -> b -> ErrorMsg a -> b # foldl :: (b -> a -> b) -> b -> ErrorMsg a -> b # foldl' :: (b -> a -> b) -> b -> ErrorMsg a -> b # foldr1 :: (a -> a -> a) -> ErrorMsg a -> a # foldl1 :: (a -> a -> a) -> ErrorMsg a -> a # elem :: Eq a => a -> ErrorMsg a -> Bool # maximum :: Ord a => ErrorMsg a -> a # minimum :: Ord a => ErrorMsg a -> a # | |
Traversable ErrorMsg Source # | |
Eq a => Eq (ErrorMsg a) Source # | |
Ord a => Ord (ErrorMsg a) Source # | |
Show a => Show (ErrorMsg a) Source # | |
IsString (ErrorMsg a) Source # | |
Defined in Futhark.IR.Syntax.Core fromString :: String -> ErrorMsg a # | |
Pretty a => Pretty (ErrorMsg a) Source # | |
An element of a pattern - consisting of a name and an addditional parametric decoration. This decoration is what is expected to contain the type of the resulting variable.
Instances
FlatSlice d [FlatDimIndex d] |
Instances
data FlatDimIndex d Source #
FlatDimIndex | |
|
Instances
A list of DimIndex
s, indicating how an array should be sliced.
Whenever a function accepts a Slice
, that slice should be total,
i.e, cover all dimensions of the array. Deviators should be
indicated by taking a list of DimIndex
es instead.
Instances
Functor Slice Source # | |
Foldable Slice Source # | |
Defined in Futhark.IR.Syntax.Core fold :: Monoid m => Slice m -> m # foldMap :: Monoid m => (a -> m) -> Slice a -> m # foldMap' :: Monoid m => (a -> m) -> Slice a -> m # foldr :: (a -> b -> b) -> b -> Slice a -> b # foldr' :: (a -> b -> b) -> b -> Slice a -> b # foldl :: (b -> a -> b) -> b -> Slice a -> b # foldl' :: (b -> a -> b) -> b -> Slice a -> b # foldr1 :: (a -> a -> a) -> Slice a -> a # foldl1 :: (a -> a -> a) -> Slice a -> a # elem :: Eq a => a -> Slice a -> Bool # maximum :: Ord a => Slice a -> a # minimum :: Ord a => Slice a -> a # | |
Traversable Slice Source # | |
Eq d => Eq (Slice d) Source # | |
Ord d => Ord (Slice d) Source # | |
Show d => Show (Slice d) Source # | |
Pretty a => Pretty (Slice a) Source # | |
FreeIn d => FreeIn (Slice d) Source # | |
Substitute d => Substitute (Slice d) Source # | |
Defined in Futhark.Transform.Substitute | |
Simplifiable d => Simplifiable (Slice d) Source # | |
Defined in Futhark.Optimise.Simplify.Engine |
How to index a single dimension of an array.
Instances
A function or lambda parameter.
Instances
A subexpression is either a scalar constant or a variable. One important property is that evaluation of a subexpression is guaranteed to complete in constant time.
Instances
A list of names used for certificates in some expressions.
Instances
Eq Certs Source # | |
Ord Certs Source # | |
Show Certs Source # | |
Semigroup Certs Source # | |
Monoid Certs Source # | |
Pretty Certs Source # | |
FreeIn Certs Source # | |
Substitute Certs Source # | |
Defined in Futhark.Transform.Substitute | |
Rename Certs Source # | |
Simplifiable Certs Source # | |
Defined in Futhark.Optimise.Simplify.Engine | |
MonadState (VNameSource, Bool, Certs) (SimpleM rep) Source # | |
Defined in Futhark.Optimise.Simplify.Engine |
An identifier consists of its name and the type of the value bound to the identifier.
Information about which parts of a value/type are consumed. For
example, we might say that a function taking three arguments of
types ([int], *[int], [int])
has diet [Observe, Consume,
Observe]
.
Consume | Consumes this value. |
Observe | Only observes value in this position, does not consume. A result may alias this. |
ObservePrim | As |
type DeclExtType = TypeBase ExtShape Uniqueness Source #
An ExtType
with uniqueness information, used for function
return types.
type DeclType = TypeBase Shape Uniqueness Source #
A type with shape and uniqueness information, used declaring return- and parameters types.
type ExtType = TypeBase ExtShape NoUniqueness Source #
A type with existentially quantified shapes - used as part of function (and function-like) return types. Generally only makes sense when used in a list.
type Type = TypeBase Shape NoUniqueness Source #
A type with shape information, used for describing the type of variables.
data TypeBase shape u Source #
The type of a value. When comparing types for equality with
==
, shapes must match.
Prim PrimType | |
Acc VName Shape [Type] u | Token, index space, element type, and uniqueness. |
Array PrimType shape u | |
Mem Space |
Instances
data NoUniqueness Source #
A fancier name for ()
- encodes no uniqueness information.
Instances
The memory space of a block. If DefaultSpace
, this is the "default"
space, whatever that is. The exact meaning of the SpaceId
depends on the backend used. In GPU kernels, for example, this is
used to distinguish between constant, global and shared memory
spaces. In GPU-enabled host code, it is used to distinguish
between host memory (DefaultSpace
) and GPU space.
DefaultSpace | |
Space SpaceId | |
ScalarSpace [SubExp] PrimType | A special kind of memory that is a statically sized array of some primitive type. Used for private memory on GPUs. |
class (Monoid a, Eq a, Ord a) => ArrayShape a where Source #
A class encompassing types containing array shape information.
shapeRank :: a -> Int Source #
Return the rank of an array with the given size.
stripDims :: Int -> a -> a Source #
stripDims n shape
strips the outer n
dimensions from
shape
.
subShapeOf :: a -> a -> Bool Source #
Check whether one shape if a subset of another shape.
Instances
The size of an array type as merely the number of dimensions, with no further information.
type ExtShape = ShapeBase ExtSize Source #
Like Shape
but some of its elements may be bound in a local
environment instead. These are denoted with integral indices.
Something that may be existential.
Instances
type Shape = ShapeBase SubExp Source #
The size of an array as a list of subexpressions. If a variable, that variable must be in scope where this array is used.
The size of an array type as a list of its dimension sizes, with the type of sizes being parametric.
Instances
data Commutativity Source #
Whether some operator is commutative or not. The Monoid
instance returns the least commutative of its arguments.
Instances
flatSliceDims :: FlatSlice d -> [d] Source #
flatSliceStrides :: FlatSlice d -> [d] Source #
errorMsgArgTypes :: ErrorMsg a -> [PrimType] Source #
How many non-constant parts does the error message have, and what is their type?
class (Show rt, Eq rt, Ord rt, DeclExtTyped rt) => IsRetType rt where Source #
A type representing the return type of a function. In practice,
a list of these will be used. It should contain at least the
information contained in an ExtType
, but may have more, notably
an existential context.
primRetType :: PrimType -> rt Source #
Contruct a return type from a primitive type.
applyRetType :: Typed dec => [rt] -> [Param dec] -> [(SubExp, Type)] -> Maybe [rt] Source #
Given a function return type, the parameters of the function, and the arguments for a concrete call, return the instantiated return type for the concrete call, if valid.
Instances
IsRetType DeclExtType Source # | |
Defined in Futhark.IR.RetType primRetType :: PrimType -> DeclExtType Source # applyRetType :: Typed dec => [DeclExtType] -> [Param dec] -> [(SubExp, Type)] -> Maybe [DeclExtType] Source # | |
IsRetType FunReturns Source # | |
Defined in Futhark.IR.Mem primRetType :: PrimType -> FunReturns Source # applyRetType :: Typed dec => [FunReturns] -> [Param dec] -> [(SubExp, Type)] -> Maybe [FunReturns] Source # |
class (Show rt, Eq rt, Ord rt, ExtTyped rt) => IsBodyType rt where Source #
A type representing the return type of a body. It should contain
at least the information contained in a list of ExtType
s, but may
have more, notably an existential context.
primBodyType :: PrimType -> rt Source #
Construct a body type from a primitive type.
Instances
IsBodyType ExtType Source # | |
Defined in Futhark.IR.RetType primBodyType :: PrimType -> ExtType Source # | |
IsBodyType BodyReturns Source # | |
Defined in Futhark.IR.Mem primBodyType :: PrimType -> BodyReturns Source # |
expectedTypes :: Typed t => [VName] -> [t] -> [SubExp] -> [Type] Source #
Given shape parameter names and types, produce the types of arguments accepted.
class (Show (LetDec l), Show (ExpDec l), Show (BodyDec l), Show (FParamInfo l), Show (LParamInfo l), Show (RetType l), Show (BranchType l), Show (Op l), Eq (LetDec l), Eq (ExpDec l), Eq (BodyDec l), Eq (FParamInfo l), Eq (LParamInfo l), Eq (RetType l), Eq (BranchType l), Eq (Op l), Ord (LetDec l), Ord (ExpDec l), Ord (BodyDec l), Ord (FParamInfo l), Ord (LParamInfo l), Ord (RetType l), Ord (BranchType l), Ord (Op l), IsRetType (RetType l), IsBodyType (BranchType l), Typed (FParamInfo l), Typed (LParamInfo l), Typed (LetDec l), DeclTyped (FParamInfo l)) => RepTypes l Source #
A collection of type families giving various common types for a representation, along with constraints specifying that the types they map to should satisfy some minimal requirements.
type LetDec l :: Type Source #
Decoration for every let-pattern element.
type ExpDec l :: Type Source #
Decoration for every expression.
type ExpDec l = ()
type BodyDec l :: Type Source #
Decoration for every body.
type BodyDec l = ()
type FParamInfo l :: Type Source #
Decoration for every (non-lambda) function parameter.
type FParamInfo l = DeclType
type LParamInfo l :: Type Source #
Decoration for every lambda function parameter.
type LParamInfo l = Type
type BranchType l :: Type Source #
The return type decoration of branches.
type BranchType l = ExtType
Extensible operation.
type Op l = ()
Instances
RepTypes Seq Source # | |
RepTypes SOACS Source # | |
RepTypes SeqMem Source # | |
RepTypes MCMem Source # | |
RepTypes MC Source # | |
RepTypes GPU Source # | |
RepTypes GPUMem Source # | |
(RepTypes rep, CanBeAliased (Op rep)) => RepTypes (Aliases rep) Source # | |
Defined in Futhark.IR.Aliases | |
(RepTypes rep, CanBeWise (Op rep)) => RepTypes (Wise rep) Source # | |
An entire Futhark program.
Prog | |
|
type EntryPoint = (Name, [EntryParam], [EntryPointType]) Source #
Information about the inputs and outputs (return value) of an entry point.
data EntryParam Source #
An entry point parameter, comprising its name and original type.
Instances
Eq EntryParam Source # | |
Defined in Futhark.IR.Syntax (==) :: EntryParam -> EntryParam -> Bool # (/=) :: EntryParam -> EntryParam -> Bool # | |
Ord EntryParam Source # | |
Defined in Futhark.IR.Syntax compare :: EntryParam -> EntryParam -> Ordering # (<) :: EntryParam -> EntryParam -> Bool # (<=) :: EntryParam -> EntryParam -> Bool # (>) :: EntryParam -> EntryParam -> Bool # (>=) :: EntryParam -> EntryParam -> Bool # max :: EntryParam -> EntryParam -> EntryParam # min :: EntryParam -> EntryParam -> EntryParam # | |
Show EntryParam Source # | |
Defined in Futhark.IR.Syntax showsPrec :: Int -> EntryParam -> ShowS # show :: EntryParam -> String # showList :: [EntryParam] -> ShowS # | |
Pretty EntryParam Source # | |
Defined in Futhark.IR.Pretty |
data EntryPointType Source #
Every entry point argument and return value has an annotation indicating how it maps to the original source program type.
TypeUnsigned Uniqueness | Is an unsigned integer or array of unsigned integers. |
TypeOpaque Uniqueness String Int | A black box type comprising this many core values. The string is a human-readable description with no other semantics. |
TypeDirect Uniqueness | Maps directly. |
Instances
Eq EntryPointType Source # | |
Defined in Futhark.IR.Syntax (==) :: EntryPointType -> EntryPointType -> Bool # (/=) :: EntryPointType -> EntryPointType -> Bool # | |
Ord EntryPointType Source # | |
Defined in Futhark.IR.Syntax compare :: EntryPointType -> EntryPointType -> Ordering # (<) :: EntryPointType -> EntryPointType -> Bool # (<=) :: EntryPointType -> EntryPointType -> Bool # (>) :: EntryPointType -> EntryPointType -> Bool # (>=) :: EntryPointType -> EntryPointType -> Bool # max :: EntryPointType -> EntryPointType -> EntryPointType # min :: EntryPointType -> EntryPointType -> EntryPointType # | |
Show EntryPointType Source # | |
Defined in Futhark.IR.Syntax showsPrec :: Int -> EntryPointType -> ShowS # show :: EntryPointType -> String # showList :: [EntryPointType] -> ShowS # | |
Pretty EntryPointType Source # | |
Defined in Futhark.IR.Pretty ppr :: EntryPointType -> Doc # pprPrec :: Int -> EntryPointType -> Doc # pprList :: [EntryPointType] -> Doc # |
Function Declarations
FunDef | |
|
Instances
Scoped rep (FunDef rep) Source # | |
RepTypes rep => Eq (FunDef rep) Source # | |
RepTypes rep => Ord (FunDef rep) Source # | |
RepTypes rep => Show (FunDef rep) Source # | |
PrettyRep rep => Pretty (FunDef rep) Source # | |
(FreeDec (ExpDec rep), FreeDec (BodyDec rep), FreeIn (FParamInfo rep), FreeIn (LParamInfo rep), FreeIn (LetDec rep), FreeIn (RetType rep), FreeIn (BranchType rep), FreeIn (Op rep)) => FreeIn (FunDef rep) Source # | |
Renameable rep => Rename (FunDef rep) Source # | |
Anonymous function for use in a SOAC.
Instances
Scoped rep (Lambda rep) Source # | |
RepTypes rep => Eq (LambdaT rep) Source # | |
RepTypes rep => Ord (LambdaT rep) Source # | |
Defined in Futhark.IR.Syntax | |
RepTypes rep => Show (LambdaT rep) Source # | |
PrettyRep rep => Pretty (Lambda rep) Source # | |
(FreeDec (ExpDec rep), FreeDec (BodyDec rep), FreeIn (FParamInfo rep), FreeIn (LParamInfo rep), FreeIn (LetDec rep), FreeIn (RetType rep), FreeIn (BranchType rep), FreeIn (Op rep)) => FreeIn (Lambda rep) Source # | |
Substitutable rep => Substitute (Lambda rep) Source # | |
Defined in Futhark.Transform.Substitute | |
Renameable rep => Rename (Lambda rep) Source # | |
What kind of branch is this? This has no semantic meaning, but provides hints to simplifications.
IfNormal | An ordinary branch. |
IfFallback | A branch where the "true" case is what we are actually interested in, and the "false" case is only present as a fallback for when the true case cannot be safely evaluated. The compiler is permitted to optimise away the branch if the true case contains only safe statements. |
IfEquiv | Both of these branches are semantically equivalent, and it is fine to eliminate one if it turns out to have problems (e.g. contain things we cannot generate code for). |
Data associated with a branch.
For-loop or while-loop?
Instances
Scoped rep (LoopForm rep) Source # | |
RepTypes rep => Eq (LoopForm rep) Source # | |
RepTypes rep => Ord (LoopForm rep) Source # | |
Defined in Futhark.IR.Syntax | |
RepTypes rep => Show (LoopForm rep) Source # | |
FreeIn (LParamInfo rep) => FreeIn (LoopForm rep) Source # | |
The root Futhark expression type. The Op
constructor contains
a rep-specific operation. Do-loops, branches and function calls
are special. Everything else is a simple BasicOp
.
BasicOp BasicOp | A simple (non-recursive) operation. |
Apply Name [(SubExp, Diet)] [RetType rep] (Safety, SrcLoc, [SrcLoc]) | |
If SubExp (BodyT rep) (BodyT rep) (IfDec (BranchType rep)) | |
DoLoop [(FParam rep, SubExp)] (LoopForm rep) (BodyT rep) |
|
WithAcc [(Shape, [VName], Maybe (Lambda rep, [SubExp]))] (Lambda rep) | Create accumulators backed by the given arrays (which are
consumed) and pass them to the lambda, which must return the
updated accumulators and possibly some extra values. The
accumulators are turned back into arrays. The |
Op (Op rep) |
Instances
RepTypes rep => Eq (ExpT rep) Source # | |
RepTypes rep => Ord (ExpT rep) Source # | |
Defined in Futhark.IR.Syntax | |
RepTypes rep => Show (ExpT rep) Source # | |
PrettyRep rep => Pretty (Exp rep) Source # | |
(FreeDec (ExpDec rep), FreeDec (BodyDec rep), FreeIn (FParamInfo rep), FreeIn (LParamInfo rep), FreeIn (LetDec rep), FreeIn (RetType rep), FreeIn (BranchType rep), FreeIn (Op rep)) => FreeIn (Exp rep) Source # | |
Substitutable rep => Substitute (Exp rep) Source # | |
Defined in Futhark.Transform.Substitute | |
Renameable rep => Rename (Exp rep) Source # | |
A primitive operation that returns something of known size and does not itself contain any bindings.
SubExp SubExp | A variable or constant. |
Opaque OpaqueOp SubExp | Semantically and operationally just identity, but is invisible/impenetrable to optimisations (hopefully). This partially a hack to avoid optimisation (so, to work around compiler limitations), but is also used to implement tracing and other operations that are semantically invisible, but have some sort of effect (brrr). |
ArrayLit [SubExp] Type | Array literals, e.g., |
UnOp UnOp SubExp | Unary operation. |
BinOp BinOp SubExp SubExp | Binary operation. |
CmpOp CmpOp SubExp SubExp | Comparison - result type is always boolean. |
ConvOp ConvOp SubExp | Conversion "casting". |
Assert SubExp (ErrorMsg SubExp) (SrcLoc, [SrcLoc]) | Turn a boolean into a certificate, halting the program with the given error message if the boolean is false. |
Index VName (Slice SubExp) | The certificates for bounds-checking are part of the |
Update Safety VName (Slice SubExp) SubExp | An in-place update of the given array at the given position.
Consumes the array. If |
FlatIndex VName (FlatSlice SubExp) | |
FlatUpdate VName (FlatSlice SubExp) VName | |
Concat Int VName [VName] SubExp |
|
Copy VName | Copy the given array. The result will not alias anything. |
Manifest [Int] VName | Manifest an array with dimensions represented in the given order. The result will not alias anything. |
Iota SubExp SubExp SubExp IntType |
The |
Replicate Shape SubExp | replicate([3][2],1) = [[1,1], [1,1], [1,1]] |
Scratch PrimType [SubExp] | Create array of given type and shape, with undefined elements. |
Reshape (ShapeChange SubExp) VName | 1st arg is the new shape, 2nd arg is the input array *) |
Rearrange [Int] VName | Permute the dimensions of the input array. The list
of integers is a list of dimensions (0-indexed), which
must be a permutation of |
Rotate [SubExp] VName | Rotate the dimensions of the input array. The list of subexpressions specify how much each dimension is rotated. The length of this list must be equal to the rank of the array. |
UpdateAcc VName [SubExp] [SubExp] | Update an accumulator at the given index with the given value. Consumes the accumulator and produces a new one. |
Apart from being Opaque, what else is going on here?
OpaqueNil | No special operation. |
OpaqueTrace String | Print the argument, prefixed by this string. |
type ShapeChange d = [DimChange d] Source #
A list of DimChange
s, indicating the new dimensions of an array.
The new dimension in a Reshape
-like operation. This allows us to
disambiguate "real" reshapes, that change the actual shape of the
array, from type coercions that are just present to make the types
work out. The two constructors are considered equal for purposes of Eq
.
DimCoercion d | The new dimension is guaranteed to be numerically equal to the old one. |
DimNew d | The new dimension is not necessarily numerically equal to the old one. |
Instances
A body consists of a number of bindings, terminating in a result (essentially a tuple literal).
Instances
RepTypes rep => Eq (BodyT rep) Source # | |
RepTypes rep => Ord (BodyT rep) Source # | |
Defined in Futhark.IR.Syntax | |
RepTypes rep => Show (BodyT rep) Source # | |
PrettyRep rep => Pretty (Body rep) Source # | |
(FreeDec (ExpDec rep), FreeDec (BodyDec rep), FreeIn (FParamInfo rep), FreeIn (LParamInfo rep), FreeIn (LetDec rep), FreeIn (RetType rep), FreeIn (BranchType rep), FreeIn (Op rep)) => FreeIn (Body rep) Source # | |
Substitutable rep => Substitute (Body rep) Source # | |
Defined in Futhark.Transform.Substitute | |
Renameable rep => Rename (Body rep) Source # | |
A pairing of a subexpression and some certificates.
Instances
Eq SubExpRes Source # | |
Ord SubExpRes Source # | |
Defined in Futhark.IR.Syntax | |
Show SubExpRes Source # | |
Pretty SubExpRes Source # | |
FreeIn SubExpRes Source # | |
Substitute SubExpRes Source # | |
Defined in Futhark.Transform.Substitute | |
Rename SubExpRes Source # | |
Simplifiable SubExpRes Source # | |
Defined in Futhark.Optimise.Simplify.Engine |
Auxilliary Information associated with a statement.
StmAux | |
|
Instances
Eq dec => Eq (StmAux dec) Source # | |
Ord dec => Ord (StmAux dec) Source # | |
Show dec => Show (StmAux dec) Source # | |
Semigroup dec => Semigroup (StmAux dec) Source # | |
FreeIn dec => FreeIn (StmAux dec) Source # | |
Substitute dec => Substitute (StmAux dec) Source # | |
Defined in Futhark.Transform.Substitute | |
Rename dec => Rename (StmAux dec) Source # | |
A pattern is conceptually just a list of names and their types.
Instances
Functor PatT Source # | |
Foldable PatT Source # | |
Defined in Futhark.IR.Syntax fold :: Monoid m => PatT m -> m # foldMap :: Monoid m => (a -> m) -> PatT a -> m # foldMap' :: Monoid m => (a -> m) -> PatT a -> m # foldr :: (a -> b -> b) -> b -> PatT a -> b # foldr' :: (a -> b -> b) -> b -> PatT a -> b # foldl :: (b -> a -> b) -> b -> PatT a -> b # foldl' :: (b -> a -> b) -> b -> PatT a -> b # foldr1 :: (a -> a -> a) -> PatT a -> a # foldl1 :: (a -> a -> a) -> PatT a -> a # elem :: Eq a => a -> PatT a -> Bool # maximum :: Ord a => PatT a -> a # | |
Traversable PatT Source # | |
Eq dec => Eq (PatT dec) Source # | |
Ord dec => Ord (PatT dec) Source # | |
Defined in Futhark.IR.Syntax | |
Show dec => Show (PatT dec) Source # | |
Semigroup (PatT dec) Source # | |
Monoid (PatT dec) Source # | |
Pretty (PatElemT dec) => Pretty (PatT dec) Source # | |
FreeIn dec => FreeIn (PatT dec) Source # | |
Substitute dec => Substitute (PatT dec) Source # | |
Defined in Futhark.Transform.Substitute | |
Rename dec => Rename (PatT dec) Source # | |
Every statement is associated with a set of attributes, which can have various effects throughout the compiler.
A single attribute.
withoutAttrs :: Attrs -> Attrs -> Attrs Source #
x
gives withoutAttrs
yx
except for any attributes also in y
.
stmsFromList :: [Stm rep] -> Stms rep Source #
Convert a statement list to a statement sequence.
stmsToList :: Stms rep -> [Stm rep] Source #
Convert a statement sequence to a statement list.
stmsHead :: Stms rep -> Maybe (Stm rep, Stms rep) Source #
The first statement in the sequence, if any.
module Futhark.IR.SOACS.SOAC
Anonymous function for use in a SOAC.
Instances
Scoped rep (Lambda rep) Source # | |
RepTypes rep => Eq (LambdaT rep) Source # | |
RepTypes rep => Ord (LambdaT rep) Source # | |
Defined in Futhark.IR.Syntax | |
RepTypes rep => Show (LambdaT rep) Source # | |
PrettyRep rep => Pretty (Lambda rep) Source # | |
(FreeDec (ExpDec rep), FreeDec (BodyDec rep), FreeIn (FParamInfo rep), FreeIn (LParamInfo rep), FreeIn (LetDec rep), FreeIn (RetType rep), FreeIn (BranchType rep), FreeIn (Op rep)) => FreeIn (Lambda rep) Source # | |
Substitutable rep => Substitute (Lambda rep) Source # | |
Defined in Futhark.Transform.Substitute | |
Renameable rep => Rename (Lambda rep) Source # | |
A body consists of a number of bindings, terminating in a result (essentially a tuple literal).
Instances
RepTypes rep => Eq (BodyT rep) Source # | |
RepTypes rep => Ord (BodyT rep) Source # | |
Defined in Futhark.IR.Syntax | |
RepTypes rep => Show (BodyT rep) Source # | |
PrettyRep rep => Pretty (Body rep) Source # | |
(FreeDec (ExpDec rep), FreeDec (BodyDec rep), FreeIn (FParamInfo rep), FreeIn (LParamInfo rep), FreeIn (LetDec rep), FreeIn (RetType rep), FreeIn (BranchType rep), FreeIn (Op rep)) => FreeIn (Body rep) Source # | |
Substitutable rep => Substitute (Body rep) Source # | |
Defined in Futhark.Transform.Substitute | |
Renameable rep => Rename (Body rep) Source # | |
A pattern is conceptually just a list of names and their types.
Instances
Functor PatT Source # | |
Foldable PatT Source # | |
Defined in Futhark.IR.Syntax fold :: Monoid m => PatT m -> m # foldMap :: Monoid m => (a -> m) -> PatT a -> m # foldMap' :: Monoid m => (a -> m) -> PatT a -> m # foldr :: (a -> b -> b) -> b -> PatT a -> b # foldr' :: (a -> b -> b) -> b -> PatT a -> b # foldl :: (b -> a -> b) -> b -> PatT a -> b # foldl' :: (b -> a -> b) -> b -> PatT a -> b # foldr1 :: (a -> a -> a) -> PatT a -> a # foldl1 :: (a -> a -> a) -> PatT a -> a # elem :: Eq a => a -> PatT a -> Bool # maximum :: Ord a => PatT a -> a # | |
Traversable PatT Source # | |
Eq dec => Eq (PatT dec) Source # | |
Ord dec => Ord (PatT dec) Source # | |
Defined in Futhark.IR.Syntax | |
Show dec => Show (PatT dec) Source # | |
Semigroup (PatT dec) Source # | |
Monoid (PatT dec) Source # | |
Pretty (PatElemT dec) => Pretty (PatT dec) Source # | |
FreeIn dec => FreeIn (PatT dec) Source # | |
Substitute dec => Substitute (PatT dec) Source # | |
Defined in Futhark.Transform.Substitute | |
Rename dec => Rename (PatT dec) Source # | |
An element of a pattern - consisting of a name and an addditional parametric decoration. This decoration is what is expected to contain the type of the resulting variable.