futhark-manifest-1.5.0.0: Definition and serialisation instances for Futhark manifests.
Safe HaskellNone
LanguageHaskell2010

Futhark.Manifest

Description

C manifest data structure and serialisation to JSON.

A manifest contains machine-readable information about the API of the compiled Futhark program. Specifically which entry points are available, which types are exposed, and what their C names are. This module documentation is not intended as a full description of the Futhark C API - you will need to consult the Futhark User's Guide to understand most of the information here.

The type aliases are purely informative and do not actually enforce correct usage. They are present only because most of the information here is ultimately just text.

Synopsis

Type aliases

type CFuncName = Text Source #

The name of a C function.

type CTypeName = Text Source #

The name of a C type (often of the form "struct foo*").

type TypeName = Text Source #

The name of a Futhark-level type. This may be an array type (without sizes, just empty brackets), a primitive type, or another string denoting an opaque type. The latter must have a corresponding entry in manifestTypes.

Manifest

data Manifest Source #

A manifest for a compiled program.

Constructors

Manifest 

Fields

  • manifestEntryPoints :: Map Text EntryPoint

    A mapping from Futhark entry points to how they are represented in C.

  • manifestTypes :: Map TypeName Type

    A mapping from Futhark type name to how they are represented at the C level. Should not contain any of the primitive scalar types. For array types, these have empty dimensions, e.g. []i32.

  • manifestBackend :: Text

    The compiler backend used to compile the program, e.g. c.

  • manifestVersion :: Text

    The version of the compiler used to compile the program.

Instances

Instances details
FromJSON Manifest Source # 
Instance details

Defined in Futhark.Manifest

ToJSON Manifest Source # 
Instance details

Defined in Futhark.Manifest

Show Manifest Source # 
Instance details

Defined in Futhark.Manifest

Methods

showsPrec :: Int -> Manifest -> ShowS

show :: Manifest -> String

showList :: [Manifest] -> ShowS

Eq Manifest Source # 
Instance details

Defined in Futhark.Manifest

Methods

(==) :: Manifest -> Manifest -> Bool

(/=) :: Manifest -> Manifest -> Bool

Ord Manifest Source # 
Instance details

Defined in Futhark.Manifest

Methods

compare :: Manifest -> Manifest -> Ordering

(<) :: Manifest -> Manifest -> Bool

(<=) :: Manifest -> Manifest -> Bool

(>) :: Manifest -> Manifest -> Bool

(>=) :: Manifest -> Manifest -> Bool

max :: Manifest -> Manifest -> Manifest

min :: Manifest -> Manifest -> Manifest

data Input Source #

Manifest info for an entry point parameter.

Constructors

Input 

Fields

Instances

Instances details
FromJSON Input Source # 
Instance details

Defined in Futhark.Manifest

Show Input Source # 
Instance details

Defined in Futhark.Manifest

Methods

showsPrec :: Int -> Input -> ShowS

show :: Input -> String

showList :: [Input] -> ShowS

Eq Input Source # 
Instance details

Defined in Futhark.Manifest

Methods

(==) :: Input -> Input -> Bool

(/=) :: Input -> Input -> Bool

Ord Input Source # 
Instance details

Defined in Futhark.Manifest

Methods

compare :: Input -> Input -> Ordering

(<) :: Input -> Input -> Bool

(<=) :: Input -> Input -> Bool

(>) :: Input -> Input -> Bool

(>=) :: Input -> Input -> Bool

max :: Input -> Input -> Input

min :: Input -> Input -> Input

data Output Source #

Manifest info for an entry point return value.

Constructors

Output 

Fields

Instances

Instances details
FromJSON Output Source # 
Instance details

Defined in Futhark.Manifest

Show Output Source # 
Instance details

Defined in Futhark.Manifest

Methods

showsPrec :: Int -> Output -> ShowS

show :: Output -> String

showList :: [Output] -> ShowS

Eq Output Source # 
Instance details

Defined in Futhark.Manifest

Methods

(==) :: Output -> Output -> Bool

(/=) :: Output -> Output -> Bool

Ord Output Source # 
Instance details

Defined in Futhark.Manifest

Methods

compare :: Output -> Output -> Ordering

(<) :: Output -> Output -> Bool

(<=) :: Output -> Output -> Bool

(>) :: Output -> Output -> Bool

(>=) :: Output -> Output -> Bool

max :: Output -> Output -> Output

min :: Output -> Output -> Output

data EntryPoint Source #

Manifest info for an entry point.

Instances

Instances details
FromJSON EntryPoint Source # 
Instance details

Defined in Futhark.Manifest

Show EntryPoint Source # 
Instance details

Defined in Futhark.Manifest

Methods

showsPrec :: Int -> EntryPoint -> ShowS

show :: EntryPoint -> String

