qsharp-compiler icon indicating copy to clipboard operation
qsharp-compiler copied to clipboard

Allow rewrite steps to declare dependencies on other rewrite steps

Open bamarsha opened this issue 2 years ago • 0 comments

Issues #1377 and microsoft/iqsharp#606 show that lambdas need to be lifted before code gen and serialization can run. However, the compiler doesn't know this, and it tries to perform steps even when the compiler configuration or previous errors prevent lambda lifting from running. This leads to confusing error messages.

(Even with microsoft/qsharp#606 fixed by #1381, the fix only changes the default configuration - turning off lambda lifting will still cause a confusing error message, instead of one that mentions that code gen can't run without lambda lifting.)

The current design of each rewrite step being toggled independently, and using integers to indicate the order in which they should run, seems error prone. A cleaner design could be to have each rewrite step specify which steps need to run before it, so that when previous steps are disabled, later steps can be automatically skipped.

bamarsha avatar Mar 21 '22 22:03 bamarsha