-
Notifications
You must be signed in to change notification settings - Fork 61
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
Fix transpiler bugs about moved measurements and duplicated gates #1369
Conversation
@BrunoLiegiBastonLiegi I have solved the bug reported in #1363. I will try to rapidly fix the Issue in #1318, in the meantime you can start the review of this part (I was not reardering the initial qubit map and this created some issues with the random placer). I have also added the seed for the random placer |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1369 +/- ##
=======================================
Coverage 99.84% 99.84%
=======================================
Files 75 75
Lines 10799 10807 +8
=======================================
+ Hits 10782 10790 +8
Misses 17 17
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
@Simone-Bordoni Can the PR name be more descriptive? |
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.
Thanks @Simone-Bordoni I tested this with #1106 and it seems to be working
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.
A couple of other things:
- the function
translate_gate
inunroller.py
receives the variablegate
as an input, but redefines whatgate
is in a loop. - the
Custom.__call__
method inplacer.py
receives the variablemap
as an input, butmap
is apython
built-in function. This may lead to issues, so this variable should be renamed.
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.
Thanks @Simone-Bordoni.
I can confirm that this PR fixes #1318.
While testing the state_tomography
in Qibocal, I noticed that even without this PR is now failing with this error:
File "/home/andreapasquale/qibocal/src/qibocal/protocols/state_tomography.py", line 114, in _acquisition
_, results = execute_transpiled_circuit(
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/andreapasquale/qibocal/src/qibocal/auto/transpile.py", line 60, in execute_transpiled_circuit
transpiled_circ, _ = transpiler(new_circuit)
^^^^^^^^^^^^^^^^^^^^^^^
File "/home/andreapasquale/qibo/src/qibo/transpiler/pipeline.py", line 265, in __call__
return circuit, final_layout
^^^^^^^^^^^^
UnboundLocalError: cannot access local variable 'final_layout' where it is not associated with a value
I believe that the error was introduced by 8d29397. It should be related to the fact that we are returning final_layout
even if it is defined only in a if
statement. Probably in qibocal we fall in one of the cases where final_layout
is not defined.
I believe that this was related to the changes that @Edoardo-Pedicillo introduced in #1301.
Given that the error by itself is not related to this PR feel free to address the problem here or in a separate PR and I will open an issue pointing to this comment.
Solve bugs in #1363 and #1318
Checklist: