quri_parts.qsub.eval.callgraph module

class CallGraphEvaluatorHooks

Bases: EvaluatorHooks[dict[Ident | None, dict[Ident, int]]]

Report the call graph of a sub.

The result maps each sub to the subs it calls directly. Each callee maps to the number of calls in one invocation of the caller. Callees appear in the order of the first call. A sub that calls no sub maps to an empty dict.

Each sub appears as the Ident of the op it implements, the same value SubwiseProfileEntry reports as source_op. Parametric subs are distinct per parameter: MCX<5> and MCX<6> are two subs. Only the entry sub of compile_sub has no op; its key is None.

reset()
Return type:

None

result()
Return type:

dict[Ident | None, dict[Ident, int]]

enter_sub(sub, qubits, regs, call_stack)
Parameters:
Return type:

bool

primitive(mop, qubits, regs, call_stack)
Parameters:
  • mop (Primitive)

  • qubits (Sequence[Qubit])

  • regs (Sequence[Register])

  • call_stack (list[qsub.machineinst.SubId])

Return type:

None

exit_sub(sub, enter_sub, call_stack)
Parameters:
  • sub (MachineSub)

  • enter_sub (bool)

  • call_stack (list[qsub.machineinst.SubId])

Return type:

None