quil-lang / quilc

The optimizing Quil compiler.
Apache License 2.0
448 stars 73 forks source link

Add PRAGMA to allow user control of swap search strategy #914

Closed macrologist closed 5 months ago

macrologist commented 5 months ago

This PR adds a specialized PRAGMA for controlling the value of the *addresser-rewiring-search-search-type* special variable. This value defaults to :a* but two other options are available that have been previous unexposed to end-users.

The PRAGMA introduced here has the following syntax:

PRAGMA REWIRING_SEARCH <SEARCHTYPE>

Where <SEARCHTYPE> should be a string that names one of the available algorithms: "A*", "GREEDY_QUBIT", or "GREEDY_PATH".

This PR is offered as a partial answer to #913 after discovering through experimentation that the offending program + chip spec discussed there compiled more quickly and with lower resource requirements after manually rebinding the *addresser-rewiring-swap-search-type* in the REPL.

It should be noted that I did not reproduce the exact crash that @marquessV encountered, probably due to increased heap size given to SBCL on my machine. Compilation with the default search type of ':A* did, however, take a very long time to finish.