Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Circuit need to keep track of their Extensions #676

Open
Tracked by #671
aborgna-q opened this issue Oct 23, 2024 · 0 comments
Open
Tracked by #671

Circuit need to keep track of their Extensions #676

aborgna-q opened this issue Oct 23, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request rust Pull requests that update Rust code

Comments

@aborgna-q
Copy link
Collaborator

aborgna-q commented Oct 23, 2024

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.

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.
@aborgna-q aborgna-q added enhancement New feature or request rust Pull requests that update Rust code labels Oct 23, 2024
@aborgna-q aborgna-q self-assigned this Oct 23, 2024
@aborgna-q aborgna-q changed the title Circuit should wrap a Package instead of Hugr Circuit need to keep track of their Extensions Oct 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request rust Pull requests that update Rust code
Projects
None yet
Development

No branches or pull requests

1 participant