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 edges to device #3993

Merged
merged 18 commits into from
Jun 3, 2021
Merged

Add edges to device #3993

merged 18 commits into from
Jun 3, 2021

Conversation

daxfohl
Copy link
Contributor

@daxfohl daxfohl commented Apr 5, 2021

Closes #3696

@google-cla google-cla bot added the cla: yes Makes googlebot stop complaining. label Apr 5, 2021
Copy link
Collaborator

@HGSilveri HGSilveri left a comment

Choose a reason for hiding this comment

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

As far as PasqalDevice is concerned, this LGTM. Thanks for the enhancement!

cirq/devices/device.py Outdated Show resolved Hide resolved
@daxfohl
Copy link
Contributor Author

daxfohl commented Apr 5, 2021

Updated the function name to edge_set() because there was a conflicting edges property in graph_device. There is already a qubit_set() function, so following that precedent with the new name.

Copy link
Collaborator

@mpharrigan mpharrigan left a comment

Choose a reason for hiding this comment

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

Not all devices have (only) two qubit gates. How would this work for devices that support multi-qubit operations?

cirq/devices/device.py Outdated Show resolved Hide resolved
@mpharrigan
Copy link
Collaborator

+1 using a name other than "edges"

@daxfohl
Copy link
Contributor Author

daxfohl commented Apr 6, 2021

What would be better here? The tuple implementation I had first is error prone because tuples are not symmetric. The implementation with the custom QidPair is symmetric but then the question was raised about whether that's a valid assumption for all devices.

Should we go with a third option, which is back to using tuples, but have both orderings be emitted instead of just one? That would double the output size but allow for directional edges if needed.

Per 3+ qubit gates, I don't think this is where that functionality would go. Once you have the two gate edges, you can feed those into some external function to extract n-gate sequences. I'd say that should be external to the device code. Unless there's something specific about devices and what edges are n-qubit capable?

@mpharrigan
Copy link
Collaborator

I don't think any of my questions should be seen as blockers. Just curious if you'd thought about any of them or had any thoughts.

Per 3+ qubit gates, I don't think this is where that functionality would go. Once you have the two gate edges, you can feed those into some external function to extract n-gate sequences. I'd say that should be external to the device code. Unless there's something specific about devices and what edges are n-qubit capable?

Yeah fair. Of course you can always dream up something crazy like if three qubits could do a toffli but you couldn't do a two-qubit interaction between any two of them.

QidPair is a nice addition for order-agnostic pairs. I suspect the main problem will be that there are many locations in the code where we technically should be using such a class but instead use a two-tuple.

For something actionable: I do think the name should be qubit_pairs and not anything to do with edges.

@daxfohl
Copy link
Contributor Author

daxfohl commented Apr 15, 2021 via email

@daxfohl
Copy link
Contributor Author

daxfohl commented Apr 27, 2021

@balopat ping to look at this whenever you have time, no rush. I'm by no means attached to this PR so if you want to change it completely, or table it until some other things are settled just lmk.

@95-martin-orion
Copy link
Collaborator

Paging @balopat for review.

Copy link
Contributor

@balopat balopat left a comment

Choose a reason for hiding this comment

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

Sorry for making you wait on this for so long. I'm fine with merging this, however some parts might change as the Device strategy gets sorted out.

cirq-core/cirq/devices/device.py Outdated Show resolved Hide resolved
cirq-core/cirq/pasqal/pasqal_device.py Outdated Show resolved Hide resolved
cirq-core/cirq/devices/device.py Show resolved Hide resolved
@daxfohl daxfohl requested a review from balopat June 3, 2021 18:03
@balopat balopat added the automerge Tells CirqBot to sync and merge this PR. (If it's running.) label Jun 3, 2021
@CirqBot CirqBot added the front_of_queue_automerge CirqBot uses this label to indicate (and remember) what's being merged next. label Jun 3, 2021
@CirqBot CirqBot merged commit 06b34df into quantumlib:master Jun 3, 2021
@CirqBot CirqBot removed automerge Tells CirqBot to sync and merge this PR. (If it's running.) front_of_queue_automerge CirqBot uses this label to indicate (and remember) what's being merged next. labels Jun 3, 2021
@daxfohl daxfohl deleted the edges branch July 9, 2021 04:23
rht pushed a commit to rht/Cirq that referenced this pull request May 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Makes googlebot stop complaining.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Provide a way to iterate through the edges of a device
7 participants