quri_parts.qsub.eval.subwiseprofile module¶
- class QubitCounts(data, auxiliary, total)¶
Bases:
objectQubits a sub occupies during one invocation.
dataare the qubits the caller passes in.auxiliaryare the sub’s own ancillas (itsaux_qubits) plus the largestauxiliaryamong the subs it calls: sequential callees reuse the same ancilla space, so they contribute a maximum rather than a sum. The sub’s own ancillas stay live across those calls, so they add to that maximum.- Parameters:
data (int)
auxiliary (int)
total (int)
- data: int¶
- auxiliary: int¶
- total: int¶
- class GateCounts(per_call, all_calls)¶
Bases:
objectPrimitive-gate counts of one scope.
Keys are gate
Idents, op parameters included, soRZ<0.1>andRZ<0.2>are counted apart; this is finer thanGateCountEvaluatorHooks, which keys byBaseIdentand merges them.per_callis for a single invocation of the sub,all_callsfor allcall_countof them.
- class GateCountBreakdown(own, descendants, cumulative)¶
Bases:
objectPrimitive-gate counts of a sub, split by where the gates come from.
owncovers the sub’s own instructions,descendantsthose contributed transitively by everything it calls, andcumulativetheir sum.- Parameters:
own (GateCounts)
descendants (GateCounts)
cumulative (GateCounts)
- own: GateCounts¶
- descendants: GateCounts¶
- cumulative: GateCounts¶
- class SubwiseProfileEntry(source_op, call_count, qubit_counts, gate_counts)¶
Bases:
objectPer-sub profiling row produced by
SubwiseProfileEvaluatorHooks.source_opidentifies the op this sub implements, parameters included; useIdent.to_str()for a display name. It isNonewhen the op is unknown (the entry sub ofcompile_sub, which receives aSubrather than anOp).- Parameters:
source_op (Ident | None)
call_count (int)
qubit_counts (QubitCounts)
gate_counts (GateCountBreakdown)
- call_count: int¶
- qubit_counts: QubitCounts¶
- gate_counts: GateCountBreakdown¶
- class SubwiseProfileEvaluatorHooks(gates=())¶
Bases:
EvaluatorHooks[list[SubwiseProfileEntry]]Report, per distinct sub, how often it is called and the gate/qubit counts attributable to it.
Takes the same arguments as
GateCountEvaluatorHooks: pass the ops to break down, or nothing to count every primitive. A row’ssource_opcarries the op parameters, so parametric subs are reported separately per parameter (MCX<5>andMCX<6>are distinct rows).- Parameters:
gates (Iterable[AbstractOp])
- reset()¶
- Return type:
None
- result()¶
- Return type:
list[SubwiseProfileEntry]
- enter_sub(sub, qubits, regs, call_stack)¶
- Parameters:
sub (MachineSub)
qubits (Sequence[Qubit])
regs (Sequence[Register])
call_stack (list[qsub.machineinst.SubId])
- Return type:
bool
- primitive(mop, qubits, regs, call_stack)¶
- exit_sub(sub, enter_sub, call_stack)¶
- Parameters:
sub (MachineSub)
enter_sub (bool)
call_stack (list[qsub.machineinst.SubId])
- Return type:
None