Skip to content
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

Add a state preparation pass before synthesis #1854

Closed
wants to merge 17 commits into from

Conversation

annagrin
Copy link
Collaborator

Description

  • Add a pass during synthesis (before QuakeSynthesizer) to convert state data to quantum gates
  • Add tests

@annagrin annagrin marked this pull request as draft June 26, 2024 16:58
Copy link

CUDA Quantum Docs Bot: A preview of the documentation can be found here.

github-actions bot pushed a commit that referenced this pull request Jun 26, 2024
@schweitzpgi
Copy link
Collaborator

schweitzpgi commented Jun 26, 2024

Q: Is there some reason this needs to happen before parameter synthesis?

Corollary: we can't know what the state vector's value is until parameter synthesis during JIT compilation, so I'm curious if there is a technical issue why we need to synthesize gates before we get the vector's value...

@annagrin
Copy link
Collaborator Author

annagrin commented Jun 26, 2024

Q: Is there some reason this needs to happen before parameter synthesis?

Corollary: we can't know what the state vector's value is until parameter synthesis during JIT compilation, so I'm curious if there is a technical issue why we need to synthesize gates before we get the vector's value...

We do know the vector data and use it for state preparation - the new pass runs just before the quake synthesizer during synthesis and uses the same parameter data, so it is a question of ordering and what to use as input - raw vector data or the IR representing the data (const array attributes?).

So the answer to your question is: not really, it is just a current choice (i.e. I preferred to use the parameter data rather than read from the transformation of the parameter created by synthesis, like attributes from a global constant array). As we figure out how to support initializing vectors from inside the kernel from a vector created in the kernel (as opposed to passed as a parameter), I might move it around and update.

Btw, if we end up using a const array for that case, then the IR would look very similar to the IR after synthesis and we only might need one implementation, which then could run after synthesis instead. The main part of this PR is the transformation to gates itself, and it should stay the same in both cases.

github-actions bot pushed a commit that referenced this pull request Jun 26, 2024
Copy link

CUDA Quantum Docs Bot: A preview of the documentation can be found here.

github-actions bot pushed a commit that referenced this pull request Jun 27, 2024
Copy link

CUDA Quantum Docs Bot: A preview of the documentation can be found here.

github-actions bot pushed a commit that referenced this pull request Jun 27, 2024
Copy link

CUDA Quantum Docs Bot: A preview of the documentation can be found here.

github-actions bot pushed a commit that referenced this pull request Jun 28, 2024
Copy link

CUDA Quantum Docs Bot: A preview of the documentation can be found here.

@schweitzpgi
Copy link
Collaborator

schweitzpgi commented Jun 28, 2024

I think this should be done by working at the IR level. The state vector will not necessarily always be some on-the-side information. To wit, the question about inline initialization lists in a kernel.

On the other hand, thanks for the explanation. That aids my understanding.

@annagrin
Copy link
Collaborator Author

Replaced by #1891

@annagrin annagrin closed this Aug 26, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Aug 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants