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

Python version agnostic C++ extensions #126683

Open
zou3519 opened this issue May 20, 2024 · 1 comment
Open

Python version agnostic C++ extensions #126683

zou3519 opened this issue May 20, 2024 · 1 comment
Labels
module: cpp-extensions Related to torch.utils.cpp_extension module: custom-operators custom operators, custom ops, custom-operators, custom-ops module: pt2-dispatcher PT2 dispatcher-related issues (e.g., aotdispatch, functionalization, faketensor, custom-op, oncall: pt2 triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module

Comments

@zou3519
Copy link
Contributor

zou3519 commented May 20, 2024

Recording some offline discussions with @drisspg and @malfet and also because this came up again in a thread on Slack

Today, C++ extensions in PyTorch need a separate build per python version. This is for two main reasons:

  1. they link against libtorch-python, which has a separate build per python version
  2. Python C extensions assume that you need to link against cpython, which invoves a separate build per python version.

Pitch: for C++/CUDA custom-operator only C++ extensions (which is the vast majority of them), if we can excise all the python dependencies, then one should be able to have a single build that works for all Python versions.

cc @malfet @ezyang @msaroufim @bdhirsh @anijain2305 @chauhang

@zou3519 zou3519 added module: cpp-extensions Related to torch.utils.cpp_extension module: custom-operators custom operators, custom ops, custom-operators, custom-ops module: pt2-dispatcher PT2 dispatcher-related issues (e.g., aotdispatch, functionalization, faketensor, custom-op, labels May 20, 2024
@malfet
Copy link
Contributor

malfet commented May 20, 2024

This is already a default behavior, isn't it?

@xmfan xmfan added the triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module label May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module: cpp-extensions Related to torch.utils.cpp_extension module: custom-operators custom operators, custom ops, custom-operators, custom-ops module: pt2-dispatcher PT2 dispatcher-related issues (e.g., aotdispatch, functionalization, faketensor, custom-op, oncall: pt2 triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module
Projects
None yet
Development

No branches or pull requests

3 participants