-
Notifications
You must be signed in to change notification settings - Fork 250
Migrate extension-cpp to stable API/ABI #126
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,7 +19,7 @@ jobs: | |
| - python-version: 3.13 | ||
| runner: linux.g5.4xlarge.nvidia.gpu | ||
| gpu-arch-type: cuda | ||
| gpu-arch-version: "12.4" | ||
| gpu-arch-version: "12.9" | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we no longer have cu nightlies for 12.4
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. lol CI for this repo is so outdated |
||
| fail-fast: false | ||
| uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@main | ||
| permissions: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,16 @@ | ||
| # C++/CUDA Extensions in PyTorch | ||
| # C++/CUDA Extensions in PyTorch with LibTorch Stable ABI | ||
|
|
||
| An example of writing a C++/CUDA extension for PyTorch using the [LibTorch Stable ABI](https://pytorch.org/docs/main/notes/libtorch_stable_abi.html). | ||
| See [here](https://pytorch.org/tutorials/advanced/cpp_custom_ops.html) for the accompanying tutorial. | ||
|
Comment on lines
+1
to
+4
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. are we pushing for everyone to use libtorch stable abi? Or do we expect people will want to use the regular api? How do people select between the two? IMO if we're not ready for literally everyone to move to libtorch stable abi right now, we should provide multiple examples. One for libtorch stable, and one without. |
||
|
|
||
| An example of writing a C++/CUDA extension for PyTorch. See | ||
| [here](https://pytorch.org/tutorials/advanced/cpp_custom_ops.html) for the accompanying tutorial. | ||
| This repo demonstrates how to write an example `extension_cpp.ops.mymuladd` | ||
| custom op that has both custom CPU and CUDA kernels. | ||
| custom op that has both custom CPU and CUDA kernels, it leverages the LibTorch | ||
| Stable ABI to ensure that the extension built can be run with any version of | ||
| PyTorch >= 2.10.0. | ||
|
|
||
| The examples in this repo work with PyTorch 2.10+. For an example of how to use | ||
| the non-stable subset of LibTorch, see [this previous commit](https://github.com/pytorch/extension-cpp/tree/0ec4969c7bc8e15a8456e5eb9d9ca0a7ec15bc95). | ||
|
|
||
| The examples in this repo work with PyTorch 2.4+. | ||
|
|
||
| To build: | ||
| ``` | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| [build-system] | ||
| requires = [ | ||
| "setuptools", | ||
| "torch", | ||
| "torch>=2.10.0", | ||
| ] | ||
| build-backend = "setuptools.build_meta" |
Uh oh!
There was an error while loading. Please reload this page.
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.
This change was needed to get CI to run properly.
Otherwise, CI was installing the nightly but using torch 2.7 to build the extension