Skip to content

Conversation

muchulee8
Copy link
Contributor

@muchulee8 muchulee8 commented Aug 22, 2023

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

@pytorch-bot
Copy link

pytorch-bot bot commented Aug 22, 2023

🔗 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 Pending

As of commit b6e8801 with merge base c85c595 (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Aug 22, 2023

CLA Signed

The committers listed above are authorized under a signed CLA.

@facebook-github-bot
Copy link
Contributor

@muchulee8 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@muchulee8 muchulee8 force-pushed the mlee8/aot_weights_bc branch from b25625a to e75aa79 Compare August 22, 2023 19:11
@facebook-github-bot
Copy link
Contributor

@muchulee8 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

2 similar comments
@facebook-github-bot
Copy link
Contributor

@muchulee8 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@muchulee8 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@muchulee8 muchulee8 requested a review from chenyang78 August 23, 2023 16:57
@muchulee8 muchulee8 changed the title [WIP] [AOTInductor] Include constants in AOTInductor .so file. [AOTInductor] Include constants in AOTInductor .so file. Aug 23, 2023
Copy link
Contributor

@angelayi angelayi left a 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?

Copy link
Contributor

@eellison eellison left a 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)

@muchulee8 muchulee8 force-pushed the mlee8/aot_weights_bc branch 2 times, most recently from bf547db to 04e2435 Compare August 23, 2023 23:05
@facebook-github-bot
Copy link
Contributor

@muchulee8 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@muchulee8 muchulee8 requested review from angelayi and eellison August 23, 2023 23:50
@muchulee8 muchulee8 force-pushed the mlee8/aot_weights_bc branch from 9479ecb to 3476544 Compare August 24, 2023 07:01
Copy link
Contributor

@eellison eellison left a 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.

aot_inductor_output_path = ""

# TODO: Temporary flag: If we are passing from export, ignore aot autograd for now
ignore_aot_autograd = False
Copy link
Contributor

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

Copy link
Contributor

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?

@muchulee8 muchulee8 force-pushed the mlee8/aot_weights_bc branch 2 times, most recently from 1bb9519 to e0badcf Compare August 27, 2023 03:48
@facebook-github-bot
Copy link
Contributor

@muchulee8 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@muchulee8 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@muchulee8 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@muchulee8 muchulee8 requested a review from eellison August 28, 2023 20:28
Copy link
Contributor

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

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?

Copy link
Contributor

@angelayi angelayi Aug 28, 2023

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.

@muchulee8
Copy link
Contributor Author

@pytorchbot merge

@pytorch-bot pytorch-bot bot added the ciflow/trunk Trigger trunk jobs on your pull request label Aug 29, 2023
@pytorchmergebot
Copy link
Collaborator

Merge failed

Reason: This PR needs a release notes: label
If your changes are user facing and intended to be a part of release notes, please use a label starting with release notes:.

If not, please add the topic: not user facing label.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "topic: not user facing"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

Details for Dev Infra team Raised by workflow job

@facebook-github-bot
Copy link
Contributor

@muchulee8 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@muchulee8 muchulee8 requested a review from eellison August 29, 2023 19:31
@muchulee8
Copy link
Contributor Author

@pytorchbot merge

@pytorchmergebot
Copy link
Collaborator

Merge started

Your 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

Advanced Debugging
Check the merge workflow status
here

pytorchmergebot referenced this pull request Aug 31, 2023
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
pytorchmergebot added a commit that referenced this pull request Aug 31, 2023
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)))
@facebook-github-bot
Copy link
Contributor

@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).)

@pytorchmergebot
Copy link
Collaborator

@pytorchbot successfully started a revert job. Check the current status here.
Questions? Feedback? Please reach out to the PyTorch DevX Team

@pytorchmergebot
Copy link
Collaborator

Reverting PR 107718 failed

Reason: Command git -C /home/runner/work/pytorch/pytorch revert --no-edit c3239442a3dd1040b251ff33bef40589cba40e1c returned non-zero exit code 1

Auto-merging test/inductor/test_aot_inductor.py
CONFLICT (content): Merge conflict in test/inductor/test_aot_inductor.py
Auto-merging torch/_export/__init__.py
Auto-merging torch/_inductor/codegen/wrapper.py
Auto-merging torch/_inductor/compile_fx.py
Auto-merging torch/_inductor/config.py
Auto-merging torch/_inductor/graph.py
error: could not revert c3239442a3d... [AOTInductor] Include constants in AOTInductor .so file. (#107718)
hint: After resolving the conflicts, mark them with
hint: "git add/rm <pathspec>", then run
hint: "git revert --continue".
hint: You can instead skip this commit with "git revert --skip".
hint: To abort and get back to the state before "git revert",
hint: run "git revert --abort".
Details for Dev Infra team Raised by workflow job

desertfire added a commit that referenced this pull request Aug 31, 2023
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.

8 participants