Skip to content

Problems with state-order edges and SiblingSubgraph #1974

@mark-koch

Description

@mark-koch

Following CQCL/guppylang#855, guppy emits a lot more state-order edges. Lowering them to LLVM results in a panic.

E.g. the following hugr

{"version":"live","nodes":[{"parent":0,"op":"Module"},{"parent":0,"op":"FuncDefn","name":"main","signature":{"params":[],"body":{"t":"G","input":[],"output":[],"runtime_reqs":[]}}},{"parent":1,"op":"Input","types":[]},{"parent":1,"op":"Output","types":[]},{"parent":1,"op":"CFG","signature":{"t":"G","input":[],"output":[],"runtime_reqs":[]}},{"parent":4,"op":"DataflowBlock","inputs":[],"other_outputs":[],"sum_rows":[[]],"extension_delta":[]},{"parent":5,"op":"Input","types":[]},{"parent":5,"op":"Output","types":[{"t":"Sum","s":"Unit","size":1}]},{"parent":4,"op":"ExitBlock","cfg_outputs":[]},{"parent":5,"op":"Extension","extension":"tket2.quantum","name":"QAlloc","signature":{"t":"G","input":[],"output":[{"t":"Q"}],"runtime_reqs":[]},"description":"","args":[]},{"parent":5,"op":"Extension","extension":"tket2.quantum","name":"QFree","signature":{"t":"G","input":[{"t":"Q"}],"output":[],"runtime_reqs":[]},"description":"","args":[]},{"parent":5,"op":"Extension","extension":"prelude","name":"MakeTuple","signature":{"t":"G","input":[],"output":[{"t":"Sum","s":"General","rows":[[]]}],"runtime_reqs":["prelude"]},"description":"","args":[{"tya":"Sequence","elems":[]}]},{"parent":5,"op":"Extension","extension":"tket2.quantum","name":"QAlloc","signature":{"t":"G","input":[],"output":[{"t":"Q"}],"runtime_reqs":[]},"description":"","args":[]},{"parent":5,"op":"Extension","extension":"tket2.quantum","name":"MeasureFree","signature":{"t":"G","input":[{"t":"Q"}],"output":[{"t":"Sum","s":"Unit","size":2}],"runtime_reqs":[]},"description":"","args":[]},{"parent":5,"op":"Tag","tag":0,"variants":[[]]}],"edges":[[[9,1],[10,1]],[[9,0],[10,0]],[[10,0],[12,0]],[[12,1],[13,1]],[[12,0],[13,0]],[[14,0],[7,0]],[[5,0],[8,0]]],"metadata":[],"encoder":"hugr-py v0.10.3"}

generated from the guppy function

@guppy
def main() -> None:
    q1 = qubit()
    discard(q1)
    q2 = qubit()
    measure(q2)

validates, but lowering to LLVM panics with "must be dataflow edge".

It looks like this is coming from SiblingSubgraph::signature.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingrustPull requests that update Rust code

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions