-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Pulse Compiler SetSequence
pass
#11980
Pulse Compiler SetSequence
pass
#11980
Conversation
Co-authored-by: Naoki Kanazawa <nkanazawa1989@gmail.com>
One or more of the the following people are requested to review this:
|
pm.append(SetSequence()) | ||
return pm | ||
|
||
@named_data(*ddt_named_data) |
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 tested everything against all relevant alignment types. It's kind of an overkill, with the logic located at a parent abstract class.
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 @TsafrirA . The sequence logic looks good to me. My main concern is about implementation of sequence pass, and I think the sequence logic must be implemented inside the pass, rather than delegating it to the alignment object.
Here is another question. When we talk to a hardware, I think they request mixed frames. However, in the current implementation, broadcast is not really implemented. Instead, the sequence pass just create edges to a common node to broadcast. Do you want to write a separate pass for broadcast? We can also do this broadcast inside the sequencing pass with slight modification.
self._analyze_mixed_frames_in_sequence(passmanager_ir) | ||
self.property_set["mixed_frames_mapping"] = self.mixed_frames_mapping |
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.
self._analyze_mixed_frames_in_sequence(passmanager_ir) | |
self.property_set["mixed_frames_mapping"] = self.mixed_frames_mapping | |
mixed_frames_mapping = defaultdict(set) | |
self._analyze_mixed_frames_in_sequence(passmanager_ir, mixed_frames_mapping) | |
self.property_set["mixed_frames_mapping"] = mixed_frames_mapping |
Can we implement the logic like this? Statefull pass sometimes causes edge cases. For example, in the current implementation some unexpected things could happen if you run the same pass manager instance twice for different inputs.
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 issue of re-running a pass is something that bothered me too. Do we override existing data? Raise an error? There's a "global" decision to be made here, because it's applicable to all passes.
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.
For the current pass, I modified it per your suggestion.
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.
There is definitely a demand for rerunning the pass manager, for example #11784. I prefer pass that doesn't have state, except for the user provided arguments.
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.
In that case, should we remove all edges from the sequence before sequencing?
|
||
def __init__(self): | ||
"""Create new MapMixedFrames pass""" | ||
super().__init__(target=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.
This violates typehint (though type is not important in Python). Do you want to remove Target from the base passes?
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.
As I commented on the original compiler PR, we don't always need Target. I think we can make it optional.
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, it looks almost good to go. Just a few minor comments before approval.
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 thanks @TsafrirA
Summary
A
SetSequence
pass is introduced. The pass transforms Pulse'sSequenceIR
by setting the sequence of elements (adding edges to the graph). A second analysis pass is introduced -MapMixedFrame
- which is needed for sequencing of parallel alignments.Details and comments
When
SequenceIR
object is populated, itssequence
property includes only nodes and no edges. Setting the sequence (adding the edges to the graph) depends on the alignment type of the object. The passSetSequence
adds the edges to the graph according to the alignment type.For parallel alignment, a mapping of
PulseTarget
andFrame
toMixedFrame
s is needed. For this purpose, an analysis passMapMixedFrame
is also added. The pass recurses through the IR, and identifies creates the mapping.