-
Notifications
You must be signed in to change notification settings - Fork 14
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
Use of wire_names
#1079
Use of wire_names
#1079
Conversation
Initially, I refactored the code so that all |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## 0.1 #1079 +/- ##
==========================================
- Coverage 69.89% 69.88% -0.02%
==========================================
Files 64 64
Lines 6876 6880 +4
==========================================
+ Hits 4806 4808 +2
- Misses 2070 2072 +2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
020f980
to
b96e3b4
Compare
06ece97
to
470d971
Compare
470d971
to
801dced
Compare
This comment was marked as resolved.
This comment was marked as resolved.
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.
Other than the handling of the temporary fix, it seems fine to me :)
src/qibolab/backends.py
Outdated
# This should be done in qibo side | ||
# Temporary fix: overwrite the wire names | ||
if not all(q in circuit.wire_names for q in self.platform.qubits): | ||
circuit._wire_names = self.qubits |
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.
Do you actually need this fix? Or can we rely just on qiboteam/qibo#1500?
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.
Do you actually need this fix?
No, if qiboteam/qibo#1500 is applied, we can remove the temporary fix.
Currently, the circuit implementation in qibo uses q{i}
as the default qubit names and does not support setting wire_names
as list[int]
through the setter. And there are minor issues where wire_names
are not copied when copying the circuit. I included a temporary fix to avoid adding meaningless lines in the test files.
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.
We have two options:
- keep the workaround and merge it (with temp fix lines)
- start targeting the branch in Transpiler refactor qibo#1500 and block the merge of this PR to its release (no temp fix lines)
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.
So, while before I was more undecided about what to do, cf. #1079 (comment), I now believe we should not block this PR behind qiboteam/qibo#1500. The temporary workaround may work well enough, such that we could move forward just relying on it, and get back whenever the other one will be merged (that may even be not required at all for 0.1, as it is approaching EOL, and there may be no further releases).
However, I'd still wait for @stavros11 opinion as well.
(btw, in the meanwhile @csookim you may merge/rebase, since #1076 got merged)
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.
I was going to say that keeping on hold probably takes less effort since if we merge we will then have to also open another PR to undo the temporary fix. However, in order to include this in the next release we can probably merge as it is. I would still open an issue to remove the temporary fix, though.
The only issue is that if the temporary fix does not work well with qibo after qiboteam/qibo#1500 is merged, then we may need to release qibolab 0.1 again, but I don't think that's the case.
Other than that, thanks @csookim for the updates and the compiler refactoring, it looks good to me now.
Ok, wait a second: this is done here because you expect that all the circuits coming out of the transpiler should be padded with all the qubits present in the platform, eventually. Correct? @csookim If that's the case, the moment this will be done by the transpiler, the temporary fix should be just ineffective. |
I think so, because EDIT: Ignore this comment, I am actually wrong. |
Yes, it should be padded with the same name as the connectivity graph nodes (=
If the transpiler is updated, we must remove the temp fix cause it overwrites the order |
But, if the transpiler is padding on its side, you should not be entering the conditional, isn't it? qibolab/src/qibolab/backends.py Lines 128 to 131 in 9e9d625
|
Oh, sorry. If the transpiler starts padding consistently with the connectivity, then the temporary fix becomes ineffective. It only has an effect when the transpiler doesn’t consider the connectivity. |
@alecandido based on the last discussion, I think this can be merged and released with qibolab 0.1.10. The temporary fix should be ineffective after qiboteam/qibo#1500 is merged, therefore we will not have to release another 0.1 to remove it after we release the new qibo. |
Just to fully understand, and check we are on the same page. Padding consistently is not required. If you send a So, given this situation, padding is fully optional (unless I'm missing something). We can then resolve the present situation in two alternative ways:
I believe 2. to be slightly more elegant, but to be fair: it's just a temporary fix, I'm not really concerned. To me, both solutions are fine, including the current one, provided that qiboteam/qibo#1500 will properly implement its side of the contract. |
Or we could check like this: Before if not all(q in circuit.wire_names for q in self.qubits):
circuit._wire_names = self.qubits After if not all(q in self.qubits for q in circuit.wire_names):
circuit._wire_names = self.qubits[:circuit.nqubits] To give up on padding and consider the names only. |
Yes, that's definitely an option. I had in mind to be as specific as: if circuit.wire_names == [f"q{n}" for n in range(circuit.nqubits)]:
circuit._wire_names = self.qubits because this should make extremely likely for the conditional to expire after qiboteam/qibo#1500. However, if the condition you're proposing is essentially what is needed to execute, it's even cleaner to use that one instead (and it should also expire after qiboteam/qibo#1500, since the transpiler will make sure to satisfy that). |
In this case, there could be an issue if the qubit names are |
This covers issue #1073.
Updates
circuit.wire_names
is copied toPlatform.wire_names
each timeexecute_circuit(circuit, ...)
is run.get_qubit(qubit)
, whenqubit
is an integer, it returns the corresponding physical qubit name fromwire_names
.get_qubit()
is used to retrieveQubitId
.Checklist: