-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Issue 3750 wrap up #4034
Issue 3750 wrap up #4034
Conversation
Clean up magic methods (move most into Instructions), operands returns a tuple rather than a list, fix bug in kernel and discriminator repr, general clean up of Instructions Cannot deprecate commands attribute on Instructions directly, since it must be used in the assembler. It will be easy to deprecate and remove in a few months Update documentation and fixup an operands test fix indentation in instructions init
…_lib testing file
…ne isn't provided. Add tests
…Test that deprecation warnings are printed for command tests
Remove deprecation warnings from schedule tests Remove warnings from assembler Remove or catch deprecation warnings from qobj tests Fixup style in assembler tests Migrate scheduler tests to new pulse style
2c56338
to
3c1e2f2
Compare
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.
Aside from the minor comments I made, looks good to me! I really like the changes.
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.
Almost ready!
qiskit/pulse/instructions/acquire.py
Outdated
"""Return a list of instruction operands.""" | ||
return [self.duration, self.channel, | ||
self.mem_slot, self.reg_slot] | ||
def operands(self) -> Tuple[int, AcquireChannel, MemorySlot, RegisterSlot]: |
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.
This should be limited to one of MemorySlot or RegisterSlot.
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 haven't seen that restriction anywhere else, what does that stem from? I've seen tests with acquire taking memslot and reg slot. No one uses register slots yet, so it's possible they're not handled correctly in a couple places.
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.
Can users not use readout results for fast feedback and also get that result?
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.
It will be a practical restriction in the hardware. In reality it would be something like
- acquire qubit into register
- store register into memory
Storing directly into a memory_slot is currently supported but is a convenience that masks hardware implementation. I would like to get away from multi-purpose instructions and I think this is a good first step that can be made while we are already changing the interface.
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 Acquire should really only take a register slot. This seems like an implementation change that is out of scope for this PR. Maybe next sprint?
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.
Will we be able to make the change before release?
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.
Please see my comment about names
and operands
as well.
Co-Authored-By: Thomas Alexander <thomasalexander2718@gmail.com>
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.
One tiny comment.
Co-Authored-By: Daniel Puzzuoli <dan.puzzuoli@gmail.com>
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.
Two minor suggestions. Not blocking!
…ra into issue-3750-wrap-up
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
* Clean up instructions and update documentation Clean up magic methods (move most into Instructions), operands returns a tuple rather than a list, fix bug in kernel and discriminator repr, general clean up of Instructions Cannot deprecate commands attribute on Instructions directly, since it must be used in the assembler. It will be easy to deprecate and remove in a few months Update documentation and fixup an operands test fix indentation in instructions init * Documentation improvements, add 'name=' to Instruction repr * Fixup description of operands (does not return a list now, returns a tuple) * Clean up magic methods for Pulse and its subclasses * Add more tests for instructions and move Pulse tests into a new pulse_lib testing file * Give instructions an ID. Give instructions a simple default name if one isn't provided. Add tests * Give pulses ids too * fixup some documentation and style * Fixup name printing of pulses: Display names are not auto generated. Test that deprecation warnings are printed for command tests * Remove deprecation warnings from reschedule Remove deprecation warnings from schedule tests Remove warnings from assembler Remove or catch deprecation warnings from qobj tests Fixup style in assembler tests Migrate scheduler tests to new pulse style * Try to fix missing docs links * Hide full path of module in autosum * Add an autosummary to the pulse lib init file for api ref * Apply suggestions from code review Co-Authored-By: Thomas Alexander <thomasalexander2718@gmail.com> Co-Authored-By: Daniel Puzzuoli <dan.puzzuoli@gmail.com> * Fixup style errors that I introduced during review * Cannot use 'Pulse' type hint from 'Play' due to cyclic import while deprecating __call__, so use docstring type hinting instead * Respond to feedback: improve documentation about instruction operands * Upgrade to threadsafe ids for Pulse and Instruction: no longer is the id the order that they were instantiated (which is not necessary for this purpose) * Fixup style (ignore id is not a valid name) * No display name if it is not provided by the user * Update qiskit/pulse/instructions/play.py Co-Authored-By: Thomas Alexander <thomasalexander2718@gmail.com> * Update tests and instruction repr for None default name * Style fix * Update qiskit/pulse/instructions/play.py Co-Authored-By: Daniel Puzzuoli <dan.puzzuoli@gmail.com> * Remove danp's trailing whitespace :D * PulseCommand is not used anywhere now and can be removed * Improve deprecation messaging for pulses being called * Include operands as the first argument to Instruction * Fixup docs error * Make Instruction init arg take a tuple rather than a list Co-authored-by: Thomas Alexander <thomasalexander2718@gmail.com> Co-authored-by: Daniel Puzzuoli <dan.puzzuoli@gmail.com>
Summary
Closes #3750
Details and comments
Minor API changes
operands
returns a tuple rather than a list (better type hints)id
for insts and pulses and make defaultname
None
Bug fix
__repr__
bug forDiscriminator
andKernel
configDocs
Misc / implementation changes
Pulse
+subclasses andInstruction
+subclassesPulseCommand
class wasn't used anywhere so I removed the file :DTests
test_instructions.py
: New instruction tests and migrate Acquire teststest_pulse_lib.py
: Move tests forParametricPulses
andSamplePulse
to this since they are no longerCommand
sself.assertWarns(DeprecationWarning)
to catch test warnings