showList :: [EntryPoint] -> ShowS

Eq EntryPoint Source # 
Instance details

Defined in Futhark.Manifest

Methods

(==) :: EntryPoint -> EntryPoint -> Bool

(/=) :: EntryPoint -> EntryPoint -> Bool

Ord EntryPoint Source # 
Instance details

Defined in Futhark.Manifest

data Type Source #

Manifest info for a non-scalar type. Scalar types are not part of the manifest for a program. Although this representation allows a type to be both a a record and a sum type, this will never actually happen.

Constructors

TypeArray CTypeName TypeName Int ArrayOps

ctype, Futhark elemtype, rank.

TypeOpaque CTypeName OpaqueOps (Maybe OpaqueExtraOps) 

Instances

Instances details
FromJSON Type Source # 
Instance details

Defined in Futhark.Manifest

Show Type Source # 
Instance details

Defined in Futhark.Manifest

Methods

showsPrec :: Int -> Type -> ShowS

show :: Type -> String

showList :: [Type] -> ShowS

Eq Type Source # 
Instance details

Defined in Futhark.Manifest

Methods

(==) :: Type -> Type -> Bool

(/=) :: Type -> Type -> Bool

Ord Type Source # 
Instance details

Defined in Futhark.Manifest

Methods

compare :: Type -> Type -> Ordering

(<) :: Type -> Type -> Bool

(<=) :: Type -> Type -> Bool

(>) :: Type -> Type -> Bool

(>=) :: Type -> Type -> Bool

max :: Type -> Type -> Type

min :: Type -> Type -> Type

data ArrayOps Source #

The names of the C functions implementing the operations on some array type.

Instances

Instances details
FromJSON ArrayOps Source # 
Instance details

Defined in Futhark.Manifest

ToJSON ArrayOps Source # 
Instance details

Defined in Futhark.Manifest

Show ArrayOps Source # 
Instance details

Defined in Futhark.Manifest

Methods

showsPrec :: Int -> ArrayOps -> ShowS

show :: ArrayOps -> String

showList :: [ArrayOps] -> ShowS

Eq ArrayOps Source # 
Instance details

Defined in Futhark.Manifest

Methods

(==) :: ArrayOps -> ArrayOps -> Bool

(/=) :: ArrayOps -> ArrayOps -> Bool

Ord ArrayOps Source # 
Instance details

Defined in Futhark.Manifest

Methods

compare :: ArrayOps -> ArrayOps -> Ordering

(<) :: ArrayOps -> ArrayOps -> Bool

(<=) :: ArrayOps -> ArrayOps -> Bool

(>) :: ArrayOps -> ArrayOps -> Bool

(>=) :: ArrayOps -> ArrayOps -> Bool

max :: ArrayOps -> ArrayOps -> ArrayOps

min :: ArrayOps -> ArrayOps -> ArrayOps

data RecordField Source #

Information about a record field. Also used for fields of record arrays; see RecordArrayOps.

Constructors

RecordField 

Fields

Instances

Instances details
FromJSON RecordField Source # 
Instance details

Defined in Futhark.Manifest

ToJSON RecordField Source # 
Instance details

Defined in Futhark.Manifest

Show RecordField Source # 
Instance details

Defined in Futhark.Manifest

Methods

showsPrec :: Int -> RecordField -> ShowS

show :: RecordField -> String

showList :: [RecordField] -> ShowS

Eq RecordField Source # 
Instance details

Defined in Futhark.Manifest

Methods

(==) :: RecordField -> RecordField -> Bool

(/=) :: RecordField -> RecordField -> Bool

Ord RecordField Source # 
Instance details

Defined in Futhark.Manifest

data RecordOps Source #

Some opaque types are records, from which we can extract fields, and also construct them from values for their fields. Beyond that, they support the usual opaque operations. These record facilities can be ignored if you wish, and the types treated as ordinary opaque types.

Constructors

RecordOps 

Fields

Instances

Instances details
FromJSON RecordOps Source # 
Instance details

Defined in Futhark.Manifest

ToJSON RecordOps Source # 
Instance details

Defined in Futhark.Manifest

Show RecordOps Source # 
Instance details

Defined in Futhark.Manifest

Methods

showsPrec :: Int -> RecordOps -> ShowS

show :: RecordOps -> String

showList :: [RecordOps] -> ShowS

Eq RecordOps Source # 
Instance details

Defined in Futhark.Manifest

Methods

(==) :: RecordOps -> RecordOps -> Bool

(/=) :: RecordOps -> RecordOps -> Bool

Ord RecordOps Source # 
Instance details

Defined in Futhark.Manifest

Methods

compare :: RecordOps -> RecordOps -> Ordering

(<) :: RecordOps -> RecordOps -> Bool

(<=) :: RecordOps -> RecordOps -> Bool

