Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
d7f58ed
CUDA Dispatcher: inherit from _DispatcherBase
gmarkall Feb 4, 2022
31c1a64
[WIP] Fix CUDA target tests
gmarkall Feb 4, 2022
d9649f8
Some tidy-up
gmarkall Feb 4, 2022
70dbacd
[WIP] CUDA Dispatcher inherits from uber_Dispatcher
gmarkall Feb 4, 2022
922624f
Wire in target options in CUDA dispatcher
gmarkall Feb 4, 2022
ed2e17a
Delete some dead code
gmarkall Feb 4, 2022
8238610
Remove sigs from cuda dispatcher
gmarkall Feb 4, 2022
53e98fb
Some refactoring
gmarkall Feb 4, 2022
e307e9a
Some renaming to closer align ForAll with reality
gmarkall Feb 4, 2022
703d222
Delete _search_new_conversions and nopython_signatures from CUDA disp…
gmarkall Feb 4, 2022
13aa50b
Remove CUDA Dispatchers disable_compile and add a note to get_call_te…
gmarkall Feb 4, 2022
a11269e
Clarify comment on CUDA Compile Result
gmarkall Feb 4, 2022
18c553f
Remove duplication in compile_result functions
gmarkall Feb 4, 2022
3ebcf26
Refactor / tidy up decorators.py
gmarkall Feb 4, 2022
4f5b361
Rename CUDA dispatcher to CUDADispatcher
gmarkall Feb 4, 2022
078f2d9
Clarify some comments
gmarkall Feb 4, 2022
778f7e2
Fix ref to CUDADispatcher in docs
gmarkall Feb 4, 2022
5d6384c
CUDA Dispatcher: use default finalizer
gmarkall Feb 4, 2022
4d9cff7
Add test for Issue #5902
gmarkall Feb 4, 2022
c136220
Merge remote-tracking branch 'numba/main' into cuda-dispatcher-base-2…
gmarkall Feb 8, 2022
ef5b4dc
Fix typos (PR #7815 review)
gmarkall Feb 11, 2022
499623f
Fix line length in cuda/compiler.py
gmarkall Feb 11, 2022
17f9585
Merge remote-tracking branch 'numba/main' into cuda-dispatcher-base-2…
gmarkall Feb 17, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[WIP] CUDA Dispatcher inherits from uber_Dispatcher
Test results:

```
Ran 1266 tests in 127.002s

FAILED (failures=66, errors=17, skipped=12, expected failures=7)
```
  • Loading branch information
gmarkall committed Feb 4, 2022
commit 70dbacd9dbffebaa35bc7285388a2f9c4c3cd72c
28 changes: 10 additions & 18 deletions numba/cuda/dispatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@

from numba.core import config, serialize, sigutils, types, typing, utils
from numba.core.compiler_lock import global_compiler_lock
from numba.core.dispatcher import _DispatcherBase
from numba.core.dispatcher import Dispatcher as uber_Dispatcher
from numba.core.errors import NumbaPerformanceWarning
from numba.core.typing.templates import AbstractTemplate
from numba.core.typing.typeof import Purpose, typeof

from numba.cuda.api import get_current_device
from numba.cuda.args import wrap_arg
from numba.cuda.compiler import compile_cuda
from numba.cuda.compiler import compile_cuda, CUDACompiler
from numba.cuda.cudadrv import driver
from numba.cuda.cudadrv.devices import get_context
from numba.cuda.cudadrv.libs import get_cudalib
Expand Down Expand Up @@ -444,7 +444,7 @@ def __call__(self, *args):
self.stream, self.sharedmem)


class Dispatcher(_DispatcherBase, serialize.ReduceMixin):
class Dispatcher(uber_Dispatcher, serialize.ReduceMixin):
'''
CUDA Dispatcher object. When configured and called, the dispatcher will
specialize itself for the given arguments (if no suitable specialized
Expand All @@ -462,21 +462,13 @@ class Dispatcher(_DispatcherBase, serialize.ReduceMixin):

targetdescr = cuda_target

def __init__(self, py_func, sigs, targetoptions):
self.typingctx = self.targetdescr.typing_context
self.targetctx = self.targetdescr.target_context

pysig = utils.pysignature(py_func)
arg_count = len(pysig.parameters)
can_fallback = False # CUDA cannot fallback to object mode

_DispatcherBase.__init__(self, arg_count, py_func, pysig, can_fallback,
exact_match_required=False)

def __init__(self, py_func, sigs, targetoptions,
pipeline_class=CUDACompiler):
# TODO: Check if this fixes the cuda docstring jit issue
functools.update_wrapper(self, py_func)

self.targetoptions = targetoptions
super().__init__(py_func, pipeline_class=pipeline_class)

# CUDA-specific stuff - hopefully some of it can be removed ASAP

self.sigs = []
self.link = targetoptions.pop('link', (),)
Expand All @@ -501,8 +493,8 @@ def __init__(self, py_func, sigs, targetoptions):

self._can_compile = False

if targetoptions.get('device'):
self._register_device_function()
#if targetoptions.get('device'):
# self._register_device_function()

def _make_finalizer(self):
# Dummy finalizer whilst _DispatcherBase assumes the existence of a
Expand Down
13 changes: 7 additions & 6 deletions numba/cuda/target.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
import llvmlite.binding as ll
from llvmlite import ir

from numba.core import (typing, types, dispatcher, debuginfo, itanium_mangler,
cgutils)
from numba.core import typing, types, debuginfo, itanium_mangler, cgutils
from numba.core.dispatcher import Dispatcher as uber_Dispatcher
from numba.core.utils import cached_property
from numba.core.base import BaseContext
from numba.core.callconv import MinimalCallConv
Expand All @@ -27,8 +27,10 @@ def load_additional_registries(self):
self.install_registry(libdevicedecl.registry)

def resolve_value_type(self, val):
# treat dispatcher object as another device function
if isinstance(val, dispatcher.Dispatcher):
# treat other dispatcher object as another device function
from numba.cuda.dispatcher import Dispatcher as CUDADispatcher
if (isinstance(val, uber_Dispatcher) and not
isinstance(val, CUDADispatcher)):
try:
# use cached device function
val = val.__dispatcher
Expand All @@ -41,8 +43,7 @@ def resolve_value_type(self, val):
targetoptions['debug'] = targetoptions.get('debug', False)
targetoptions['opt'] = targetoptions.get('opt', True)
sigs = None
from numba.cuda.dispatcher import Dispatcher
disp = Dispatcher(val.py_func, sigs, targetoptions)
disp = CUDADispatcher(val.py_func, sigs, targetoptions)
# cache the device function for future use and to avoid
# duplicated copy of the same function.
val.__dispatcher = disp
Expand Down