-
Notifications
You must be signed in to change notification settings - Fork 62
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
Improving docstrings in final qubit mapping, w/ {logical: physical}
#1563
Improving docstrings in final qubit mapping, w/ {logical: physical}
#1563
Conversation
…eys and value statement. And reversed logica-physical in the `Circuitmap.final_layout()`
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.
Nothing to amend, we can merge.
General comment, beyond this PR
Just notice that the logical
and physical
adjectives were also a poor choice, since most often they are just intermediate steps, so it's just a way of handling a permutation.
In principle, we could return just a permutation as a sequence of permuted indices.
However, the common output of each step is a transformed circuit, which may be remodeled including a permutation, or boil down to just that. But it may even contain no permutation at all, and just operate on the gates (as in the case of the Unroller
).
So, I would discourage any further focus on permutations. Including the current final_layout
, which is only sometimes present, and leading to patterns like the following
qibo/src/qibo/transpiler/pipeline.py
Lines 84 to 101 in d32efb8
for transpiler_pass in self.passes: | |
if isinstance(transpiler_pass, Optimizer): | |
transpiler_pass.connectivity = self.connectivity | |
circuit = transpiler_pass(circuit) | |
elif isinstance(transpiler_pass, Placer): | |
transpiler_pass.connectivity = self.connectivity | |
final_layout = transpiler_pass(circuit) | |
elif isinstance(transpiler_pass, Router): | |
transpiler_pass.connectivity = self.connectivity | |
circuit, final_layout = transpiler_pass(circuit) | |
elif isinstance(transpiler_pass, Unroller): | |
circuit = transpiler_pass(circuit) | |
else: | |
raise_error( | |
TranspilerPipelineError, | |
f"Unrecognised transpiler pass: {transpiler_pass}", | |
) | |
return circuit, final_layout |
Just relying the Circuit.wire_names
will embed the optional permutation in the resulting Circuit
.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1563 +/- ##
=======================================
Coverage 99.68% 99.68%
=======================================
Files 76 76
Lines 11280 11280
=======================================
Hits 11244 11244
Misses 36 36
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
PR itself:
Cool to hear 🙌 Beyond the PR:
Yes, and qiskit has changed all these names several times not too long ago, so I would say the industry hasn't yet settled on anything, and it can be tricky to keep up with what each permutation represents for each different SDK.. 😅
Precisely!
That makes sense, I'll try it, thanks! |
PR addressing Issue: #1562
CircuitMap.final_layout()
docstring fromphysical-logical
tological-physical
logical-physical
by{logical: physical}
, for showing more explicitly which are the keys/valuesExtra for reviewers:
Checklist: