-
Notifications
You must be signed in to change notification settings - Fork 25.6k
[AOTInductor] Include constants in AOTInductor .so file. #107718
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
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/107718
Note: Links to docs will display an error until the docs builds have been completed. ⏳ No Failures, 2 PendingAs of commit b6e8801 with merge base c85c595 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
@muchulee8 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
b25625a
to
e75aa79
Compare
@muchulee8 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
2 similar comments
@muchulee8 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
@muchulee8 has imported this pull request. If you are a Meta 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.
AOT side generally looks fine to me! Do you mind including a paste of what the generated file looks like?
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.
Would you mind separating out the formatting changes or removing them ? (ghstack is nice for this)
bf547db
to
04e2435
Compare
@muchulee8 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
9479ecb
to
3476544
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.
Cool ! did not review codecache. will defer to @desertfire on some of the code organization.
It might be easier and more general to write the entire untyped_storage()
of tensor constant, that would both handle striding and offsets, and allow you to dedup tensors with shared storages.
torch/_inductor/config.py
Outdated
aot_inductor_output_path = "" | ||
|
||
# TODO: Temporary flag: If we are passing from export, ignore aot autograd for now | ||
ignore_aot_autograd = False |
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.
Let's move this and maybe _in_aot_compilation
(my bad on that one) to virtualized.py
, see: this pr
adding get_real_inputs
to Virtualized.py
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.
We replaced this with a from_export
config, which is just used to tell us that this is from export and to skip over AOTAutograd. I plan to remove this flag within the next 2 weeks after fixing some other stuff on the export side. So is it ok to add it here for now?
1bb9519
to
e0badcf
Compare
@muchulee8 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
@muchulee8 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
@muchulee8 has imported this pull request. If you are a Meta 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.
Thanks @muchulee8 !
so_path = torch._inductor.aot_compile(ep.graph_module, list(all_args), options) | ||
return so_path, ep | ||
unlifted_module = ep.module() | ||
unlifted_module.graph.set_codegen(torch.fx.CodeGen()) # type: ignore[attr-defined] |
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.
Wonder why is it necessary to do this? What's the CodeGen before this function call?
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 CodeGen before this function call is a PytreeCodeGen, which I felt inductor didn't need to deal with at this time. It's in charge of making the input/output signature match the eager module, but I think with AOTInductor we just expect flat input/output so this is not really needed.
@pytorchbot merge |
Merge failedReason: This PR needs a If not, please add the To add a label, you can comment to pytorchbot, for example For more information, see Details for Dev Infra teamRaised by workflow job |
@muchulee8 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
@pytorchbot merge |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
Summary: There's a deadlock in current storage's implementation if the size of tensor is too large. Use ctypes to do serialization. Test Plan: python benchmarks/dynamo/huggingface.py --bfloat16 --accuracy --inference --device cuda --export-aot-inductor --only MT5ForConditionalGeneration Reviewers: Subscribers: Tasks: Tags: Fixes #ISSUE_NUMBER Pull Request resolved: #108287 Approved by: https://github.com/desertfire, https://github.com/malfet
This reverts commit 43f28be. Reverted #108287 on behalf of https://github.com/desertfire due to Internal test failure from #107718. Revert this one first and then revert 107718. ([comment](#108287 (comment)))
@pytorchbot revert -m="Diff reverted internally" -c="ghfirst" This Pull Request has been reverted by a revert inside Meta. To re-land this change, please open another pull request, assign the same reviewers, fix the CI failures that caused the revert and make sure that the failing CI runs on the PR by applying the proper ciflow label (e.g., ciflow/trunk).) |
@pytorchbot successfully started a revert job. Check the current status here. |
Reverting PR 107718 failedReason: Command
Details for Dev Infra teamRaised by workflow job |
Summary:
Include the constants into AOTInductor .so file.
We do not modify existing API signatures but create necessary format with weight lifted out instead.
Test Plan:
test/inductor/test_aot_inductor.py
Reviewers:
Subscribers:
Tasks:
Tags:
Fixes #ISSUE_NUMBER
cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @Xia-Weiwen @wenzhe-nrv @jiayisunx @peterbell10 @ipiszy @ngimel @yf225 @chenyang78 @kadeng @aakhundov @anijain2305
Marking as already reverted:
@diff-train-skip-merge
see cf64a9e