-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Update Custom C++ and CUDA Operators to use PyTorch stable API/ABI #3701
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: main
Are you sure you want to change the base?
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/tutorials/3701
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit a8c5294 with merge base 10eefc3 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
479f1c2 to
a8c5294
Compare
| Use ``torch.library.register_autograd`` to add training support for an operator. Prefer | ||
| this over directly using Python ``torch.autograd.Function`` or C++ ``torch::autograd::Function``; | ||
| you must use those in a very specific way to avoid silent incorrectness (see | ||
| this over directly using Python ``torch.autograd.Function`` (see |
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.
remove reference to torch::autograd::Function since we don't support that in stable API/ABI
| Defining the custom op and adding backend implementations | ||
| --------------------------------------------------------- | ||
| First, let's write a C++ function that computes ``mymuladd``: | ||
| First, let's write a C++ function that computes ``mymuladd`` using the LibTorch Stable ABI: |
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.
Hmm same question here as on the other PR. Do we have enough in 2.10 to always recommend the libtorch stable APIs? If not, then we're going to want a section with libtorch stable apis and a section with the regular libtorch APIs.
Description
Migrate
advanced_source/cpp_custom_ops.rstto libtorch stable ABI/API. Accompanying change toextension-cppChecklist