Skip to content

Commit

Permalink
Refactor COMPRESS-INSTRUCTIONS (#830)
Browse files Browse the repository at this point in the history
* First shot refactoring COMPRESS-INSTRUCTIONS.

I believe it's sound, but does not always optimize as well -- it does not yet implement some of the
repeated passes that the old COMPRESS-INSTRUCTIONS did.

* Reimplement recursive optimization in COMPRESS-INSTRUCTIONS.

I believe the rewrite is more or less up to the same performance level as the original (passes
tests, but manual testing in REPL indicates its sequences are often a few gates longer). However,
there is some bug wrt state prep that is causing some tests still to fail.

* Rewritten COMPRESS-INSTRUCTIONS is working!

IT's not 100% functionally equivalent with the original, so I still need to run some manual tests to
evaluate its performance.

* Be smarter about which existing queue to flush.

In last commit, flushed all existing queues. I misread the original implementation, which in fact
only flushed the sub-queue which was in "passing" mode, which is the queue involving the greatest
number of qubits.

As of this commit, the output of the new COMPRESS-INSTRUCTIONS seems just as good as the original
implementation.

* Improve docstring for FLUSH-QUEUE

* Change IF to COND in FLUSH-QUEUE inside COMPRESS-INSTRUCTIONS

* Limit recursion queue size to be <=2 in COMPRESS-INSTRUCTIONS

Co-authored-by: Mark Polyakov <mapolyakov@hrl.com>
  • Loading branch information
markasoftware and Mark Polyakov committed Sep 7, 2022
1 parent 9ef4b36 commit c3c142f
Showing 1 changed file with 124 additions and 429 deletions.
Loading

0 comments on commit c3c142f

Please sign in to comment.