-
Notifications
You must be signed in to change notification settings - Fork 25.5k
[jit] Fix alias analysis for fork/wait #16671
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
// | ||
// In reality, any reads *inside* the live interval are undefined behavior, | ||
// since the writes may or may not have been executed yet. But we'll let | ||
// users do that and shoot themselves in the foot for now. |
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.
Do we want to print a warning in this situation?
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'm reluctant to incorporate alias analysis results in user-visible error reporting. We can't expect users to know about alias info/the IR/how we've mutated the graph up till now, so an error msg would be super confusing and probably not actionable.
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, just had one question inside
} | ||
|
||
void AliasDb::analyzeFork(Node* node) { | ||
// We treat forks as if their subgraph ran immediately. Since the alias |
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.
Maybe rephrase ? We're treating forks as potentially running any time being fork & wait
const auto subgraphWrites = getWrites(subgraph->block()); | ||
for (const auto& use : fut->uses()) { | ||
const auto wait = use.user; | ||
AT_ASSERT(wait->outputs().size() == subgraph->outputs().size()); |
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.
Will this fail is it's used as an output in an if 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.
Hmm…good point. I guess it's non-trivial to find all the matching "waits".
4efdc6d
to
ed64062
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.
ok google
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.
@suo has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
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.
@suo has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
847268c
to
847bcdb
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.
@suo has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
return shouldAnnotate(v->type()); | ||
} | ||
|
||
std::unordered_set<Node*> getMatchingWaits(Value* fut) { |
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.
haven't taken full look at new changes but It doesn't look like this is being called except recursively
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.
blah, this was left in, will remove!
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.
@suo has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
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.
@suo is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
This reverts commit 43f4c86.
(review top commit only).
As expected, fork/wait introduces some corner cases into the alias analysis. The comments inline should describe the changes.