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

Allow changing extension_reqs in SiblingSubgraph::create_simple_replacement. #1175

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

Allow changing extension_reqs in SiblingSubgraph::create_simple_replacement. #1175

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

Comments

@aborgna-q
Copy link
Collaborator

Replacing a node with another that requires more extensions should be possible, but currently it fails with a InvalidReplacement::InvalidSignature error due to the mismatched extension_reqs.

@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
@aborgna-q aborgna-q changed the title Allow adding extension_reqs in new replacement. Allow changing extension_reqs in SimpleReplacement. Jun 6, 2024
@aborgna-q aborgna-q changed the title Allow changing extension_reqs in SimpleReplacement. Allow changing extension_reqs in SiblingSubgraph::create_simple_replacement. Jun 6, 2024
github-merge-queue bot pushed a commit that referenced this issue Jun 7, 2024
…nt (#1177)

Fixes #1175 

Signatures have three components:
- The input type row
- The output type row
- The set of extensions used by the local operations

Many interesting replacements in a graph changes the latter, but
`SiblingSubgraph::create_simple_replacement` required the signatures to
match exactly.
github-merge-queue bot pushed a commit to CQCL/tket2 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 to CQCL/tket2 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