Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Futhark.CodeGen.ImpCode
Description
ImpCode is an imperative intermediate language used as a stepping stone in code generation. The functional core IR (Futhark.IR.Syntax) gets translated into ImpCode by Futhark.CodeGen.ImpGen. Later we then translate ImpCode to, for example, C.
Basic design
ImpCode distinguishes between statements (Code
), which may have
side effects, and expressions (Exp
) which do not. Expressions
involve only scalars and have a type. The actual expression
definition is in Futhark.Analysis.PrimExp, specifically
PrimExp
and its phantom-typed variant
TPrimExp
.
Code
is a generic representation parametrised on an extensible
arbitrary operation, represented by the Op
constructor. Specific
instantiations of ImpCode, such as
Futhark.CodeGen.ImpCode.Multicore, will pass in a specific kind
of operation to express backend-specific functionality (in the case
of multicore, this is
Multicore
).
Arrays and memory
ImpCode does not have arrays. DeclareArray
is for declaring
constant array literals, not arrays in general. Instead, ImpCode
deals only with memory. Array operations present in core IR
programs are turned into Write
, Read
, and Copy
operations that use flat indexes and offsets based on the index
function of the original array.
Scoping
ImpCode is much simpler than the functional core IR; partly because
we hope to do less work on it. We don't have real optimisation
passes on ImpCode. One result of this simplicity is that ImpCode
has a fairly naive view of scoping. The only things that can
bring new names into scope are DeclareMem
, DeclareScalar
,
DeclareArray
, For
, and function parameters. In particular,
Op
s cannot bind parameters. The standard workaround is to
define Op
s that retrieve the value of an implicit parameter and
assign it to a variable declared with the normal
mechanisms. GetLoopBounds
is an
example of this pattern.
Inspiration
ImpCode was originally inspired by the paper "Defunctionalizing Push Arrays" (FHPC '14).
Synopsis
- data Definitions a = Definitions {}
- newtype Functions a = Functions {
- unFunctions :: [(Name, Function a)]
- type Function = FunctionT
- data FunctionT a = Function {
- functionEntry :: Maybe EntryPoint
- functionOutput :: [Param]
- functionInput :: [Param]
- functionBody :: Code a
- data EntryPoint = EntryPoint {
- entryPointName :: Name
- entryPointResults :: [(Uniqueness, ExternalValue)]
- entryPointArgs :: [((Name, Uniqueness), ExternalValue)]
- data Constants a = Constants {
- constsDecl :: [Param]
- constsInit :: Code a
- data ValueDesc
- data ExternalValue
- data Param
- paramName :: Param -> VName
- type MemSize = SubExp
- type DimSize = SubExp
- data Code a
- = Skip
- | (Code a) :>>: (Code a)
- | For VName Exp (Code a)
- | While (TExp Bool) (Code a)
- | DeclareMem VName Space
- | DeclareScalar VName Volatility PrimType
- | DeclareArray VName PrimType ArrayContents
- | Allocate VName (Count Bytes (TExp Int64)) Space
- | Free VName Space
- | Copy PrimType [Count Elements (TExp Int64)] (VName, Space) (Count Elements (TExp Int64), [Count Elements (TExp Int64)]) (VName, Space) (Count Elements (TExp Int64), [Count Elements (TExp Int64)])
- | Write VName (Count Elements (TExp Int64)) PrimType Space Volatility Exp
- | SetScalar VName Exp
- | Read VName VName (Count Elements (TExp Int64)) PrimType Space Volatility
- | SetMem VName VName Space
- | Call [VName] Name [Arg]
- | If (TExp Bool) (Code a) (Code a)
- | Assert Exp (ErrorMsg Exp) (SrcLoc, [SrcLoc])
- | Comment Text (Code a)
- | DebugPrint String (Maybe Exp)
- | TracePrint (ErrorMsg Exp)
- | Op a
- data PrimValue
- type Exp = PrimExp VName
- type TExp t = TPrimExp t VName
- data Volatility
- data Arg
- var :: VName -> PrimType -> Exp
- data ArrayContents
- declaredIn :: Code a -> Names
- lexicalMemoryUsage :: Function a -> Map VName Space
- declsFirst :: Code a -> Code a
- calledFuncs :: (a -> Set Name) -> Code a -> Set Name
- callGraph :: (a -> Set Name) -> Functions a -> Map Name (Set Name)
- type ParamMap = Map Name (SizeClass, Set Name)
- data Bytes
- data Elements
- elements :: a -> Count Elements a
- bytes :: a -> Count Bytes a
- withElemType :: Count Elements (TExp Int64) -> PrimType -> Count Bytes (TExp Int64)
- prettyText :: Pretty a => a -> Text
- prettyString :: Pretty a => a -> String
- data Space
- data ValueType = ValueType Signedness Rank PrimType
- data SubExp
- data EntryPointType
- newtype ErrorMsg a = ErrorMsg [ErrorMsgPart a]
- data ErrorMsgPart a
- = ErrorString Text
- | ErrorVal PrimType a
- data OpaqueType
- = OpaqueType [ValueType]
- | OpaqueRecord [(Name, EntryPointType)]
- | OpaqueSum [ValueType] [(Name, [(EntryPointType, [Int])])]
- | OpaqueArray Int Name [ValueType]
- | OpaqueRecordArray Int Name [(Name, EntryPointType)]
- newtype OpaqueTypes = OpaqueTypes [(Name, OpaqueType)]
- newtype Rank = Rank Int
- data Signedness
- type SpaceId = String
- errorMsgArgTypes :: ErrorMsg a -> [PrimType]
- module Language.Futhark.Core
- module Language.Futhark.Primitive
- module Futhark.Analysis.PrimExp
- module Futhark.Analysis.PrimExp.Convert
- newtype Count u e = Count {
- unCount :: e
- data SizeClass
- module Futhark.IR.Prop.Names
Documentation
data Definitions a Source #
A collection of imperative functions and constants.
Constructors
Definitions | |
Instances
Functor Definitions Source # | |
Defined in Futhark.CodeGen.ImpCode Methods fmap :: (a -> b) -> Definitions a -> Definitions b # (<$) :: a -> Definitions b -> Definitions a # | |
Show a => Show (Definitions a) Source # | |
Defined in Futhark.CodeGen.ImpCode Methods showsPrec :: Int -> Definitions a -> ShowS # show :: Definitions a -> String # showList :: [Definitions a] -> ShowS # | |
Pretty op => Pretty (Definitions op) Source # | |
Defined in Futhark.CodeGen.ImpCode |
A collection of imperative functions.
Constructors
Functions | |
Fields
|
Instances
Foldable Functions Source # | |
Defined in Futhark.CodeGen.ImpCode Methods fold :: Monoid m => Functions m -> m # foldMap :: Monoid m => (a -> m) -> Functions a -> m # foldMap' :: Monoid m => (a -> m) -> Functions a -> m # foldr :: (a -> b -> b) -> b -> Functions a -> b # foldr' :: (a -> b -> b) -> b -> Functions a -> b # foldl :: (b -> a -> b) -> b -> Functions a -> b # foldl' :: (b -> a -> b) -> b -> Functions a -> b # foldr1 :: (a -> a -> a) -> Functions a -> a # foldl1 :: (a -> a -> a) -> Functions a -> a # toList :: Functions a -> [a] # length :: Functions a -> Int # elem :: Eq a => a -> Functions a -> Bool # maximum :: Ord a => Functions a -> a # minimum :: Ord a => Functions a -> a # | |
Traversable Functions Source # | |
Defined in Futhark.CodeGen.ImpCode | |
Functor Functions Source # | |
Monoid (Functions a) Source # | |
Semigroup (Functions a) Source # | |
Show a => Show (Functions a) Source # | |
FreeIn a => FreeIn (Functions a) Source # | |
Pretty op => Pretty (Functions op) Source # | |
Defined in Futhark.CodeGen.ImpCode |
A imperative function, containing the body as well as its low-level inputs and outputs, as well as its high-level arguments and results. The latter are only present if the function is an entry point.
Constructors
Function | |
Fields
|
Instances
Foldable FunctionT Source # | |
Defined in Futhark.CodeGen.ImpCode Methods fold :: Monoid m => FunctionT m -> m # foldMap :: Monoid m => (a -> m) -> FunctionT a -> m # foldMap' :: Monoid m => (a -> m) -> FunctionT a -> m # foldr :: (a -> b -> b) -> b -> FunctionT a -> b # foldr' :: (a -> b -> b) -> b -> FunctionT a -> b # foldl :: (b -> a -> b) -> b -> FunctionT a -> b # foldl' :: (b -> a -> b) -> b -> FunctionT a -> b # foldr1 :: (a -> a -> a) -> FunctionT a -> a # foldl1 :: (a -> a -> a) -> FunctionT a -> a # toList :: FunctionT a -> [a] # length :: FunctionT a -> Int # elem :: Eq a => a -> FunctionT a -> Bool # maximum :: Ord a => FunctionT a -> a # minimum :: Ord a => FunctionT a -> a # | |
Traversable FunctionT Source # | |
Defined in Futhark.CodeGen.ImpCode | |
Functor FunctionT Source # | |
Show a => Show (FunctionT a) Source # | |
Pretty op => Pretty (FunctionT op) Source # | |
Defined in Futhark.CodeGen.ImpCode |
data EntryPoint Source #
Information about how this function can be called from the outside world.
Constructors
EntryPoint | |
Fields
|
Instances
Show EntryPoint Source # | |
Defined in Futhark.CodeGen.ImpCode Methods showsPrec :: Int -> EntryPoint -> ShowS # show :: EntryPoint -> String # showList :: [EntryPoint] -> ShowS # | |
FreeIn EntryPoint Source # | |
Defined in Futhark.CodeGen.ImpCode Methods freeIn' :: EntryPoint -> FV Source # | |
Pretty EntryPoint Source # | |
Defined in Futhark.CodeGen.ImpCode |
A collection of imperative constants.
Constructors
Constants | |
Fields
|
A description of an externally meaningful value.
Constructors
ArrayValue VName Space PrimType Signedness [DimSize] | An array with memory block memory space, element type, signedness of element type (if applicable), and shape. |
ScalarValue PrimType Signedness VName | A scalar value with signedness if applicable. |
data ExternalValue Source #
^ An externally visible value. This can be an opaque value (covering several physical internal values), or a single value that can be used externally. We record the uniqueness because it is important to the external interface as well.
Constructors
OpaqueValue Name [ValueDesc] | The string is a human-readable description with no other semantics. |
TransparentValue ValueDesc |
Instances
Show ExternalValue Source # | |
Defined in Futhark.CodeGen.ImpCode Methods showsPrec :: Int -> ExternalValue -> ShowS # show :: ExternalValue -> String # showList :: [ExternalValue] -> ShowS # | |
FreeIn ExternalValue Source # | |
Defined in Futhark.CodeGen.ImpCode Methods freeIn' :: ExternalValue -> FV Source # | |
Pretty ExternalValue Source # | |
Defined in Futhark.CodeGen.ImpCode |
An ImpCode function parameter.
A block of imperative code. Parameterised by an Op
, which
allows extensibility. Concrete uses of this type will instantiate
the type parameter with e.g. a construct for launching GPU kernels.
Constructors
Skip | No-op. Crucial for the |
(:>>:) | |
For VName Exp (Code a) | A for-loop iterating the given number of times. The loop parameter starts counting from zero and will have the same (integer) type as the bound. The bound is evaluated just once, before the loop is entered. |
While (TExp Bool) (Code a) | While loop. The conditional is (of course) re-evaluated before every iteration of the loop. |
DeclareMem VName Space | Declare a memory block variable that will point to
memory in the given memory space. Note that this is
distinct from allocation. The memory block must be the
target of either an |
DeclareScalar VName Volatility PrimType | Declare a scalar variable with an initially undefined value. |
DeclareArray VName PrimType ArrayContents | Create a DefaultSpace array containing the given values. The lifetime of the array will be the entire application. This is mostly used for constant arrays. |
Allocate VName (Count Bytes (TExp Int64)) Space | Memory space must match the corresponding
|
Free VName Space | Indicate that some memory block will never again be referenced via the indicated variable. However, it may still be accessed through aliases. It is only safe to actually deallocate the memory block if this is the last reference. There is no guarantee that all memory blocks will be freed with this statement. Backends are free to ignore it entirely. |
Copy PrimType [Count Elements (TExp Int64)] (VName, Space) (Count Elements (TExp Int64), [Count Elements (TExp Int64)]) (VName, Space) (Count Elements (TExp Int64), [Count Elements (TExp Int64)]) |
|
Write VName (Count Elements (TExp Int64)) PrimType Space Volatility Exp |
|
SetScalar VName Exp | Set a scalar variable. |
Read VName VName (Count Elements (TExp Int64)) PrimType Space Volatility | Read a scalar from memory from memory. The first |
SetMem VName VName Space | Must be in same space. |
Call [VName] Name [Arg] | Function call. The results are written to the
provided |
If (TExp Bool) (Code a) (Code a) | Conditional execution. |
Assert Exp (ErrorMsg Exp) (SrcLoc, [SrcLoc]) | Assert that something must be true. Should it turn out not to be true, then report a failure along with the given error message. |
Comment Text (Code a) | Has the same semantics as the contained code, but the comment should show up in generated code for ease of inspection. |
DebugPrint String (Maybe Exp) | Print the given value to the screen, somehow annotated with the given string as a description. If no type/value pair, just print the string. This has no semantic meaning, but is used entirely for debugging. Code generators are free to ignore this statement. |
TracePrint (ErrorMsg Exp) | Log the given message, *without* a trailing linebreak (unless part of the message). |
Op a | Perform an extensible operation. |
Instances
Foldable Code Source # | |
Defined in Futhark.CodeGen.ImpCode Methods fold :: Monoid m => Code m -> m # foldMap :: Monoid m => (a -> m) -> Code a -> m # foldMap' :: Monoid m => (a -> m) -> Code a -> m # foldr :: (a -> b -> b) -> b -> Code a -> b # foldr' :: (a -> b -> b) -> b -> Code a -> b # foldl :: (b -> a -> b) -> b -> Code a -> b # foldl' :: (b -> a -> b) -> b -> Code a -> b # foldr1 :: (a -> a -> a) -> Code a -> a # foldl1 :: (a -> a -> a) -> Code a -> a # elem :: Eq a => a -> Code a -> Bool # maximum :: Ord a => Code a -> a # | |
Traversable Code Source # | |
Functor Code Source # | |
Monoid (Code a) Source # | |
Semigroup (Code a) Source # | |
Show a => Show (Code a) Source # | |
FreeIn a => FreeIn (Code a) Source # | |
Pretty op => Pretty (Code op) Source # | |
Defined in Futhark.CodeGen.ImpCode |
Non-array values.
Constructors
IntValue !IntValue | |
FloatValue !FloatValue | |
BoolValue !Bool | |
UnitValue | The only value of type |
Instances
Show PrimValue Source # | |
IsValue PrimValue Source # | |
Eq PrimValue Source # | |
Ord PrimValue Source # | |
ToExp PrimValue Source # | |
Pretty PrimValue Source # | |
Defined in Language.Futhark.Primitive |
type Exp = PrimExp VName Source #
A side-effect free expression whose execution will produce a single primitive value.
data Volatility Source #
The volatility of a memory access or variable. Feel free to ignore this for backends where it makes no sense (anything but C and similar low-level things)
Constructors
Volatile | |
Nonvolatile |
Instances
Show Volatility Source # | |
Defined in Futhark.CodeGen.ImpCode Methods showsPrec :: Int -> Volatility -> ShowS # show :: Volatility -> String # showList :: [Volatility] -> ShowS # | |
Eq Volatility Source # | |
Defined in Futhark.CodeGen.ImpCode | |
Ord Volatility Source # | |
Defined in Futhark.CodeGen.ImpCode Methods compare :: Volatility -> Volatility -> Ordering # (<) :: Volatility -> Volatility -> Bool # (<=) :: Volatility -> Volatility -> Bool # (>) :: Volatility -> Volatility -> Bool # (>=) :: Volatility -> Volatility -> Bool # max :: Volatility -> Volatility -> Volatility # min :: Volatility -> Volatility -> Volatility # |
A function call argument.
data ArrayContents Source #
The contents of a statically declared constant array. Such arrays are always unidimensional, and reshaped if necessary in the code that uses them.
Constructors
ArrayValues [PrimValue] | Precisely these values. |
ArrayZeros Int | This many zeroes. |
Instances
Show ArrayContents Source # | |
Defined in Futhark.CodeGen.ImpCode Methods showsPrec :: Int -> ArrayContents -> ShowS # show :: ArrayContents -> String # showList :: [ArrayContents] -> ShowS # | |
Pretty ArrayContents Source # | |
Defined in Futhark.CodeGen.ImpCode |
declaredIn :: Code a -> Names Source #
The names declared with DeclareMem
, DeclareScalar
, and
DeclareArray
in the given code.
lexicalMemoryUsage :: Function a -> Map VName Space Source #
Find those memory blocks that are used only lexically. That is,
are not used as the source or target of a SetMem
, or are the
result of the function, nor passed as arguments to other functions.
This is interesting because such memory blocks do not need
reference counting, but can be managed in a purely stack-like
fashion.
We do not look inside any Op
s. We assume that no Op
is going
to SetMem
a memory block declared outside it.
declsFirst :: Code a -> Code a Source #
Reorder the code such that all declarations appear first. This
is always possible, because DeclareScalar
and DeclareMem
do
not depend on any local bindings.
calledFuncs :: (a -> Set Name) -> Code a -> Set Name Source #
The set of functions that are called by this code. Accepts a
function for determing function calls in Op
s.
callGraph :: (a -> Set Name) -> Functions a -> Map Name (Set Name) Source #
Compute call graph, as per calledFuncs
, but also include
transitive calls.
type ParamMap = Map Name (SizeClass, Set Name) Source #
A mapping from names of tuning parameters to their class, as well as which functions make use of them (including transitively).
Typed enumerations
withElemType :: Count Elements (TExp Int64) -> PrimType -> Count Bytes (TExp Int64) Source #
Convert a count of elements into a count of bytes, given the per-element size.
Re-exports from other modules.
prettyString :: Pretty a => a -> String Source #
Prettyprint a value to a String
, appropriately wrapped.
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.
Constructors
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. |
An actual non-opaque type that can be passed to and from Futhark programs, or serve as the contents of opaque types. Scalars are represented with zero rank.
Constructors
ValueType Signedness Rank PrimType |
Instances
Show ValueType Source # | |
Eq ValueType Source # | |
Ord ValueType Source # | |
Pretty ValueType Source # | |
Defined in Futhark.IR.Pretty |
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
data EntryPointType Source #
Every entry point argument and return value has an annotation indicating how it maps to the original source program type.
Constructors
TypeOpaque Name | An opaque type of this name. |
TypeTransparent ValueType | A transparent type, which is scalar if the rank is zero. |
Instances
Show EntryPointType Source # | |
Defined in Futhark.IR.Syntax.Core Methods showsPrec :: Int -> EntryPointType -> ShowS # show :: EntryPointType -> String # showList :: [EntryPointType] -> ShowS # | |
Eq EntryPointType Source # | |
Defined in Futhark.IR.Syntax.Core Methods (==) :: EntryPointType -> EntryPointType -> Bool # (/=) :: EntryPointType -> EntryPointType -> Bool # | |
Ord EntryPointType Source # | |
Defined in Futhark.IR.Syntax.Core Methods compare :: EntryPointType -> EntryPointType -> Ordering # (<) :: EntryPointType -> EntryPointType -> Bool # (<=) :: EntryPointType -> EntryPointType -> Bool # (>) :: EntryPointType -> EntryPointType -> Bool # (>=) :: EntryPointType -> EntryPointType -> Bool # max :: EntryPointType -> EntryPointType -> EntryPointType # min :: EntryPointType -> EntryPointType -> EntryPointType # | |
Pretty EntryPointType Source # | |
Defined in Futhark.IR.Pretty |
An error message is a list of error parts, which are concatenated to form the final message.
Constructors
ErrorMsg [ErrorMsgPart a] |
Instances
data ErrorMsgPart a Source #
A part of an error message.
Constructors
ErrorString Text | A literal string. |
ErrorVal PrimType a | A run-time value. |
Instances
data OpaqueType Source #
The representation of an opaque type.
Constructors
OpaqueType [ValueType] | |
OpaqueRecord [(Name, EntryPointType)] | Note that the field ordering here denote the actual representation - make sure it is preserved. |
OpaqueSum [ValueType] [(Name, [(EntryPointType, [Int])])] | Constructor ordering also denotes representation, in that the index of the constructor is the identifying number. The total values used to represent a sum values is the
|
OpaqueArray Int Name [ValueType] | An array with this rank and named opaque element type. |
OpaqueRecordArray Int Name [(Name, EntryPointType)] | An array with known rank and where the elements are this record type. |
Instances
Show OpaqueType Source # | |
Defined in Futhark.IR.Syntax.Core Methods showsPrec :: Int -> OpaqueType -> ShowS # show :: OpaqueType -> String # showList :: [OpaqueType] -> ShowS # | |
Eq OpaqueType Source # | |
Defined in Futhark.IR.Syntax.Core | |
Ord OpaqueType Source # | |
Defined in Futhark.IR.Syntax.Core Methods compare :: OpaqueType -> OpaqueType -> Ordering # (<) :: OpaqueType -> OpaqueType -> Bool # (<=) :: OpaqueType -> OpaqueType -> Bool # (>) :: OpaqueType -> OpaqueType -> Bool # (>=) :: OpaqueType -> OpaqueType -> Bool # max :: OpaqueType -> OpaqueType -> OpaqueType # min :: OpaqueType -> OpaqueType -> OpaqueType # | |
Pretty OpaqueType Source # | |
Defined in Futhark.IR.Pretty |
newtype OpaqueTypes Source #
Names of opaque types and their representation.
Constructors
OpaqueTypes [(Name, OpaqueType)] |
Instances
The size of an array type as merely the number of dimensions, with no further information.
Instances
Monoid Rank Source # | |
Semigroup Rank Source # | |
Show Rank Source # | |
ArrayShape Rank Source # | |
Rename Rank Source # | |
Substitute Rank Source # | |
Defined in Futhark.Transform.Substitute | |
Eq Rank Source # | |
Ord Rank Source # | |
Pretty Rank Source # | |
Defined in Futhark.IR.Pretty | |
Pretty u => Pretty (TypeBase Rank u) Source # | |
data Signedness Source #
Since the core language does not care for signedness, but the source language does, entry point input/output information has metadata for integer types (and arrays containing these) that indicate whether they are really unsigned integers. This doesn't matter for non-integer types.
Instances
Show Signedness Source # | |
Defined in Futhark.IR.Syntax.Core Methods showsPrec :: Int -> Signedness -> ShowS # show :: Signedness -> String # showList :: [Signedness] -> ShowS # | |
Eq Signedness Source # | |
Defined in Futhark.IR.Syntax.Core | |
Ord Signedness Source # | |
Defined in Futhark.IR.Syntax.Core Methods compare :: Signedness -> Signedness -> Ordering # (<) :: Signedness -> Signedness -> Bool # (<=) :: Signedness -> Signedness -> Bool # (>) :: Signedness -> Signedness -> Bool # (>=) :: Signedness -> Signedness -> Bool # max :: Signedness -> Signedness -> Signedness # min :: Signedness -> Signedness -> Signedness # | |
Pretty Signedness Source # | |
Defined in Futhark.IR.Pretty |
errorMsgArgTypes :: ErrorMsg a -> [PrimType] Source #
How many non-constant parts does the error message have, and what is their type?
module Language.Futhark.Core
module Language.Futhark.Primitive
module Futhark.Analysis.PrimExp
A wrapper supporting a phantom type for indicating what we are counting.
Instances
Foldable (Count u) Source # | |
Defined in Futhark.IR.GPU.Sizes Methods fold :: Monoid m => Count u m -> m # foldMap :: Monoid m => (a -> m) -> Count u a -> m # foldMap' :: Monoid m => (a -> m) -> Count u a -> m # foldr :: (a -> b -> b) -> b -> Count u a -> b # foldr' :: (a -> b -> b) -> b -> Count u a -> b # foldl :: (b -> a -> b) -> b -> Count u a -> b # foldl' :: (b -> a -> b) -> b -> Count u a -> b # foldr1 :: (a -> a -> a) -> Count u a -> a # foldl1 :: (a -> a -> a) -> Count u a -> a # elem :: Eq a => a -> Count u a -> Bool # maximum :: Ord a => Count u a -> a # minimum :: Ord a => Count u a -> a # | |
Traversable (Count u) Source # | |
Functor (Count u) Source # | |
Num e => Num (Count u e) Source # | |
Defined in Futhark.IR.GPU.Sizes | |
Show e => Show (Count u e) Source # | |
FreeIn e => FreeIn (Count u e) Source # | |
Substitute e => Substitute (Count u e) Source # | |
Defined in Futhark.IR.GPU.Sizes | |
IntegralExp e => IntegralExp (Count u e) Source # | |
Defined in Futhark.IR.GPU.Sizes Methods quot :: Count u e -> Count u e -> Count u e Source # rem :: Count u e -> Count u e -> Count u e Source # div :: Count u e -> Count u e -> Count u e Source # mod :: Count u e -> Count u e -> Count u e Source # sgn :: Count u e -> Maybe Int Source # pow :: Count u e -> Count u e -> Count u e Source # | |
Eq e => Eq (Count u e) Source # | |
Ord e => Ord (Count u e) Source # | |
Pretty e => Pretty (Count u e) Source # | |
Defined in Futhark.IR.GPU.Sizes |
The class of some kind of configurable size. Each class may impose constraints on the valid values.
Constructors
SizeThreshold KernelPath (Maybe Int64) | A threshold with an optional default. |
SizeThreadBlock | |
SizeGrid | The number of thread blocks. |
SizeTile | |
SizeRegTile | |
SizeSharedMemory | Likely not useful on its own, but querying the maximum can be handy. |
SizeBespoke Name Int64 | A bespoke size with a default. |
SizeRegisters | Amount of registers available per threadblock. Mostly meaningful for querying the maximum. |
SizeCache | Amount of L2 cache memory, in bytes. Mostly meaningful for querying the maximum. |
Instances
Show SizeClass Source # | |
Eq SizeClass Source # | |
Ord SizeClass Source # | |
Pretty SizeClass Source # | |
Defined in Futhark.IR.GPU.Sizes |
module Futhark.IR.Prop.Names