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

Support new cuFFT callbacks #8242

Draft
wants to merge 22 commits into
base: main
Choose a base branch
from
Draft

Support new cuFFT callbacks #8242

wants to merge 22 commits into from

Conversation

leofang
Copy link
Member

@leofang leofang commented Mar 14, 2024

cuFFT now supports a new callback mechanism that is not only more performant but also more friendly to dynamic languages like Python and Julia, currently under public preview and will be released in a future CUDA version.

The new approach does not require any ugly compilation of host & device code; instead, we just need to use NVRTC to compile a user-provided device function (currently supporting raw CUDA C++ strings; once we support user-provided types in @cupyx.jit.rawkernel (#6663) we can also support pure Python functions as device functions) into LTO IR, and pass it to the new cuFFT API cufftXtSetJITCallback which will be responsible for linking the LTO IR with the cuFFT kernel.

The existing callback manager (_CallbackManager) is renamed to _LegacyCallbackManager, to be distinguished with the new _JITCallbackManager. My suggestion is once this feature is officially released (generally accessible), we add a deprecation warning to _LegacyCallbackManager. Users can currently pick either callback approach via the new option cp.fft.config.set_cufft_callbacks(..., cb_ver=...).

Currently, this feature requires users loading libcufft EA version: LD_PRELOAD=/path/to/EA/libcufft.so python ..., including running the test suite or sample code, so that the libcufft copy from CUDA Toolkit is not used. I'd like to have this capability included in CuPy sooner, so that users can give it a try and share feedbacks for final adjustment.

@leofang leofang marked this pull request as draft March 14, 2024 14:41
@takagi takagi self-assigned this Mar 15, 2024
@takagi takagi added cat:enhancement Improvements to existing features prio:medium labels Mar 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cat:enhancement Improvements to existing features prio:medium
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants