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

[WIP] [runtime] adding mx and my support for qarrays #2231

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

cabreraam
Copy link

Description

This is a work in progress, but I wanted to go ahead and try to address issue #2219.

Upon testing this, I found that the issue arises here:

/usr/local/cudaq/include/cudaq/qis/qubit_qis.h:760:23: note: candidate function not viable: no known conversion from 'cudaq::qarray<10UL>' to 'qubit &' (aka 'qudit<2> &') for 1st argument
inline measure_result mx(qubit &q) {
                      ^

So, I implemented support for mx and my. I'm posting this before adding any test cases just to see if I'm on the right track, here.

Feedback appreciated!

Copy link

copy-pr-bot bot commented Sep 26, 2024

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

Copy link

github-actions bot commented Sep 26, 2024

CLA Assistant Lite bot All Contributors have signed the CLA.

@cabreraam
Copy link
Author

I have read the Contributor License Agreement and I hereby accept the Terms.

std::vector<measure_result> my(QubitRange &q) {
std::vector<measure_result> b;
for (auto &qq : q) {
r1(-M_PI_2, qq);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here I think you don't want the basis change operations, since you are calling the single qubit my which will apply the basis change already.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do; thanks for the tip!

@amccaskey
Copy link
Collaborator

Thanks for looking into this issue @cabreraam . Would you mind also adding a test to unittests/ and a FileCheck test to the test/AST-Quake folder? You can just use the failing snippet from Issue tracker.

@amccaskey
Copy link
Collaborator

Also while you're here, there are other mz overloads that we'll likely want to implement for mx, my. Lines 777-827

@cabreraam
Copy link
Author

Thanks for looking into this issue @cabreraam . Would you mind also adding a test to unittests/ and a FileCheck test to the test/AST-Quake folder? You can just use the failing snippet from Issue tracker.

I will do this!

Also while you're here, there are other mz overloads that we'll likely want to implement for mx, my. Lines 777-827

Sounds good; I'll look into it.

@schweitzpgi
Copy link
Collaborator

schweitzpgi commented Sep 27, 2024

/ok to test

Command Bot: Processing...

@cabreraam
Copy link
Author

cabreraam commented Sep 30, 2024

@amccaskey @schweitzpgi

Added a couple of lit tests. I tried to remove all of the superfluous stuff and just check for the most important bit of cudaq-quake's result. Let me know if you want to include all of the other setup MLIR stuff as well.

Additionally, #2219 wants to lower to OpenQASM 2.0. However, I'm not sure of a corresponding OQ2 instruction that measures with respect to y and z. (I'm using the OpenQASM 2.0 spec and the relevant cuda-quantum source code to try to deduce if I can lower this.)

Also while you're here, there are other mz overloads that we'll likely want to implement for mx, my. Lines 777-827

I will address the other mx and my cases here in a different PR for modularity.

With all of that being said, what more needs to be done to land this PR?

@khalatepradnya
Copy link
Collaborator

khalatepradnya commented Oct 29, 2024

/ok to test

Command Bot: Processing...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants