-
-
Notifications
You must be signed in to change notification settings - Fork 776
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
Can I launch cupy kernels in C++? #8232
Comments
You cannot launch a kernel defined by |
So a great answer! Therefore, the key is to use |
Moreover, can |
What I meant was the opposite. You write in C++ (.cu file) and compile it into .cubin or .ptx files, then you can use them from the RawModule. |
Thanks for the explanation. I am wondering how to get the compiled binary when using cupy.RawKernel? |
Please supply a path to the compiled binary to |
I try to use |
Or, how can I get the kernel under |
Are there any specific reasons to use CuPy for that purpose? If your C++ application needs to compile CUDA code on the fly, you can just call NVRTC to get cubin/ptx. |
In theory, for a given
It's unclear to me either why you'd need this, @chaoming0625 could you elaborate? |
Thank you @kmaehashi @leofang . Currently, I am using the pointer in The motivation for my question is to use Currently, we are working on this functionality. |
Moreover, can I get the |
Thanks for sharing your use case @chaoming0625, this is very interesting! Would you be able to point us how you use this capability to make CuPy and Jax interoperable at the kernel level? I would love to see how it allows you to avoid writing complex boilerplate code. Eventually, I would like to learn how to craft a small interop demo like the one we showed for PyTorch-CuPy:
Right now it's not public API either, but according to the internal implementation (subject to change) Line 91 in 4179286
it is possible to get the Function object from jit.rawkernel._cache once instantiated (it's the CUFunction pointer via Function.ptr as before.
If you show us your workflow as I ask above, it'll help us stabilize the interface and expose these features properly. Thanks! |
Friendly nudge @chaoming0625 :) |
@leofang So many thanks for the reminder. Currently, we provide an interface for wrapping a cupy's The key for such integration is getting the pointer of cupy compiled kernels. For However, for In the future, we are expecting a publicly available interface to get the compiled kernel of a |
Description
I try to define a kernel by using cupy's
cupy.RawKernel
(https://docs.cupy.dev/en/stable/reference/generated/cupy.RawKernel.html). And then, can I launch the kernel from my customized C++ code? and passing a cudastream
into the kernel to launch? Thanks!Additional Information
No response
The text was updated successfully, but these errors were encountered: