-
Notifications
You must be signed in to change notification settings - Fork 298
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
[DC] Add fork/sink materialization passes #5159
Conversation
a581f01
to
5fe81bf
Compare
fba221b
to
a04f644
Compare
6c5f33b
to
a81d295
Compare
a81d295
to
6404ef2
Compare
1435b75
to
42b2ae7
Compare
42b2ae7
to
dbc7520
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.
LGTM (once build/tests are passing)! Just left two questions but I'm most likely missing something
static LogicalResult addForkOps(Region &r, OpBuilder &rewriter) { | ||
for (Operation &op : r.getOps()) { | ||
// Ignore terminators, and don't add Forks to Forks. | ||
if (op.getNumSuccessors() == 0 && !isa<ForkOp>(op)) { |
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 it possible that a ForkOp
instance that was present in the input IR before the fork/sink materialization pass runs has one of its results used multiple times? In that case, it seems we could end up with a value used more than once after the pass is finished. Does the pass assume that no forks/sinks are present in the input IR?
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 shouldn't assume that IMO.
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.
Most definitely - to create a vague excuse for myself, this code is just duplicated from the Handshake stuff. I'll fix it and add a test for it, good catch 👍
static LogicalResult addForkOps(Region &r, OpBuilder &rewriter) { | ||
for (Operation &op : r.getOps()) { | ||
// Ignore terminators, and don't add Forks to Forks. | ||
if (op.getNumSuccessors() == 0 && !isa<ForkOp>(op)) { |
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 shouldn't assume that IMO.
6a34dca
to
63e7bb0
Compare
No description provided.