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

Remove changes to CPUDispatcher #90

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
13 changes: 0 additions & 13 deletions numba/core/cpu_dispatcher.py

This file was deleted.

2 changes: 1 addition & 1 deletion numba/core/inline_closurecall.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ def check_reduce_func(func_ir, func_var):
analysis")
if isinstance(reduce_func, (ir.FreeVar, ir.Global)):
if not isinstance(reduce_func.value,
numba.core.cpu_dispatcher.CPUDispatcher):
numba.core.registry.CPUDispatcher):
raise ValueError("Invalid reduction function")
# pull out the python function for inlining
reduce_func = reduce_func.value.py_func
Expand Down
2 changes: 1 addition & 1 deletion numba/core/ir_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -679,7 +679,7 @@ def has_no_side_effect(rhs, lives, call_table):
(call_list[0]._name == 'empty_inferred' or
call_list[0]._name == 'unsafe_empty_inferred')):
return True
from numba.core.cpu_dispatcher import CPUDispatcher
from numba.core.registry import CPUDispatcher
from numba.np.linalg import dot_3_mv_check_args
if isinstance(call_list[0], CPUDispatcher):
py_func = call_list[0].py_func
Expand Down
5 changes: 5 additions & 0 deletions numba/core/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ def nested_context(self, typing_context, target_context):
cpu_target = CPUTarget()


class CPUDispatcher(dispatcher.Dispatcher):
targetdescr = cpu_target


class TargetRegistry(utils.UniqueDict):
"""
A registry of API implementations for various backends.
Expand All @@ -99,3 +103,4 @@ def __getitem__(self, item):


dispatcher_registry = TargetRegistry()
dispatcher_registry['cpu'] = CPUDispatcher
2 changes: 1 addition & 1 deletion numba/tests/test_inlining.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from numba.core import types, ir, postproc, compiler
from numba.core.ir_utils import (guard, find_callname, find_const,
get_definition, simplify_CFG)
from numba.core.cpu_dispatcher import CPUDispatcher
from numba.core.registry import CPUDispatcher
from numba.core.inline_closurecall import inline_closure_call

from numba.core.untyped_passes import (ExtractByteCode, TranslateByteCode, FixupArgs,
Expand Down
8 changes: 4 additions & 4 deletions numba/tests/test_wrapper.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import numpy as np

import unittest
from numba.core import types, utils, compiler, registry, cpu_dispatcher
from numba.core import types, utils, compiler, registry


def overhead(x):
Expand All @@ -24,7 +24,7 @@ def test_overhead(self):
"""
cr = compiler.compile_isolated(overhead, [types.int32])
cfunc = cr.entry_point
disp = cpu_dispatcher.CPUDispatcher(overhead)
disp = registry.CPUDispatcher(overhead)
disp.add_overload(cr)

x = 321
Expand All @@ -50,7 +50,7 @@ def test_array_overhead(self):
"""
cr = compiler.compile_isolated(array_overhead, [types.int32[::1]])
cfunc = cr.entry_point
disp = cpu_dispatcher.CPUDispatcher(array_overhead)
disp = registry.CPUDispatcher(array_overhead)
disp.add_overload(cr)

self.assertEqual(cr.signature.args[0].layout, 'C')
Expand Down Expand Up @@ -79,7 +79,7 @@ def test_add(self):
"""
cr = compiler.compile_isolated(add, [types.int32])
cfunc = cr.entry_point
disp = cpu_dispatcher.CPUDispatcher(add)
disp = registry.CPUDispatcher(add)
disp.add_overload(cr)

x = 321
Expand Down