the way the code is structured, the winner gate returns 2 versions of the basis gate, where the scaled winner gate has the proper scaled drive strengths and time. When I first wrote this, this allowed the non-scaled winner_gate to go to the CircuitTemplate so it would load the right coverage set.
winner_gate, scaled_winner_gate = pick_winner(self.group_name, metric=metric, plot=False, smush_bool=smush_bool, family_extension=self.family_extension)
#that way we only have to compute a single coverage set
#NOTE winner_gate goes to constructor so hits the saved polytope coverage set
template = MixedOrderBasisCircuitTemplate(base_gates=[winner_gate], smush_bool=smush_bool)
Later, to rectify this, when the template has the build method called, scaled_winner_gate is provided so it can be instantiated in place.
#NOTE, when we build, actually use the scaled_winner_gate which has the proper duration attiriubte
template.build(reps, scaled_winner_gate)
However, in the family_extension case, now there is a problem because the recursive function is operating on the non-scaled gate.
ret = recursive_sibling_check(template, target, cost_1q=self.duration_1q, basis_factor=scaled_winner_gate.duration, use_smush=smush_bool)
Something is breaking with the ret circuit's duration. Either the basis_factor scaling is not working correctly, or we can just rewrite to more simpler.
Proposed solution is to instead originally pass thescaled_winner_gate to the template, and only make the normalization when loading the coverage set file. The monkey patch solution I originally used was to substitute in place a dummy gate which changed the duration to scale to ret value. This sort of works, but the gate information is lost.
In
speed_limit_pass.py
,the way the code is structured, the winner gate returns 2 versions of the basis gate, where the scaled winner gate has the proper scaled drive strengths and time. When I first wrote this, this allowed the non-scaled winner_gate to go to the CircuitTemplate so it would load the right coverage set.
Later, to rectify this, when the template has the build method called,
scaled_winner_gate
is provided so it can be instantiated in place.However, in the
family_extension
case, now there is a problem because the recursive function is operating on the non-scaled gate.Something is breaking with the ret circuit's duration. Either the
basis_factor
scaling is not working correctly, or we can just rewrite to more simpler.Proposed solution is to instead originally pass the
scaled_winner_gate
to the template, and only make the normalization when loading the coverage set file. The monkey patch solution I originally used was to substitute in place a dummy gate which changed the duration to scale to ret value. This sort of works, but the gate information is lost.