Skip to content

Commit

Permalink
docs: Document LoadFunction (#1016)
Browse files Browse the repository at this point in the history
Addresses #998

---------

Co-authored-by: Alec Edgington <[email protected]>
  • Loading branch information
doug-q and cqc-alec authored May 9, 2024
1 parent b0eb9d3 commit fae2993
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions specification/hugr.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,11 +202,11 @@ source node, to an incoming port of the target node.

#### Static edges (`Const` and `Function`)

A Static edge represents dataflow that is statically knowable - i.e.
the source is a compile-time constant defined in the program. Hence, the types on these edges
are classical. Only a few nodes may be
sources (`FuncDefn`, `FuncDecl` and `Const`) and targets (`Call` and `LoadConstant`) of
these edges; see [operations](#node-operations).
A Static edge represents dataflow that is statically knowable - i.e. the source
is a compile-time constant defined in the program. Hence, the types on these
edges are classical. Only a few nodes may be sources (`FuncDefn`, `FuncDecl` and
`Const`) and targets (`Call`, `LoadConstant`, and `LoadFunction`) of these
edges; see [operations](#node-operations).

#### `Order` edges

Expand Down Expand Up @@ -289,6 +289,10 @@ the following basic dataflow operations are available (in addition to the
- `LoadConstant<T>`: has an incoming `Const<T>` edge, where `T` is a `CopyableType`, and a
`Value<T>` output, used to load a static constant into the local
dataflow graph.
- `LoadFunction`: has an incoming `Function` edge and a `Value<FunctionType>`
output. The `LoadFunction` node specifies any type arguments to the function
in the node weight, and the `FunctionType` in the output edge matches the
(type-instantiated) function in the incoming `Function` edge.
- `identity<T>`: pass-through, no operation is performed.
- `DFG`: A nested dataflow graph.
These nodes are parents in the hierarchy.
Expand Down Expand Up @@ -2006,12 +2010,13 @@ including `Module`.
| Node type | `Value` | `Order` | `Const` | `Function` | `ControlFlow` | `Hierarchy` | Children |
|----------------|---------|---------|---------|------------|---------------|-------------|----------|
| Root | 0, 0 | 0, 0 | 0, 0 | 0, 0 | 0, 0 | 0, ✱ | |
| `FuncDefn` | 0, 0 | 0, 0 | 0, 0 | 0, * | 0, 0 | 1, + | DSG |
| `FuncDecl` | 0, 0 | 0, 0 | 0, 0 | 0, * | 0, 0 | 1, 0 | |
| `FuncDefn` | 0, 0 | 0, 0 | 0, 0 | 0, | 0, 0 | 1, + | DSG |
| `FuncDecl` | 0, 0 | 0, 0 | 0, 0 | 0, | 0, 0 | 1, 0 | |
| `AliasDefn` | 0, 0 | 0, 0 | 0, 0 | 0, 0 | 0, 0 | 1, 0 | |
| `AliasDecl` | 0, 0 | 0, 0 | 0, 0 | 0, 0 | 0, 0 | 1, 0 | |
| `Const` | 0, 0 | 0, 0 | 0, ✱ | 0, 0 | 0, 0 | 1, 0 | |
| `LoadConstant` | 0, 1 | +, ✱ | 1, 0 | 0, 0 | 0, 0 | 1, 0 | |
| `LoadConstant` | 0, 1 | ✱, ✱ | 1, 0 | 0, 0 | 0, 0 | 1, 0 | |
| `LoadFunction` | 0, 1 | ✱, ✱ | 0, 0 | 1, 0 | 0, 0 | 1, 0 | |
| `Input` | 0, ✱ | 0, ✱ | 0, 0 | 0, 0 | 0, 0 | 1, 0 | |
| `Output` | ✱, 0 | ✱, 0 | 0, 0 | 0, 0 | 0, 0 | 1, 0 | |
| `Call` | ✱, ✱ | ✱, ✱ | 0, 0 | 1, 0 | 0, 0 | 1, 0 | |
Expand Down

0 comments on commit fae2993

Please sign in to comment.