-
Notifications
You must be signed in to change notification settings - Fork 34
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
[RFC] Qiskit Pulse: Relative timing for Schedules #16
[RFC] Qiskit Pulse: Relative timing for Schedules #16
Conversation
…ons in pulse Schedules within Qiskit Pulse
96d81f7
to
3cdf72f
Compare
3cdf72f
to
9876d18
Compare
39d6653
to
95ccc84
Compare
|
||
|
||
## Summary | ||
Update the internal structure of `Schedule`s to track instructions sequentially. `Instruction`s will not be played at an explicit time; rather, they will begin immediately after the last is done. To schedule idle time between instructions, `Delay` instructions must be used. |
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.
Update the internal structure of `Schedule`s to track instructions sequentially. `Instruction`s will not be played at an explicit time; rather, they will begin immediately after the last is done. To schedule idle time between instructions, `Delay` instructions must be used. | |
Update the internal structure of `Schedule`s to track instructions sequentially. `Instruction`s will not be scheduled to be played at an explicit timestamp; rather, they will begin immediately after all channels on which the instruction effects are idle, ie., when instruction scheduling will be determined by the instruction dependency graph across channels. To schedule idle time between instructions, `Delay` instructions must be used. |
| Method | Runtime | Change | | ||
|---------------|----------------|------------------| | ||
| `append(self, schedule)` | O(\|N<sub>new</sub>\|) | | | ||
|`insert(self, time, schedule)`| O(\|N<sub>new</sub>\| * \|N<sub>C</sub>\|) | | |
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.
How do you expect inserting in the middle of a schedule work? Verify that delays are present for all insertion locations?
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.
yes. it's not great, since delays are supposed to be blocking, but I don't think there's any other way to do this
|
||
## Questions | ||
|
||
1. Should we create `insert(self, index, channel)`? |
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.
Isn't this handled by the normal insert, I don't see what is different about this?
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.
the normal insert takes time
, this takes index
. I don't really see how this index
method would be useful myself
|
Co-Authored-By: Thomas Alexander <thomasalexander2718@gmail.com>
…com:lcapelluto/rfcs into terra-3749-relatively-timed-pulse-schedules
I realized we are using "relative time/timing" in the two meanings: "timing by channels (by-channels)" and "no start_time, no t=0", i.e. "absolute time/timing" means "timing across channels (across-channels)" and "having start_time from t=0".
is talking about "timing by channels", while
is talking about "no start_time". These two points may be considered independently. Regarding "by-/across-channels",
I guess we are heading to "by-channels" because real devices do not support communication among channels (right?). That makes "timing across channels" too much for real device. Regarding "start_time from t=0" considering control-flow, |
| `append(self, schedule)` | O(\|N<sub>new</sub>\|) | | | ||
|`insert(self, time, schedule)`| O(\|N<sub>new</sub>\| * \|N<sub>C</sub>\|) | | | ||
| `append(self, schedule)` | O(\|C\|) | Previously, `append` would add `schedule` to `self` with relative times preserved, at time set by `self.duration({schedule.channels}.intersection({self.channels}))`. The new method will simply extend the instructions in `self` with those in `schedule` on a per channel basis. | | ||
|`insert(self, time, schedule)`| O(N<sub>new</sub> * N<sub>C</sub>) | This will be slow generally, but it can be implemented with the same runtime as `append` when the `time` is greater than `self.duration(schedule.channels)`. | |
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.
Perhaps we should have both an insert_at_time
and an insert
(as the actual argument position in the schedule data structure) to properly differentiate these two operations?
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.
sounds good to me
@itoko I don't understand your comment; I don't understand what you mean by "cross channels" |
{ | ||
DriveChannel(0): | ||
('instructions'=[Delay(duration=10, ...), | ||
Play(duration=100, ...), | ||
Play(duration=20, ...)], | ||
'duration'=130), | ||
DriveChannel(1): | ||
('instructions'=[Delay(duration=110, ...), | ||
Play(duration=20, ...)], | ||
'duration'=130), | ||
... | ||
} |
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 seems to be the main takeaway of this RFC, so we should settle on it.
So the 130 number is here for performance right? Even though it could be computed by summing all durations on that channel. I'm good with that.
However, we should think about what a conditional will look like. If I don't know an instruction's delay, due to a branch or conditional, how does this datastructure work?
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 Schedule
is a "basic block", so conditionals should live on top of this. An alt approach (which I should list in this RFC) would be to make this explicit and allow absolute timing within a basic block even when we have control flow. I find that misleading (too "special case"-y), but, at the heart of it, they're equivalent.
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 Thomas' new RFC touches on this
I'm not totally clear on this justification. Can you clarify the complexity of
|
Can we list the types of operations that we do in schedules (append, insert, delete/replace, union, find channel idle times) and the complexity of those in a relative vs. absolute data structure? I think for the basic blocks we should choose what makes compiler manipulation faster. I agree they can be converted to each other, but their manipulation is not the same.
… On Apr 2, 2020, at 5:22 PM, Lauren Capelluto ***@***.***> wrote:
@lcapelluto commented on this pull request.
In 0000-qiskit-pulse-schedule-relative-timing.md:
> +{
+ DriveChannel(0):
+ ('instructions'=[Delay(duration=10, ...),
+ Play(duration=100, ...),
+ Play(duration=20, ...)],
+ 'duration'=130),
+ DriveChannel(1):
+ ('instructions'=[Delay(duration=110, ...),
+ Play(duration=20, ...)],
+ 'duration'=130),
+ ...
+}
I think Thomas' new RFC touches on this
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
@ajavadia I agree. I'll do that 👍 |
remove ref to removed section Co-Authored-By: Ali Javadi-Abhari <ajavadia@users.noreply.github.com>
Ok so it based on this, If I compare this with #18 it seems the findings are different in the case of In any case I just wanted to make sure we are basing this on some concrete runtime analysis, which will also help in the implementation. I think it is clear that relative wins in terms of the most common operation which is append. |
Add an RFC proposing an implementation for relatively-timed instructions in pulse Schedules within Qiskit Pulse