Safe Haskell | Safe-Infered |
---|

A monadic library to build dataflow graphs for OM. Builder is only for Graph vector gauge () . Graphs with other annotation types can be created by fmap. This module exports everything, for writing other Builder modules.

- type Builder vector gauge anot val = State (BuilderState vector gauge anot) val
- data BuilderState vector gauge anot = BuilderState {}
- type B ret = forall v g a. Builder v g a ret
- type BuilderOf r c = forall v g a. Builder v g a (Value r c)
- buildKernel :: Setup v g a -> Name -> Builder v g a () -> Kernel v g a
- initState :: Setup v g a -> BuilderState v g a
- modifyG :: (Graph v g a -> Graph v g a) -> Builder v g a ()
- getG :: Builder v g a (Graph v g a)
- freeNode :: B Node
- addNode :: [Node] -> Node v g a -> Builder v g a Node
- addNodeE :: [Node] -> (a -> Node v g a) -> Builder v g a Node
- valueToNode :: (TRealm r, Typeable c) => Value r c -> B Node
- lookUpStatic :: Named DynValue -> B StaticIdx
- load :: (TRealm r, Typeable c) => r -> c -> Name -> B (Value r c)
- store :: (TRealm r, Typeable c) => Name -> Builder v g a (Value r c) -> Builder v g a ()
- reduce :: Typeable c => Operator -> Builder v g a (Value TLocal c) -> Builder v g a (Value TGlobal c)
- broadcast :: Typeable c => Builder v g a (Value TGlobal c) -> Builder v g a (Value TLocal c)
- shift :: Typeable c => v g -> Builder v g a (Value TLocal c) -> Builder v g a (Value TLocal c)
- loadIndex :: Typeable c => c -> Axis v -> Builder v g a (Value TLocal c)
- loadSize :: (TRealm r, Typeable c) => r -> c -> Axis v -> Builder v g a (Value r c)
- imm :: (TRealm r, Typeable c) => c -> B (Value r c)
- mkOp1 :: (TRealm r, Typeable c) => Operator -> Builder v g a (Value r c) -> Builder v g a (Value r c)
- mkOp2 :: (TRealm r, Typeable c) => Operator -> Builder v g a (Value r c) -> Builder v g a (Value r c) -> Builder v g a (Value r c)
- annotate :: (TRealm r, Typeable c) => (a -> a) -> Builder v g a (Value r c) -> Builder v g a (Value r c)
- (<?>) :: (TRealm r, Typeable c) => (a -> a) -> Builder v g a (Value r c) -> Builder v g a (Value r c)
- withAnnotation :: (a -> a) -> Builder v g a ret -> Builder v g a ret

# Documentation

type Builder vector gauge anot val = State (BuilderState vector gauge anot) valSource

data BuilderState vector gauge anot Source

(Show anot, Show (vector gauge), Vector vector) => Show (BuilderState vector gauge anot) | |

Eq (Builder v g a ret) | |

(TRealm r, Typeable c, C c, Fractional c) => Fractional (Builder v g a (Value r c)) | you can convert GHC floating point immediates to |

(TRealm r, Typeable c, C c) => Num (Builder v g a (Value r c)) | you can convert GHC numeric immediates to |

Show (Builder v g a ret) | |

(TRealm r, Typeable c) => C (Builder v g a (Value r c)) | choose the larger or the smaller of the two. |

(TRealm r, Typeable c, C c) => C (Builder v g a (Value r c)) | |

(TRealm r, Typeable c, C c) => C (Builder v g a (Value r c)) | |

(TRealm r, Typeable c, C c) => C (Builder v g a (Value r c)) | |

(TRealm r, Typeable c, C c) => C (Builder v g a (Value r c)) | |

(TRealm r, Typeable c, C c) => C (Builder v g a (Value r c)) | Builder is Ring |

(TRealm r, Typeable c, C c) => C (Builder v g a (Value r c)) | |

(TRealm r, Typeable c) => C (Builder v g a (Value r c)) | |

(TRealm r, Typeable c, C c) => C (Builder v g a (Value r c)) | |

TRealm r => Boolean (Builder v g a (Value r Bool)) |

initState :: Setup v g a -> BuilderState v g aSource

:: (Graph v g a -> Graph v g a) | The graph modifying function. |

-> Builder v g a () | The state gets silently modified. |

Modify the dataflow graph stored in the `Builder`

.

:: [Node] | The list of dependent nodes. The order is recorded. |

-> Node v g a | The new node to be added. |

-> Builder v g a Node |

add a node to the graph.

:: [Node] | The list of dependent nodes. The order is recorded. |

-> (a -> Node v g a) | The new node to be added, with Annotation missing. |

-> Builder v g a Node |

add a node to the graph with an empty Annotation.

lookUpStatic :: Named DynValue -> B StaticIdxSource

look up the `Named`

`DynValue`

with the correct name and type
is included in the `staticValues`

of the `BuilderState`

:: (TRealm r, Typeable c) | |

=> r | The |

-> c | The |

-> Name | The |

-> B (Value r c) |

Load from a static value.

:: (TRealm r, Typeable c) | |

=> Name | The |

-> Builder v g a (Value r c) | The |

-> Builder v g a () | The result. |

Store to a static value.

:: (TRealm r, Typeable c) | |

=> Operator | The operator symbol |

-> Builder v g a (Value r c) | Input |

-> Builder v g a (Value r c) | Output |

Make a unary operator

:: (TRealm r, Typeable c) | |

=> Operator | The operator symbol |

-> Builder v g a (Value r c) | Input 1 |

-> Builder v g a (Value r c) | Input 2 |

-> Builder v g a (Value r c) | Output |

Make a binary operator

annotate :: (TRealm r, Typeable c) => (a -> a) -> Builder v g a (Value r c) -> Builder v g a (Value r c)Source

Execute the builder, and annotate the very result with the givin function.

(<?>) :: (TRealm r, Typeable c) => (a -> a) -> Builder v g a (Value r c) -> Builder v g a (Value r c)Source

(?) = annotate

withAnnotation :: (a -> a) -> Builder v g a ret -> Builder v g a retSource

Execute the builder under modifed annotation.