-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Setting noise_info to false in GenericBackendV2 creates issues later in the transpiler pipeline #12769
Conversation
One or more of the following people are relevant to this code:
|
Pull Request Test Coverage Report for Build 10109907875Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
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 @sbrandhsn for looking into this. I am guessing that the root of the issue was related to the instructions being global (i.e. properties=None
), but what was exactly failing, was it the pm construction or specific passes? Because as far as I understand it global instructions should be allowed too in the pipeline (so maybe the bug is down the line, not here).
Sure, they might be another issue down the line. However, if the user specifies a backend with a coupling map but without noise info, I guess we should not return a target with global instructions. :-) This is the current behavior of the code I pushed last week. |
Both options should be valid (target with global instructions and with local instructions but |
if is_fully_connected: | ||
self._target.add_instruction(gate, properties=None, name=name) | ||
else: | ||
qarg_set = self._coupling_map if gate.num_qubits > 1 else range(self.num_qubits) | ||
props = {(qarg,) if isinstance(qarg, int) else qarg: None for qarg in qarg_set} | ||
self._target.add_instruction(gate, properties=props, name=name) |
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.
hmmm what makes the fully connected cmap special in this case? Is this purely an efficiency matter?
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.
Yep, it is much more efficient to set `properties=None' here in that case, otherwise we create a dictionary with entries for each edge of the fully connected coupling map that all point to None...
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 see, but I am not sure I like this approach. This would make the behavior differ "arbitrarily" depending on the connectivity of the coupling map used, right? Some times the instructions would be global, some times they would be local with no properties... I think that the behavior should be consistent independently of the connectivity (plus, if having properties=None does introduce issues in the pipeline, then the issues aren't being fixed for the case of fully-connected cmaps, right?).
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 see - the issue here is that the memory overhead is quite large when representing an all-to-all connected by local instructions without properties. It can be up to ~2 GB for large backends whereas a backend with global instructions and no properties needs a couple of MB. Granted, one should likely not create a large all-to-all connected backend but if a user does, he will be surprised by that memory overhead.
However, I agree that a discrete change based on that fully-connected flag is similarly confusing - a backend missing only one edge to be all-to-all connected would exhibit a different memory behaviour than a fully-connected backend. Should I remove the optimizations based on is_fully_connected
? I think the pre-PR behaviour of noiseless BackendV2
is definitely incorrect...
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 think that it's safer to remove the optimizations for is_fully_connected
. It's the default behavior of the class and I can see how users would get confused if specifying a custom cmap suddenly affects the gate properties.
Sorry for not being clear in my first response. :-/ I was getting an intermittent error that I can not replicate easily right now. I think the gist was that |
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.
@sbrandhsn I have added some suggestions not to separate out the behavior of the fully connected cmap. Let me know if you agree with the approach.
Co-authored-by: Elena Peña Tapia <[email protected]>
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.
LGTM
…in the transpiler pipeline (#12769) * up * fix * Apply suggestions from code review Co-authored-by: Elena Peña Tapia <[email protected]> * lint --------- Co-authored-by: Elena Peña Tapia <[email protected]> (cherry picked from commit edf0b53)
…in the transpiler pipeline (#12769) (#12823) * up * fix * Apply suggestions from code review Co-authored-by: Elena Peña Tapia <[email protected]> * lint --------- Co-authored-by: Elena Peña Tapia <[email protected]> (cherry picked from commit edf0b53) Co-authored-by: Sebastian Brandhofer <[email protected]>
…in the transpiler pipeline (Qiskit#12769) * up * fix * Apply suggestions from code review Co-authored-by: Elena Peña Tapia <[email protected]> * lint --------- Co-authored-by: Elena Peña Tapia <[email protected]>
Summary
Fixes bugs introduced in #12747
Details and comments
I added some tests to check whether transpiling with noise-less and/or pulse-channel-less backends still works and noticed test failures. I fixed these bugs and added the corresponding test cases. I don't think this warrants a new release note but let me know if you disagree. :-)