-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Port ASAPScheduleAnalysis
to Rust
#14833
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
Conversation
Thank you for opening a new pull request. Before your PR can be merged it will first need to pass continuous integration tests and be reviewed. Sometimes the review process can be slow, so please be patient. While you're waiting, please feel free to review other open PRs. While only a subset of people are authorized to approve pull requests for merging, everyone is encouraged to review open pull requests. Doing reviews helps reduce the burden on the core team and helps make the project's code better for everyone. One or more of the following people are relevant to this code:
|
Pull Request Test Coverage Report for Build 17270793764Details
💛 - 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.
I just took a quick glance through the code, there is just one thought about TimeOps
here.
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 looks good, I have some questions and comments.
|
||
let &op_duration = node_durations | ||
.get(&node_index) | ||
.ok_or_else(|| TranspilerError::new_err("No duration for node"))?; |
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 suggestion might have the wrong syntax but make the message more specific by doing something like this:
.ok_or_else(|| TranspilerError::new_err("No duration for node"))?; | |
.ok_or_else(|| TranspilerError::new_err(format!("No duration found for node at index {}", node_index.index())))?; |
// Measure instruction handling is bit tricky due to clbit_write_latency | ||
let t0q = qargs | ||
.iter() | ||
.map(|q| *idle_after.get(q).unwrap_or(&zero)) |
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.
Since these are guaranteed to exist, try using indexing instead of defaulting to zero. If something outside of there ever pops up we'd know that there is something wrong with the pass.
.map(|q| *idle_after.get(q).unwrap_or(&zero)) | |
.map(|q| *idle_after[q]) |
// t1: end time of instruction | ||
|
||
let (t0, t1) = if is_gate_or_delay { | ||
let &t0 = qargs |
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.
Is there a reason why this declares a reference?. Couldn't it be more like:
let t0 = qargs
Since you're dealing with numbers, they should implement the Copy
trait.
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 this is good to merge. Thank you for your work.
Summary
This PR migrates the implementation of the
ASAPScheduleAnalysis
pass from Python to Rust, maintaining identical scheduling logic and user-facing behavior.Details and comments
Fixes #12259
No changes have been made to the scheduling algorithm or its logic.