While poking quilc with my stick, I came across a handful of (to me) surprising compilations. Most of these are "wacky" / useless programs and all involve multiple WAIT instructions, which I am not even sure is supported.
I am posting these here for comments in case any of these are user error. I will spin off separate issues for any that I am able to determine are actual bugs.
These all came about after I noticed that HALT, WAIT, RESET, and NOP instructions are represented as singleton classes, which made me wonder if there was someway to exploit that to trip quilc up.
Curio No. 1: WAIT, WAIT, BOOM!
This is the only one I'm fairly certain is a bug or should at least report a better error message.
You can stick most other instructions between the WAITs and get the same result.
Notice that both WAIT instructions have the same "entering rewiring" with no intervening "exiting rewiring" comment. Expected?
I think this can happen with any quil program that contains multiple NOP, RESET, WAIT, HALT, etc instructions, since rewiring comments are stored in a hash-table keyed on the instructions and all those instructions are singletons. In other words, every instance of those singleton instructions in a program will have the same rewiring comment attached.
Consider also the following REPL session, where the intervening call to compiler-hook affects the printed representation of the parsed-program. I do not claim this a bug per-se, but it demonstrates the comment sharing, which could explain the above quilc output.
While poking quilc with my stick, I came across a handful of (to me) surprising compilations. Most of these are "wacky" / useless programs and all involve multiple WAIT instructions, which I am not even sure is supported.
I am posting these here for comments in case any of these are user error. I will spin off separate issues for any that I am able to determine are actual bugs.
These all came about after I noticed that HALT, WAIT, RESET, and NOP instructions are represented as singleton classes, which made me wonder if there was someway to exploit that to trip quilc up.
Curio No. 1: WAIT, WAIT, BOOM!
This is the only one I'm fairly certain is a bug or should at least report a better error message.
You can stick most other instructions between the WAITs and get the same result.
Curio No. 2: Comment sharing
This is now #270
Notice that both WAIT instructions have the same "entering rewiring" with no intervening "exiting rewiring" comment. Expected?
I think this can happen with any quil program that contains multiple NOP, RESET, WAIT, HALT, etc instructions, since rewiring comments are stored in a hash-table keyed on the instructions and all those instructions are singletons. In other words, every instance of those singleton instructions in a program will have the same rewiring comment attached.
Consider also the following REPL session, where the intervening call to
compiler-hook
affects the printed representation of the parsed-program. I do not claim this a bug per-se, but it demonstrates the comment sharing, which could explain the above quilc output.Curio No. 3: The Case of the Disappearing MEASURE
This next one does what I'd expect.
But adding a second WAIT after the final MEASURE causes both WAITS and the final MEASURE to be dropped.
You can make this one more interesting by actually doing something with the qubits between the measurements.