Skip to content
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
15 changes: 2 additions & 13 deletions numba_cuda/numba/cuda/core/ir_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,12 +249,7 @@ def mk_range_block(typemap, start, stop, step, calltypes, scope, loc):
range_call_assign = ir.Assign(range_call, range_call_var, loc)
# iter_var = getiter(range_call_var)
iter_call = ir.Expr.getiter(range_call_var, loc)
if config.USE_LEGACY_TYPE_SYSTEM:
calltype_sig = signature(
types.range_iter64_type, types.range_state64_type
)
else:
calltype_sig = signature(types.range_iter_type, types.range_state_type)
calltype_sig = signature(types.range_iter64_type, types.range_state64_type)
calltypes[iter_call] = calltype_sig
iter_var = ir.Var(scope, mk_unique_var("$iter_var"), loc)
typemap[iter_var.name] = types.iterators.RangeIteratorType(types.intp)
Expand Down Expand Up @@ -333,10 +328,7 @@ def mk_loop_header(typemap, phi_var, calltypes, scope, loc):
types.intp, types.boolean
)
iternext_call = ir.Expr.iternext(phi_var, loc)
if config.USE_LEGACY_TYPE_SYSTEM:
range_iter_type = types.range_iter64_type
else:
range_iter_type = types.range_iter_type
range_iter_type = types.range_iter64_type
calltypes[iternext_call] = signature(
types.containers.Pair(types.intp, types.boolean), range_iter_type
)
Expand Down Expand Up @@ -813,7 +805,6 @@ def has_no_side_effect(rhs, lives, call_table):
"""Returns True if this expression has no side effects that
would prevent re-ordering.
"""
from numba.misc.special import prange

if isinstance(rhs, ir.Expr) and rhs.op == "call":
func_name = rhs.func.name
Expand All @@ -826,8 +817,6 @@ def has_no_side_effect(rhs, lives, call_table):
or call_list == ["stencil", numba]
or call_list == ["log", numpy]
or call_list == ["dtype", numpy]
or call_list == [prange]
or call_list == ["prange", numba]
or call_list == ["pndindex", numba]
or call_list == ["ceil", math]
or call_list == [max]
Expand Down
4 changes: 2 additions & 2 deletions numba_cuda/numba/cuda/core/typed_passes.py
Original file line number Diff line number Diff line change
Expand Up @@ -451,9 +451,9 @@ def run_pass(self, state):
lowered = state["cr"]
signature = typing.signature(state.return_type, *state.args)

from numba.core.compiler import compile_result
from numba.cuda.compiler import cuda_compile_result

state.cr = compile_result(
state.cr = cuda_compile_result(
typing_context=state.typingctx,
target_context=state.targetctx,
entry_point=lowered.cfunc,
Expand Down
2 changes: 1 addition & 1 deletion numba_cuda/numba/cuda/lowering.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
funcdesc,
generators,
config,
cgutils,
removerefctpass,
targetconfig,
)
from numba.cuda import cgutils
from numba.cuda.core import ir_utils
from numba.core.errors import (
LoweringError,
Expand Down
8 changes: 3 additions & 5 deletions numba_cuda/numba/cuda/np/npyfuncs.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@

from numba.core.extending import overload
from numba.core.imputils import impl_ret_untracked
from numba.core import typing, types, errors, cgutils, config
from numba.core import typing, types, errors
from numba.cuda import cgutils
from numba.core.extending import register_jitable
from numba.np import npdatetime
from numba.np.math import cmathimpl, mathimpl, numbers
Expand Down Expand Up @@ -51,10 +52,7 @@ def _check_arity_and_homogeneity(sig, args, arity, return_type=None):
assert False, msg


if getattr(config, "USE_LEGACY_TYPE_SYSTEM", True):
cast_arg_ty = types.float64
else:
cast_arg_ty = types.np_float64
cast_arg_ty = types.float64


def _call_func_by_name_with_cast(
Expand Down
55 changes: 18 additions & 37 deletions numba_cuda/numba/cuda/np/numpy_support.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,48 +3,29 @@

import numpy as np
import re
from numba.core import types, errors, config
from numba.core import types, errors


numpy_version = tuple(map(int, np.__version__.split(".")[:2]))


if getattr(config, "USE_LEGACY_TYPE_SYSTEM", True):
FROM_DTYPE = {
np.dtype("bool"): types.boolean,
np.dtype("int8"): types.int8,
np.dtype("int16"): types.int16,
np.dtype("int32"): types.int32,
np.dtype("int64"): types.int64,
np.dtype("uint8"): types.uint8,
np.dtype("uint16"): types.uint16,
np.dtype("uint32"): types.uint32,
np.dtype("uint64"): types.uint64,
np.dtype("float32"): types.float32,
np.dtype("float64"): types.float64,
np.dtype("float16"): types.float16,
np.dtype("complex64"): types.complex64,
np.dtype("complex128"): types.complex128,
np.dtype(object): types.pyobject,
}
else:
FROM_DTYPE = {
np.dtype("bool"): types.np_bool_,
np.dtype("int8"): types.np_int8,
np.dtype("int16"): types.np_int16,
np.dtype("int32"): types.np_int32,
np.dtype("int64"): types.np_int64,
np.dtype("uint8"): types.np_uint8,
np.dtype("uint16"): types.np_uint16,
np.dtype("uint32"): types.np_uint32,
np.dtype("uint64"): types.np_uint64,
np.dtype("float32"): types.np_float32,
np.dtype("float64"): types.np_float64,
np.dtype("float16"): types.np_float16,
np.dtype("complex64"): types.np_complex64,
np.dtype("complex128"): types.np_complex128,
np.dtype(object): types.pyobject,
}
FROM_DTYPE = {
np.dtype("bool"): types.boolean,
np.dtype("int8"): types.int8,
np.dtype("int16"): types.int16,
np.dtype("int32"): types.int32,
np.dtype("int64"): types.int64,
np.dtype("uint8"): types.uint8,
np.dtype("uint16"): types.uint16,
np.dtype("uint32"): types.uint32,
np.dtype("uint64"): types.uint64,
np.dtype("float32"): types.float32,
np.dtype("float64"): types.float64,
np.dtype("float16"): types.float16,
np.dtype("complex64"): types.complex64,
np.dtype("complex128"): types.complex128,
np.dtype(object): types.pyobject,
}


re_typestr = re.compile(r"[<>=\|]([a-z])(\d+)?$", re.I)
Expand Down