Skip to content
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

[UPDATED PROTOTYPE] Use dynamo fake tensor mode in aot_autograd, move aot_autograd compilation to lowering time #89672

Closed
wants to merge 8 commits into from

Conversation

ezyang
Copy link
Contributor

@ezyang ezyang commented Nov 25, 2022

… aot_autograd compilation to lowering time

After all of the preparatory commits, this is a subset of the
changes in #89392 that actually
change us to propagating fake tensors to backends.

Signed-off-by: Edward Z. Yang <ezyang@fb.com>

[ghstack-poisoned]
@voznesenskym voznesenskym mentioned this pull request Nov 26, 2022
…ograd, move aot_autograd compilation to lowering time"

After all of the preparatory commits, this is a subset of the
changes in #89392 that actually
change us to propagating fake tensors to backends.

Signed-off-by: Edward Z. Yang <ezyangfb.com>

cc mlazos soumith voznesenskym yanboliang penguinwu anijain2305 EikanWang jgong5 Guobing-Chen chunyuan-w XiaobingSuper zhuhaozhe blzheng Xia-Weiwen wenzhe-nrv jiayisunx peterbell10 desertfire

[ghstack-poisoned]
…ograd, move aot_autograd compilation to lowering time"

After all of the preparatory commits, this is a subset of the
changes in #89392 that actually
change us to propagating fake tensors to backends.

Signed-off-by: Edward Z. Yang <ezyangfb.com>

cc mlazos soumith voznesenskym yanboliang penguinwu anijain2305 EikanWang jgong5 Guobing-Chen chunyuan-w XiaobingSuper zhuhaozhe blzheng Xia-Weiwen wenzhe-nrv jiayisunx peterbell10 desertfire

[ghstack-poisoned]
ezyang added a commit that referenced this pull request Nov 28, 2022
… aot_autograd compilation to lowering time

After all of the preparatory commits, this is a subset of the
changes in #89392 that actually
change us to propagating fake tensors to backends.

Signed-off-by: Edward Z. Yang <ezyangfb.com>

ghstack-source-id: c93717bc2abfa2cd44979cd54aafe020bea53d76
Pull Request resolved: #89672
…ograd, move aot_autograd compilation to lowering time"

After all of the preparatory commits, this is a subset of the
changes in #89392 that actually
change us to propagating fake tensors to backends.

Signed-off-by: Edward Z. Yang <ezyangfb.com>

cc mlazos soumith voznesenskym yanboliang penguinwu anijain2305 EikanWang jgong5 Guobing-Chen chunyuan-w XiaobingSuper zhuhaozhe blzheng Xia-Weiwen wenzhe-nrv jiayisunx peterbell10 desertfire

[ghstack-poisoned]
ezyang added a commit that referenced this pull request Nov 28, 2022
… aot_autograd compilation to lowering time

After all of the preparatory commits, this is a subset of the
changes in #89392 that actually
change us to propagating fake tensors to backends.

Signed-off-by: Edward Z. Yang <ezyangfb.com>

ghstack-source-id: 40f41ce475d49ffd607398b1af9f6602b952f860
Pull Request resolved: #89672
Copy link
Contributor

@Chillee Chillee left a comment

Choose a reason for hiding this comment

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

Tentatively LGTM, might need to read more closely.

@voznesenskym
Copy link
Contributor

Gonna look at tests on this one.

@voznesenskym
Copy link
Contributor

Oh this is missing the C++ fix @ezyang

@voznesenskym voznesenskym mentioned this pull request Nov 28, 2022
fake_submod = deepcopy_to_fake_tensor(real_mod, fake_mode)
else:
fake_submod = real_mod
pass
Copy link
Contributor

Choose a reason for hiding this comment

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

when is not fake_mode? and why this pass?

else:
# Fallback, in case fake_tensor was not set
# Particularly for graph args that are not tensors
result.extend(arg.get_examples())
Copy link
Contributor

Choose a reason for hiding this comment

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

Two questions about this comment:

(1) The return type of this func is List[torch.Tensor], is that wrong? (comment implies we have to worry about non-tensor graph args)

(2) Should this function maintain the invariant that it never returns real tensors, and assert here that get_examples() in the fallback only returns non-tensors?

@albanD albanD removed their request for review November 29, 2022 21:16
…ograd, move aot_autograd compilation to lowering time"

After all of the preparatory commits, this is a subset of the
changes in #89392 that actually
change us to propagating fake tensors to backends.

Signed-off-by: Edward Z. Yang <ezyangfb.com>

cc mlazos soumith voznesenskym yanboliang penguinwu anijain2305 EikanWang jgong5 Guobing-Chen chunyuan-w XiaobingSuper zhuhaozhe blzheng Xia-Weiwen wenzhe-nrv jiayisunx peterbell10 desertfire

[ghstack-poisoned]
self.tx.output.graphargs.append(
GraphArg(self.get_source(), value, False)
)
graph_arg = None
Copy link
Contributor Author

Choose a reason for hiding this comment

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

There's no need to define graph_arg here

voznesenskym added a commit that referenced this pull request Dec 2, 2022
…grad compilation to lowering time [Merger of 89672 and 89773]"


After all of the preparatory commits, this is a subset of the
changes in #89392 that actually
change us to propagating fake tensors to backends.

Signed-off-by: Edward Z. Yang <ezyangfb.com>

This is the merger of Ed's PR #89672, which is a rewrite of an older PR of mine (#89392), with CI Fixes on top of it (#89773)

cc mlazos soumith yanboliang penguinwu anijain2305 EikanWang jgong5 Guobing-Chen chunyuan-w XiaobingSuper zhuhaozhe blzheng Xia-Weiwen wenzhe-nrv jiayisunx peterbell10 desertfire

[ghstack-poisoned]
voznesenskym added a commit that referenced this pull request Dec 2, 2022
…grad compilation to lowering time [Merger of 89672 and 89773]"


After all of the preparatory commits, this is a subset of the
changes in #89392 that actually
change us to propagating fake tensors to backends.

Signed-off-by: Edward Z. Yang <ezyangfb.com>

This is the merger of Ed's PR #89672, which is a rewrite of an older PR of mine (#89392), with CI Fixes on top of it (#89773)

cc mlazos soumith yanboliang penguinwu anijain2305 EikanWang jgong5 Guobing-Chen chunyuan-w XiaobingSuper zhuhaozhe blzheng Xia-Weiwen wenzhe-nrv jiayisunx peterbell10 desertfire

[ghstack-poisoned]
voznesenskym added a commit that referenced this pull request Dec 2, 2022
…grad compilation to lowering time [Merger of 89672 and 89773]"


After all of the preparatory commits, this is a subset of the
changes in #89392 that actually
change us to propagating fake tensors to backends.

Signed-off-by: Edward Z. Yang <ezyangfb.com>

This is the merger of Ed's PR #89672, which is a rewrite of an older PR of mine (#89392), with CI Fixes on top of it (#89773)

cc mlazos soumith yanboliang penguinwu anijain2305 EikanWang jgong5 Guobing-Chen chunyuan-w XiaobingSuper zhuhaozhe blzheng Xia-Weiwen wenzhe-nrv jiayisunx peterbell10 desertfire

[ghstack-poisoned]
pytorchmergebot pushed a commit that referenced this pull request Dec 3, 2022
…ation to lowering time [Merger of 89672 and 89773] (#90039)

After all of the preparatory commits, this is a subset of the
changes in #89392 that actually
change us to propagating fake tensors to backends.

Signed-off-by: Edward Z. Yang <ezyangfb.com>

This is the merger of Ed's PR #89672, which is a rewrite of an older PR of mine (#89392), with CI Fixes on top of it (#89773)

Pull Request resolved: #90039
Approved by: https://github.com/ezyang
pytorchmergebot pushed a commit that referenced this pull request Dec 5, 2022
…ation to lowering time [Merger of 89672 and 89773] (#90039)

After all of the preparatory commits, this is a subset of the
changes in #89392 that actually
change us to propagating fake tensors to backends.

Signed-off-by: Edward Z. Yang <ezyangfb.com>

This is the merger of Ed's PR #89672, which is a rewrite of an older PR of mine (#89392), with CI Fixes on top of it (#89773)

Pull Request resolved: #90039
Approved by: https://github.com/ezyang
voznesenskym added a commit that referenced this pull request Dec 5, 2022
…ation to lowering time [Merger of 89672 and 89773] (#90039)

After all of the preparatory commits, this is a subset of the
changes in #89392 that actually
change us to propagating fake tensors to backends.

Signed-off-by: Edward Z. Yang <ezyangfb.com>

This is the merger of Ed's PR #89672, which is a rewrite of an older PR of mine (#89392), with CI Fixes on top of it (#89773)

Pull Request resolved: #90039
Approved by: https://github.com/ezyang

fix
voznesenskym added a commit that referenced this pull request Dec 6, 2022
…ation to lowering time [Merger of 89672 and 89773] (#90039)

After all of the preparatory commits, this is a subset of the
changes in #89392 that actually
change us to propagating fake tensors to backends.

Signed-off-by: Edward Z. Yang <ezyangfb.com>

This is the merger of Ed's PR #89672, which is a rewrite of an older PR of mine (#89392), with CI Fixes on top of it (#89773)

Pull Request resolved: #90039
Approved by: https://github.com/ezyang

fix
kulinseth pushed a commit to kulinseth/pytorch that referenced this pull request Dec 10, 2022
…ation to lowering time [Merger of 89672 and 89773] (pytorch#90039)

After all of the preparatory commits, this is a subset of the
changes in pytorch#89392 that actually
change us to propagating fake tensors to backends.

Signed-off-by: Edward Z. Yang <ezyangfb.com>

This is the merger of Ed's PR pytorch#89672, which is a rewrite of an older PR of mine (pytorch#89392), with CI Fixes on top of it (pytorch#89773)

Pull Request resolved: pytorch#90039
Approved by: https://github.com/ezyang
kulinseth pushed a commit to kulinseth/pytorch that referenced this pull request Dec 10, 2022
…ation to lowering time [Merger of 89672 and 89773] (pytorch#90039)

After all of the preparatory commits, this is a subset of the
changes in pytorch#89392 that actually
change us to propagating fake tensors to backends.

Signed-off-by: Edward Z. Yang <ezyangfb.com>

This is the merger of Ed's PR pytorch#89672, which is a rewrite of an older PR of mine (pytorch#89392), with CI Fixes on top of it (pytorch#89773)

Pull Request resolved: pytorch#90039
Approved by: https://github.com/ezyang
@ezyang
Copy link
Contributor Author

ezyang commented Dec 11, 2022

obsolete

@ezyang ezyang closed this Dec 11, 2022
@facebook-github-bot facebook-github-bot deleted the gh/ezyang/1591/head branch June 8, 2023 16:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants