You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since #2435 we have developed several places where we jump through hoops to construct an invalid hugr before handing it over for linearization. The execution test for #2666 also faced similar problems.
There are at least a couple of options:
Rollback feat: ReplaceTypes allows linearizing inside Op replacements #2435, and go down the route of passing an &ReplaceTypes to all the callbacks instead. This might seem a more sensible API than ReplacementOptions, but still raises the question of how awkward it is to make the invalid hugr (e.g. using a builder) before giving it to that ReplaceTypes. Moreover it doesn't really help with the execution test.
Add a "linearizer" extension in hugr-passes, with a drop op (perhaps also copy) - this can replace the existing one in guppy/tket2. Then we'd need a ReplacementOptions that runs the ReplaceTypes on the Hugr (NodeTemplate) returned by the callback (i.e. containing that drop op) - feat: ReplaceTypes: recurse on replacements, much deprecation #2442 is aimed at doing this part. Ideally that option might even become the default ReplacementOptions (in time, that's a behaviour-breaking change); and we'd like the rule for lowering drop (using ReplacementOptions::with_linearization on an invalid hugr...thankfully we'd only need this in one place) to be included in ReplaceTypes::default() or maybe some ReplaceTypes::new_with_drop()
Since #2435 we have developed several places where we jump through hoops to construct an invalid hugr before handing it over for linearization. The execution test for #2666 also faced similar problems.
There are at least a couple of options:
&ReplaceTypesto all the callbacks instead. This might seem a more sensible API than ReplacementOptions, but still raises the question of how awkward it is to make the invalid hugr (e.g. using a builder) before giving it to that ReplaceTypes. Moreover it doesn't really help with the execution test.ReplacementOptions::with_linearizationon an invalid hugr...thankfully we'd only need this in one place) to be included inReplaceTypes::default()or maybe someReplaceTypes::new_with_drop()