-
Notifications
You must be signed in to change notification settings - Fork 184
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement a loop peeling pass. #824
Conversation
d339984
to
23eb507
Compare
CUDA Quantum Docs Bot: A preview of the documentation can be found here. |
CUDA Quantum Docs Bot: A preview of the documentation can be found here. |
c8b654b
to
8979ed6
Compare
Command Bot: Processing... |
CUDA Quantum Docs Bot: A preview of the documentation can be found here. |
b27bbdc
to
6ef8df1
Compare
CUDA Quantum Docs Bot: A preview of the documentation can be found here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this work if there are alloca
's in the loop body? It looks like the current tests don't have any cc.alloc
's or quake.alloca
's in the loop body. I could be wrong, but it seems like special handling would be needed to handle that.
(Maybe it doesn't matter because there would also be corresponding dealloc
's.)
No special handling is needed. A For the case in hand, any qubits allocated within the body of a do-while will be scoped or mirrored. So just like unrolling, each qubit's allocation and deallocation will happen exactly once per iteration. |
This pass only implements a very resricted form of loop peeling. Specifically, a do-while loop is peeled and converted into a copy of the body of the do and a succeeding while loop. The purpose of this transformation is to allow do-while loops to be converted to while loops. Once unrolling of general while loops is enabled, the compiler will be able to fully unroll a wider range of styles of loop statements. Fix some bugs and extend test to include loop with region arguments.
6ef8df1
to
72e0eac
Compare
CUDA Quantum Docs Bot: A preview of the documentation can be found here. |
This pass only implements a very resricted form of loop peeling. Specifically, a do-while loop is peeled and converted into a copy of the body of the do and a succeeding while loop.
The purpose of this transformation is to allow do-while loops to be converted to while loops. Once unrolling of general while loops is enabled, the compiler will be able to fully unroll a wider range of styles of loop statements.