feat!: make InstructionHandler trait generic#501
Open
mingyoungjeng wants to merge 3 commits intomainfrom
Open
Conversation
InstructionHandler trait generic
|
| .ok() | ||
| }); | ||
| let common_sample_rate = handler | ||
| .matching_frames(&program.frames, program.get_used_qubits(), instruction) |
There was a problem hiding this comment.
The change to pass more specific parameters to matching_frames is good, but calling program.get_used_qubits() on each invocation might be inefficient if this function is called frequently. Consider caching the result of get_used_qubits() if this is in a performance-critical path.
mingyoungjeng
commented
Mar 20, 2026
| /// [Quil-T]: https://quil-lang.github.io/#12Annex-T--Pulse-Level-Control | ||
| fn matching_frames<'f>( | ||
| &self, | ||
| frames: &'f FrameSet, |
Collaborator
Author
There was a problem hiding this comment.
It makes more sense to pass a FrameSet here, and also means an entire Program isn't needed to use this functionality.
In an ideal world, it would be possible to eliminate qubits_available, which only applies to Resets in the default handler.
Perhaps a better design would be to make DefaultHandler include qubits_available as a field, but that propagated a bit too much for my taste.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #500