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

CircuitRewrite does only support Dfg-rooted circuits #389

Closed
Tracked by #377
aborgna-q opened this issue Jun 6, 2024 · 0 comments · Fixed by #391
Closed
Tracked by #377

CircuitRewrite does only support Dfg-rooted circuits #389

aborgna-q opened this issue Jun 6, 2024 · 0 comments · Fixed by #391
Assignees
Labels
bug Something isn't working

Comments

@aborgna-q
Copy link
Collaborator

Subcircuit::create_rewrite and CircuitRewrite::try_new convert the target circuit to work with the requirements of hugr::SimpleReplacement.

See CQCL/hugr#1169 CQCL/hugr#1171

@aborgna-q aborgna-q added the bug Something isn't working label Jun 6, 2024
@aborgna-q aborgna-q self-assigned this Jun 6, 2024
github-merge-queue bot pushed a commit that referenced this issue Jun 17, 2024
…ors (#390)

- Stores the circuit name in the `FuncDefn` operations instead of a
"name" metadata key.
In the future we will decode tket1 circuits into funtion definitions
instead of Dfg blocks, but that currently causes errors due to
CQCL/hugr#1175.

- `Circuit::circuit_signature` returns a `FunctionType` instead of a
`PolyFuncType`, since we (currently) don't allow parametric signatures.

- Improves the errors when constructing and manipulating circuits.

This work is in the path to solving #385 and #389, but we will require
some fixes in hugr (CQCL/hugr#1177) before
fixing the support for non-Dfg rooted circuits.
github-merge-queue bot pushed a commit that referenced this issue Jun 17, 2024
Followup to #390.
Fixes #389.
Closes #385.
~~Blocked by CQCL/hugr#1175

Fixes support for non-`Dfg` circuits and circuits with a non-root
parent:

Adds a `Circuit::extract_dfg(&self)` function that extracts the circuit
into a new hugr with a DFG operation at the root.
In some cases, like in a CFG DataflowBlock node, this requires some
changes to the definition to eliminate the output sum type.
Here I only implemented it for the kind of blocks produced by guppy. We
could replace the manual implementation once
CQCL/hugr#818 gets implemented.

With this we can now fix #389 by extracting the circuit before using it
as a replacement in `SimpleReplacement::create_simple_replacement`.

Replaces `DfgBuilder` with `FunctionBuilder` where possible, so we can
use named circuits in the tests.
(This failed before due to the bug in CircuitRewrite).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant