-
Notifications
You must be signed in to change notification settings - Fork 694
[RFC] PyTorch Custom Operators & Multi-Backend Support #1545
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
Comments
Hi @matthewdouglas . That sounds pretty cool. One thing I want to make sure that we don't need to build any C++ codes in CPU/XPU, so we do not need cmake in the CPU/XPU backend. I assume it won't break your design right? |
@jiqing-feng That's perfectly fine. We won't expect that every backend would need to build a library, or that any library it builds would necessarily need to expose the same API. For the CPU/XPU case we'll guard around what the
I have not benchmarked it, but I expect that we'll be able to implement it with torch, like what was already done here: bitsandbytes/bitsandbytes/backends/cpu_xpu_common.py Lines 407 to 418 in 2640753
|
I'm going to close this out as this is implemented and merged with #1544. General note: the custom operators in bitsandbytes are still subject to revision, and optimizers have not been implemented yet, but it is stable for internal use and initial backend integrations. |
Purpose
We intend to integrate PyTorch Custom Operators as the primary mechanism for dispatching to device-specific operator implementations. An initial scaffolding of this is presented in PR #1544. This RFC will serve as a guideline to collect community feedback and refine our development plans moving forward.
Why?
torch.library
allows us to take advantage of the existing device dispatch mechanisms in PyTorch.torch.compile
support.What about the
multi-backend-refactor
branch?We are planning to deprecate further development on that branch upon the merging of #1544. After that point, the expectation is that we will implement backends using the new custom operator registration mechanisms. We expect to be able to reuse much of the existing implementations in the refactoring process.
Our goal is to aggressively mainline our in-tree backends, while additionally enabling out-of-tree backends. We will expand on this topic in the near future.
Supersedure
This RFC is intended to supersede topics which were covered in previously related RFCs which remained open as of this writing:
Related Issues
Related issues and discussions include:
Additionally, this relates to the following issues and discussions which have been closed:
Relevant contributors
The following contributors may have particular interest and feedback on this topic:
@Titus-von-Koeller
@christoph-koehncke
@jiqing-feng
@pnunna93
@akx
@rickardp
@ji-huazhong
@SlightwindSec
The text was updated successfully, but these errors were encountered: