KEMBAR78
[inductor] Add a C shim layer for libtorch by desertfire · Pull Request #109391 · pytorch/pytorch · GitHub
Skip to content

Conversation

@desertfire
Copy link
Contributor

@desertfire desertfire commented Sep 15, 2023

Summary:
This PR adds a limited C shim layer for libtorch. The ultimate goal is to ban any direct reference to aten/c10 data structures or functions, to avoid ABI breakage by providing stable C interfaces.

To make the review and landing easier, we broke the changes into several steps. In this PR (a combination of #109022 and #109351), we add C interfaces for certain libtorch functions and modify the wrapper codegen to generate calls to those interfaces. There are a few other items to be addressed in future PRs:

  • The AOTInductor runtime interface still takes lists of aten tensors as input and output
  • The interaction with ProxyExecutor (general fallback support) needs to move away from aten tensor
  • Remove all references to aten/c10 headers in the AOTInductor-generated code

Differential Revision: D49302669

cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @Xia-Weiwen @wenzhe-nrv @jiayisunx @peterbell10 @ipiszy @ngimel @yf225 @chenyang78 @kadeng @muchulee8 @aakhundov

@pytorch-bot
Copy link

pytorch-bot bot commented Sep 15, 2023

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/109391

Note: Links to docs will display an error until the docs builds have been completed.

❌ 1 New Failure, 7 Unrelated Failures

As of commit 25d5077 with merge base 55c19a3 (image):

NEW FAILURE - The following job has failed:

BROKEN TRUNK - The following jobs failed but were present on the merge base:

👉 Rebase onto the `viable/strict` branch to avoid these failures

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

@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D49302669

@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D49302669

@desertfire
Copy link
Contributor Author

A combination of #109022 and #109351. Both were approved. Need to land from fbcode, thus created this PR by exporting.

Copy link
Contributor

@chenyang78 chenyang78 left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks!

@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D49302669

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

This pull request was exported from Phabricator. Differential Revision: D49302669

@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D49302669

@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D49302669

@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D49302669

Summary:

This PR adds a limited C shim layer for libtorch. The ultimate goal is to ban any direct reference to aten/c10 data structures or functions, to avoid ABI breakage by providing stable C interfaces.

To make the review and landing easier, we broke the changes into several steps. In this PR (a combination of #109022 and #109351), we add C interfaces for certain libtorch functions and modify the wrapper codegen to generate calls to those interfaces. There are a few other items to be addressed in future PRs:

* The AOTInductor runtime interface still takes lists of aten tensors as input and output
* The interaction with ProxyExecutor (general fallback support) needs to move away from aten tensor
* Remove all references to aten/c10 headers in the AOTInductor-generated code

Reviewed By: chenyang78

Differential Revision: D49302669
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D49302669

1 similar comment
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D49302669

@facebook-github-bot
Copy link
Contributor

@pytorchbot merge

(Initiating merge automatically since Phabricator Diff has merged)

@pytorch-bot pytorch-bot bot added the ciflow/trunk Trigger trunk jobs on your pull request label Sep 16, 2023
@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

desertfire added a commit that referenced this pull request Sep 17, 2023
Summary: forward fix a windows test error from #109391

ghstack-source-id: c4d4378
Pull Request resolved: #109449
desertfire added a commit that referenced this pull request Sep 17, 2023
Summary: forward fix a windows test error from #109391

cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng Xia-Weiwen wenzhe-nrv jiayisunx peterbell10 ipiszy ngimel yf225 chenyang78 kadeng muchulee8 aakhundov

[ghstack-poisoned]
desertfire added a commit that referenced this pull request Sep 17, 2023
Summary: forward fix a windows test error from #109391

cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng Xia-Weiwen wenzhe-nrv jiayisunx peterbell10 ipiszy ngimel yf225 chenyang78 kadeng muchulee8 aakhundov

[ghstack-poisoned]
desertfire added a commit that referenced this pull request Sep 17, 2023
Summary: forward fix a windows test error from #109391

cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng Xia-Weiwen wenzhe-nrv jiayisunx peterbell10 ipiszy ngimel yf225 chenyang78 kadeng muchulee8 aakhundov

[ghstack-poisoned]
desertfire added a commit that referenced this pull request Sep 17, 2023
Summary: forward fix a windows test error from #109391

cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng Xia-Weiwen wenzhe-nrv jiayisunx peterbell10 ipiszy ngimel yf225 chenyang78 kadeng muchulee8 aakhundov

[ghstack-poisoned]
desertfire added a commit that referenced this pull request Sep 17, 2023
Summary: forward fix a windows test error from #109391

cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng Xia-Weiwen wenzhe-nrv jiayisunx peterbell10 ipiszy ngimel yf225 chenyang78 kadeng muchulee8 aakhundov

[ghstack-poisoned]
desertfire added a commit that referenced this pull request Sep 17, 2023
Summary: forward fix a windows test error from #109391

cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng Xia-Weiwen wenzhe-nrv jiayisunx peterbell10 ipiszy ngimel yf225 chenyang78 kadeng muchulee8 aakhundov

[ghstack-poisoned]
desertfire added a commit that referenced this pull request Sep 17, 2023
Summary: forward fix a windows test error from #109391

ghstack-source-id: 25d8143
Pull Request resolved: #109449
desertfire added a commit that referenced this pull request Sep 17, 2023
Summary: forward fix a windows test error from #109391

cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng Xia-Weiwen wenzhe-nrv jiayisunx peterbell10 ipiszy ngimel yf225 chenyang78 kadeng muchulee8 aakhundov

[ghstack-poisoned]
desertfire added a commit that referenced this pull request Sep 17, 2023
Summary: forward fix a windows test error from #109391

ghstack-source-id: cf31775
Pull Request resolved: #109449
pytorchmergebot pushed a commit that referenced this pull request Sep 17, 2023
Summary: forward fix a windows test error from #109391

Pull Request resolved: #109449
Approved by: https://github.com/mikekgfb
SherlockNoMad added a commit to SherlockNoMad/pytorch that referenced this pull request Sep 19, 2023
Summary: Fix aot_inductor/test:test_custom_ops, which was broken by pytorch#109391

Test Plan: buck2 run mode/dev-nosan //deeplearning/aot_inductor/test:test_custom_ops

Differential Revision: D49438928
pytorchmergebot pushed a commit that referenced this pull request Sep 20, 2023
Summary: Fix aot_inductor/test:test_custom_ops, which was broken by #109391

Test Plan: buck2 run mode/dev-nosan //deeplearning/aot_inductor/test:test_custom_ops

Differential Revision: D49438928

Pull Request resolved: #109660
Approved by: https://github.com/desertfire, https://github.com/chenyang78
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.

4 participants