You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have moved to using Packages to interchange hugr definitions between the hugrverse projects. The main reasons for this is i) to embed the required extensions to validate each hugr, and ii) to bundle multiple hugrs that should be linked on the target.
In tket2 we mostly care about i). We need to be able to read hugrs+extensions from elsewhere and keep that info around.
A separate problem is also storing the entrypoint node pointer in the wire format.
Old idea
Swap the current Hugr + Node pointer used as support for a Circuit, and use a Package + {module_id: usize, entrypoint: Node} instead.
How do we serialize the node pointer, now that the circuit may be deeply nested inside a hugr?
Current solution
After some discussion, we decided that extensions will be embedded in the HUGR themselves, and the entrypoint node stored in the root's metadata. See CQCL/hugr#1613.
Since that change won't be implemented until hugr-model is done, we need a patch solution in the meantime:
Keep using a Hugr + Node for Circuit.
Store circuits as Hugrs with a root-level metadata entry indicating the entry function.
Add an extensions: Option<Vec<Extensions>> field to Circuit.
Hardcode a default extension set and use it when reading extension-less hugrs.
We have moved to using
Packages
to interchange hugr definitions between the hugrverse projects. The main reasons for this is i) to embed the required extensions to validate each hugr, and ii) to bundle multiple hugrs that should be linked on the target.In tket2 we mostly care about i). We need to be able to read hugrs+extensions from elsewhere and keep that info around.
A separate problem is also storing the entrypoint node pointer in the wire format.
Old idea
Swap the current
Hugr
+Node
pointer used as support for aCircuit
, and use aPackage
+{module_id: usize, entrypoint: Node}
instead.NodePointer
traits fromhugr-py
?https://github.com/CQCL/hugr/blob/cb613d56dbe60d98fe1df681f85d51e60f16a634/hugr-py/src/hugr/package.py#L129
Current solution
After some discussion, we decided that extensions will be embedded in the HUGR themselves, and the entrypoint node stored in the root's metadata. See CQCL/hugr#1613.
Since that change won't be implemented until
hugr-model
is done, we need a patch solution in the meantime:Hugr
+Node
forCircuit
.Hugr
s with a root-level metadata entry indicating the entry function.extensions: Option<Vec<Extensions>>
field toCircuit
.Package::from_json
, and add the default extension set as needed.https://github.com/CQCL/hugr/blob/8d9da5f6371469055c75378748a06d7290098aaf/hugr-core/src/package.rs#L143-L147
Hugr
files. Add a warning if the extension set is not the default?The text was updated successfully, but these errors were encountered: