Open tanujkhattar opened 1 week ago
This is a related issue to #1397
The helper function for drawing does two things: it makes a call graph and it computes the cost of the root bloq. There's no guarantee that each node in the call graph will have its costs cached during the computation of costs on the root bloq. This can be because of
CostKey
just doesn't recurseI sortof figured it could be better to only show the costs that actually fed into the cost of the root bloq; and avoid any potential discrepancies where the cost of the callee doesn't "add up" when looking at the caller costs. This can be changed by explicitly computing the costs of all nodes in the call graph; e.g. modify GraphvizCallGraph.from_bloq
to call get_cost_cache
for each bloq in g.nodes
. You can keep feeding the overall cost cache back in, so this should be efficient. Or modify query_costs
to take a sequence of bloqs (and then do that same thing)
Running
show_call_graph(_modexp_small.make())
gives the following diagram:For some reason,
Qubits
property is not displayed for a bunch of bloqs likeCModMulK
,CtrlScaleModAdd
etc. I'm not sure what's going on here.