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

SimpleRewrite panics on multiports #1190

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

SimpleRewrite panics on multiports #1190

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

Comments

@aborgna-q
Copy link
Collaborator

aborgna-q commented Jun 12, 2024

Given this hugr:

graph LR
    subgraph 0 ["(0) DFG"]
        direction LR
        1["(1) Input"]
        1--"0:0<br>[]+[]"-->3
        2["(2) Output"]
        3["(3) logic.Not"]
        3--"0:0<br>[]+[]"-->4
        3--"0:0<br>[]+[]"-->5
        4["(4) logic.Not"]
        4--"0:0<br>[]+[]"-->2
        5["(5) logic.Not"]
        5--"0:1<br>[]+[]"-->2
    end
Loading

I wrote a simple replacement to replace all the nots with an empty diagram, copying the input bool to the outputs.

This throws an error:

thread 'hugr::rewrite::simple_replace::test::test_copy_inputs' panicked at hugr-core/src/hugr/rewrite/simple_replace.rs:610:92:
called `Option::unwrap()` on a `None` value

see the failing test case here

@aborgna-q aborgna-q added the bug Something isn't working label Jun 12, 2024
@aborgna-q aborgna-q self-assigned this Jun 12, 2024
github-merge-queue bot pushed a commit to CQCL/tket2 that referenced this issue Jun 17, 2024
Adds a pass for removing tuple packs immediately followed by tuple
unpacks.

Currently this only removes one-to-one connections.
The code should work for one-to-many, but there's a bug in hugr's
`SimpleRewrite` that prevents us from having replacements where multiple
outputs are connected to a single input.
See CQCL/hugr#1190.

Closes #380
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