(>) :: RecordOps -> RecordOps -> Bool

(>=) :: RecordOps -> RecordOps -> Bool

max :: RecordOps -> RecordOps -> RecordOps

min :: RecordOps -> RecordOps -> RecordOps

data SumVariant Source #

Information about a variant of a sum type.

Constructors

SumVariant 

Fields

Instances

Instances details
FromJSON SumVariant Source # 
Instance details

Defined in Futhark.Manifest

ToJSON SumVariant Source # 
Instance details

Defined in Futhark.Manifest

Show SumVariant Source # 
Instance details

Defined in Futhark.Manifest

Methods

showsPrec :: Int -> SumVariant -> ShowS

show :: SumVariant -> String

showList :: [SumVariant] -> ShowS

Eq SumVariant Source # 
Instance details

Defined in Futhark.Manifest

Methods

(==) :: SumVariant -> SumVariant -> Bool

(/=) :: SumVariant -> SumVariant -> Bool

Ord SumVariant Source # 
Instance details

Defined in Futhark.Manifest

data SumOps Source #

Some opaque types are sum types, from which we can (try to) extract the payload of a constructor, as well as construct them from payloads. As with records, we can ignore these facilities and simply treat them as completely opaque.

Constructors

SumOps 

Fields

Instances

Instances details
FromJSON SumOps Source # 
Instance details

Defined in Futhark.Manifest

ToJSON SumOps Source # 
Instance details

Defined in Futhark.Manifest

Show SumOps Source # 
Instance details

Defined in Futhark.Manifest

Methods

showsPrec :: Int -> SumOps -> ShowS

show :: SumOps -> String

showList :: [SumOps] -> ShowS

Eq SumOps Source # 
Instance details

Defined in Futhark.Manifest

Methods

(==) :: SumOps -> SumOps -> Bool

(/=) :: SumOps -> SumOps -> Bool

Ord SumOps Source # 
Instance details

Defined in Futhark.Manifest

Methods

compare :: SumOps -> SumOps -> Ordering

(<) :: SumOps -> SumOps -> Bool

(<=) :: SumOps -> SumOps -> Bool

(>) :: SumOps -> SumOps -> Bool

(>=) :: SumOps -> SumOps -> Bool

max :: SumOps -> SumOps -> SumOps

min :: SumOps -> SumOps -> SumOps

data OpaqueArrayOps Source #

Some opaque types are arrays of opaque types. These still support some array-like operations, but their types are somewhat different. Note that arrays of primitives are TypeArrays, and arrays of records support RecordArrayOps.

data RecordArrayOps Source #

Some opaque types are arrays of records. The RecordFields here will contain array types, and the projection functions will retrieve arrays.

data OpaqueExtraOps Source #

Some opaque types have a known structure, which allows additional operations.

Instances

Instances details
Show OpaqueExtraOps Source # 
Instance details

Defined in Futhark.Manifest

Methods

showsPrec :: Int -> OpaqueExtraOps -> ShowS

show :: OpaqueExtraOps -> String

showList :: [OpaqueExtraOps] -> ShowS

Eq OpaqueExtraOps Source # 
Instance details

Defined in Futhark.Manifest

Ord OpaqueExtraOps Source # 
Instance details

Defined in Futhark.Manifest

data OpaqueOps Source #

The names of the C functions implementing the operations on some opaque type.

Instances

Instances details
FromJSON OpaqueOps Source # 
Instance details

Defined in Futhark.Manifest

ToJSON OpaqueOps Source # 
Instance details

Defined in Futhark.Manifest

Show OpaqueOps Source # 
Instance details

Defined in Futhark.Manifest

Methods

showsPrec :: Int -> OpaqueOps -> ShowS

show :: OpaqueOps -> String

showList :: [OpaqueOps] -> ShowS

Eq OpaqueOps Source # 
Instance details

Defined in Futhark.Manifest

Methods

(==) :: OpaqueOps -> OpaqueOps -> Bool

(/=) :: OpaqueOps -> OpaqueOps -> Bool

Ord OpaqueOps Source # 
Instance details

Defined in Futhark.Manifest

Methods

compare :: OpaqueOps -> OpaqueOps -> Ordering

(<) :: OpaqueOps -> OpaqueOps -> Bool

(<=) :: OpaqueOps -> OpaqueOps -> Bool

(>) :: OpaqueOps -> OpaqueOps -> Bool

(>=) :: OpaqueOps -> OpaqueOps -> Bool

max :: OpaqueOps -> OpaqueOps -> OpaqueOps

min :: OpaqueOps -> OpaqueOps -> OpaqueOps

manifestToJSON :: Manifest -> Text Source #

Serialise a manifest to JSON.

manifestFromJSON :: Text -> Maybe Manifest Source #

Read a manifest from JSON. Returns Nothing if the text does not describe a Manifest.