Repository navigation
CUDA: Deprecate eager compilation of device functions - #7114
Merged
Merged
Conversation
In future versions of Numba, the ``device`` kwarg to the ``@cuda.jit`` decorator will be obviated, and whether a device function or global kernel is compiled will be inferred from the context. With respect to kernel / device functions and lazy / eager compilation, four cases are presently handled: 1. ``device=True``, eager compilation with a signature provided 2. ``device=False``, eager compilation with a signature provided 3. ``device=True``, lazy compilation with no signature 4. ``device=False``, lazy compilation with no signature The latter two cases can be differentiated without the ``device`` kwarg, because it can be inferred from the calling context - if the call is from the host, then a global kernel should be compiled, and if the call is from a kernel or another device function, then a device function should be compiled. The first two cases cannot be differentiated in the absence of the ``device`` kwarg - without it, it will not be clear from a signature alone whether a device function or global kernel should be compiled. In order to resolve, this, support for eager compilation of device functions will be removed. Eager compilation with the ``@cuda.jit`` decorator will in future always imply the immediate compilation of a global kernel.
gmarkall
force-pushed
the
deprecate-eager-device
branch
from
June 14, 2021 12:24
b36fbe8 to
384d2f6
Compare
stuartarchibald
left a comment
Contributor
There was a problem hiding this comment.
Thanks for the patch, couple of minor things to resolve else looks good.
Co-authored-by: stuartarchibald <stuartarchibald@users.noreply.github.com>
Suggested in PR numba#7114 feedback.
stuartarchibald
approved these changes
Jun 16, 2021
stuartarchibald
left a comment
Contributor
There was a problem hiding this comment.
Thanks for the patch and fixes.
Contributor
|
Buildfarm ID: |
Contributor
Passed. |
This file contains hidden or 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.
In future versions of Numba, the
devicekwarg to the@cuda.jitdecorator will be obviated, and whether a device function or global kernel is compiled will be inferred from the context. With respect to kernel / device functions and lazy / eager compilation, four cases are presently handled:device=True, eager compilation with a signature provideddevice=False, eager compilation with a signature provideddevice=True, lazy compilation with no signaturedevice=False, lazy compilation with no signatureThe latter two cases can be differentiated without the
devicekwarg, because it can be inferred from the calling context - if the call is from the host, then a global kernel should be compiled, and if the call is from a kernel or another device function, then a device function should be compiled.The first two cases cannot be differentiated in the absence of the
devicekwarg - without it, it will not be clear from a signature alone whether a device function or global kernel should be compiled. In order to resolve, this, support for eager compilation of device functions will be removed. Eager compilation with the@cuda.jitdecorator will in future always imply the immediatecompilation of a global kernel.
This PR is made for Numba 0.54, in order to prepare for the changes in #7107 for 0.55.