Skip to content

Conversation

suo
Copy link
Member

@suo suo commented Feb 1, 2019

(review top commit only).

As expected, fork/wait introduces some corner cases into the alias analysis. The comments inline should describe the changes.

@suo suo requested a review from zdevito February 1, 2019 21:28
@facebook-github-bot facebook-github-bot added the oncall: jit Add this issue/PR to JIT oncall triage queue label Feb 1, 2019
@suo suo requested review from jamesr66a and eellison February 1, 2019 21:28
//
// 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.
Copy link
Collaborator

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?

Copy link
Member Author

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.

Copy link
Collaborator

@jamesr66a jamesr66a left a 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
Copy link
Contributor

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());
Copy link
Contributor

@eellison eellison Feb 2, 2019

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 ?

Copy link
Member Author

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".

@suo suo force-pushed the suo/fix-fork branch 2 times, most recently from 4efdc6d to ed64062 Compare February 5, 2019 19:30
Copy link
Collaborator

@jamesr66a jamesr66a left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok google

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a 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.

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a 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.

@suo suo force-pushed the suo/fix-fork branch 2 times, most recently from 847268c to 847bcdb Compare February 6, 2019 00:02
Copy link
Contributor

@facebook-github-bot facebook-github-bot left a 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) {
Copy link
Contributor

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

Copy link
Member Author

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!

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a 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.

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a 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.

@suo suo deleted the suo/fix-fork branch February 6, 2019 05:53
ezyang added a commit to ezyang/pytorch that referenced this pull request Feb 6, 2019
@ezyang ezyang added the merged label Jun 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
oncall: jit Add this issue/PR to JIT oncall triage queue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants