next up previous index
Next: Tasks Up: Q ISA Previous: Q Primitives within Functions   Index


Graphs

A graph is a compositing operator, allowing complex operations or those which require non-strict interpretation to be specified as a dataflow graph composed of streams and tasks. All functions with a sequential implementation may also be specified using a graph representation. But not all graphs can have a semantically equivalent sequential function representation, due to their strict application.

Sequential function implementations internally use temporary local variables which are not shared between invocations. A function implemented with a graph instead uses streams for internal variables. In order to allow multiple invocations of a graph to be executed simultaneously (and minimize overhead), these streams persist between invocations.

Maintaining the identity of data stored in streams internal to a graph is handled two ways, both performed before a graph may executed. A unique copy (or instantiation) of a graph is used for each task which references it. Multiple invocations of a single task calling a graph are differentiated by extending the multidimensional space of each stream internal to the graph. A graph which has been prepared for execution in this manner is referred to as expanded.

Input and output stream parameters to a graph are represented by ``dummy'' streams in the dataflow graph structure. All references to these are replaced with the references to the streams actually bound to them by a task when a graph is expanded.

A graph declares all dimensions, both bound and internal, which are used by its component stream and tasks. Dimensions are represented in graph components by indices into a graph dimension list. When a graph is expanded, each stream must have additional dimensions defined to represent the function ``invocation space''. These are the dimensions over which the function representing the graph is being applied, with the exception of the ones already bound to the function.

When a program is loaded into the global namespace, functions implemented solely with a graph are expanded (i.e. the program is ``flattened''.) In the absence of cyclic data dependencies, this produces a single graph with maximal functional parallelism. If a graph calls itself (recurses), it may be automatically transformed into a non-recursive graph of higher dimensionality when expanded[3][4].


next up previous index
Next: Tasks Up: Q ISA Previous: Q Primitives within Functions   Index
magiceight-web@media.mit.edu