Skip to content
This repository was archived by the owner on Jan 25, 2023. It is now read-only.

Commit 152156b

Browse files
authored
Remove changes to CPUDispatcher (#90)
New CPUDispatcher was created in 8e92a78 by @reazulhoque. Then it was reverted in 9666627 by @1e-to. Now it is the same as original CPUDispatcher and could be removed back.
1 parent 9920270 commit 152156b

File tree

6 files changed

+12
-20
lines changed

6 files changed

+12
-20
lines changed

numba/core/cpu_dispatcher.py

Lines changed: 0 additions & 13 deletions
This file was deleted.

numba/core/inline_closurecall.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ def check_reduce_func(func_ir, func_var):
256256
analysis")
257257
if isinstance(reduce_func, (ir.FreeVar, ir.Global)):
258258
if not isinstance(reduce_func.value,
259-
numba.core.cpu_dispatcher.CPUDispatcher):
259+
numba.core.registry.CPUDispatcher):
260260
raise ValueError("Invalid reduction function")
261261
# pull out the python function for inlining
262262
reduce_func = reduce_func.value.py_func

numba/core/ir_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,7 @@ def has_no_side_effect(rhs, lives, call_table):
679679
(call_list[0]._name == 'empty_inferred' or
680680
call_list[0]._name == 'unsafe_empty_inferred')):
681681
return True
682-
from numba.core.cpu_dispatcher import CPUDispatcher
682+
from numba.core.registry import CPUDispatcher
683683
from numba.np.linalg import dot_3_mv_check_args
684684
if isinstance(call_list[0], CPUDispatcher):
685685
py_func = call_list[0].py_func

numba/core/registry.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@ def nested_context(self, typing_context, target_context):
7575
cpu_target = CPUTarget()
7676

7777

78+
class CPUDispatcher(dispatcher.Dispatcher):
79+
targetdescr = cpu_target
80+
81+
7882
class TargetRegistry(utils.UniqueDict):
7983
"""
8084
A registry of API implementations for various backends.
@@ -99,3 +103,4 @@ def __getitem__(self, item):
99103

100104

101105
dispatcher_registry = TargetRegistry()
106+
dispatcher_registry['cpu'] = CPUDispatcher

numba/tests/test_inlining.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from numba.core import types, ir, postproc, compiler
88
from numba.core.ir_utils import (guard, find_callname, find_const,
99
get_definition, simplify_CFG)
10-
from numba.core.cpu_dispatcher import CPUDispatcher
10+
from numba.core.registry import CPUDispatcher
1111
from numba.core.inline_closurecall import inline_closure_call
1212

1313
from numba.core.untyped_passes import (ExtractByteCode, TranslateByteCode, FixupArgs,

numba/tests/test_wrapper.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import numpy as np
22

33
import unittest
4-
from numba.core import types, utils, compiler, registry, cpu_dispatcher
4+
from numba.core import types, utils, compiler, registry
55

66

77
def overhead(x):
@@ -24,7 +24,7 @@ def test_overhead(self):
2424
"""
2525
cr = compiler.compile_isolated(overhead, [types.int32])
2626
cfunc = cr.entry_point
27-
disp = cpu_dispatcher.CPUDispatcher(overhead)
27+
disp = registry.CPUDispatcher(overhead)
2828
disp.add_overload(cr)
2929

3030
x = 321
@@ -50,7 +50,7 @@ def test_array_overhead(self):
5050
"""
5151
cr = compiler.compile_isolated(array_overhead, [types.int32[::1]])
5252
cfunc = cr.entry_point
53-
disp = cpu_dispatcher.CPUDispatcher(array_overhead)
53+
disp = registry.CPUDispatcher(array_overhead)
5454
disp.add_overload(cr)
5555

5656
self.assertEqual(cr.signature.args[0].layout, 'C')
@@ -79,7 +79,7 @@ def test_add(self):
7979
"""
8080
cr = compiler.compile_isolated(add, [types.int32])
8181
cfunc = cr.entry_point
82-
disp = cpu_dispatcher.CPUDispatcher(add)
82+
disp = registry.CPUDispatcher(add)
8383
disp.add_overload(cr)
8484

8585
x = 321

0 commit comments

Comments
 (0)