tket icon indicating copy to clipboard operation
tket copied to clipboard

CircBox option to prevent compiler modifications inside the box

Open ss2165 opened this issue 2 years ago • 5 comments

Often users want to write precise target-aware circuits and want the compiler to not modify them, it would be useful to offer this functionality in a composable way.

Inspired by braket's "verbatim box" I propose adding an option to circbox which signals to passes to skip the internals.

ss2165 avatar Oct 17 '23 08:10 ss2165

This seems a nice thing to be able to do. But it would need special-casing in the predicates system; e.g. a rebase pass would no longer guarantee that the circuit was in a specific gate set afterwards.

cqc-alec avatar Oct 18 '23 14:10 cqc-alec

This seems a nice thing to be able to do. But it would need special-casing in the predicates system; e.g. a rebase pass would no longer guarantee that the circuit was in a specific gate set afterwards.

To avoid that problem, would it be enough to just have the rebase pass check that the "untouchable" box only contains allowed gates. If it doesn't, fail compilation?

trvto avatar Oct 18 '23 15:10 trvto

To avoid that problem, would it be enough to just have the rebase pass check that the "untouchable" box only contains allowed gates. If it doesn't, fail compilation?

Yes that would work.

cqc-alec avatar Oct 18 '23 15:10 cqc-alec

Actually, isn't the description here the wrong way round? Because right now, compilation passes don't go inside boxes: if you want to run a pass on the contents of a CircBox you have to do DecomposeBoxes() first. What is missing is a way to allow the internals of a CircBox to be modified by a compilation pass -- while retaining it as a box.

cqc-alec avatar Nov 21 '23 14:11 cqc-alec

This issue has been automatically marked as stale.

github-actions[bot] avatar Jun 08 '24 05:06 github-actions[bot]