Qualtran
Qualtran copied to clipboard
`show_call_graph(bloq)` does not show costs for subbloqs of a bloq which has `my_static_costs` implemented for a cost key (like `QubitCount`)
QubitCount
is currently computed by either decomposing the bloq or looking at it signature if the decomposition doesn't exist. Often, we want to write bloqs quickly with only a call graph to annotate the costs but qubit count expression is not as simple as looking at the signature of the bloq and maximum of qubit counts of all of its callees. In this case, we would override the my_static_costs
for the Bloq and implement the expression for qubit counts in terms of qubit counts of the callees. When this is done, show_call_graph(bloq)
does not show qubit counts for the subbloqs of this bloq because for the specific cost key (qubit count in this case) the method assumes that bloq
is a leaf bloq since it has my_static_costs
implemented. This behavior should be fixed so that users can:
- Specify qubit costs of higher level bloqs as expressions of qubit counts of subbloqs
- Protocols like
show_call_graph(bloq)
continue to show qubit counts of all the subbloqs.