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
leofang
wants to merge
22
commits into
cupy:main
Choose a base branch
from
leofang:jit_dev_lto
base: main
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 APIcufftXtSetJITCallback
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 optioncp.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.