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

[Enhancement][Torch] Using torch cpp_extension for kernel integration instead of dl_pack #7

Open
LeiWang1999 opened this issue Jan 18, 2025 · 2 comments
Labels
enhancement New feature or request

Comments

@LeiWang1999
Copy link
Contributor

Our project currently uses dlpack to cast Torch tensors to/from TVM runtime arguments. However, this approach introduces noticeable runtime overhead, as discussed here: Strange Overhead of TVM Runtime NDArray from DLPack.

For reference, some projects like BitBLAS implement custom CUDA-based solutions with ctype wrappers to avoid such overhead. However, these approaches often lack comprehensive support for handling tensor attributes, such as shape, strides, and data type.

A more appropriate and efficient solution would be to leverage the Torch C++ extension to directly bridge Torch tensors and TVM NDArray objects without introducing the overhead of dlpack conversions. This approach would maintain tensor attributes while improving runtime efficiency.

We should explore the feasibility of implementing this integration with Torch’s C++ extensions to mitigate the current performance bottleneck.

@LeiWang1999
Copy link
Contributor Author

Pull Request #12 introduced a JIT (Just-In-Time) component for TileLang, streamlining its functionality. Cpp extension can be built on top of this component to further enhance its capabilities.

@LeiWang1999
Copy link
Contributor Author

cpp extension takes too much time for compilation, should checkout https://discuss.pytorch.org/t/speeding-up-c-cuda-extension-build-time/96151

@LeiWang1999 LeiWang1999 added the enhancement New feature or request label Jan 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant