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
1 change: 1 addition & 0 deletions .github/workflows/black.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@ jobs:
- uses: psf/black@stable
with:
args: ". --check"
version: "23.1.0"
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ repos:
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/psf/black
rev: 22.10.0
rev: 23.1.0
hooks:
- id: black
exclude: "versioneer.py|numba_dpex/_version.py"
Expand All @@ -23,7 +23,7 @@ repos:
- id: blacken-docs
additional_dependencies: [black==22.10]
- repo: https://github.com/pycqa/isort
rev: 5.10.1
rev: 5.12.0
hooks:
- id: isort
name: isort (python)
Expand Down
1 change: 0 additions & 1 deletion numba_dpex/core/passes/dufunc_inliner.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ def dufunc_inliner(func_ir, calltypes, typemap, typingctx, targetctx):
while work_list:
label, block = work_list.pop()
for i, instr in enumerate(block.body):

if isinstance(instr, ir.Assign):
expr = instr.value
if isinstance(expr, ir.Expr):
Expand Down
4 changes: 1 addition & 3 deletions numba_dpex/core/passes/lowerer.py
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,7 @@ def print_arg_with_addrspaces(args):
prev_block.append(ir.Jump(body_first_label, loc))
# Add all the parfor loop body blocks to the gufunc function's
# IR.
for (l, b) in loop_body.items():
for l, b in loop_body.items():
gufunc_ir.blocks[l] = b
body_last_label = max(loop_body.keys())
gufunc_ir.blocks[new_label] = block
Expand Down Expand Up @@ -1036,7 +1036,6 @@ def val_type_or_none(context, lowerer, x):
all_val_types,
range(len(expr_args)),
):

if config.DEBUG_ARRAY_OPT:
print(
"var:",
Expand Down Expand Up @@ -1447,7 +1446,6 @@ def lower_parfor_rollback(lowerer, parfor):
try:
_lower_parfor_gufunc(lowerer, parfor)
if config.DEBUG:

device_filter_str = (
dpctl.get_current_queue().get_sycl_device().filter_string
)
Expand Down
7 changes: 0 additions & 7 deletions numba_dpex/core/passes/passes.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@

@register_pass(mutates_CFG=True, analysis_only=False)
class ConstantSizeStaticLocalMemoryPass(FunctionPass):

_name = "dpex_constant_size_static_local_memory_pass"

def __init__(self):
Expand Down Expand Up @@ -86,7 +85,6 @@ def run_pass(self, state):
and attr_node.op == "getattr"
and attr_node.attr == "local"
):

arg = None
# at first look in keyword arguments to
# get the shape, which has to be
Expand Down Expand Up @@ -147,7 +145,6 @@ def run_pass(self, state):

@register_pass(mutates_CFG=True, analysis_only=False)
class PreParforPass(FunctionPass):

_name = "dpex_pre_parfor_pass"

def __init__(self):
Expand Down Expand Up @@ -193,7 +190,6 @@ def run_pass(self, state):

@register_pass(mutates_CFG=True, analysis_only=False)
class ParforPass(FunctionPass):

_name = "dpex_parfor_pass"

def __init__(self):
Expand Down Expand Up @@ -260,7 +256,6 @@ def fallback_context(state, msg):

@register_pass(mutates_CFG=True, analysis_only=False)
class DpexLowering(LoweringPass):

_name = "dpex_lowering"

def __init__(self):
Expand Down Expand Up @@ -340,7 +335,6 @@ def run_pass(self, state):

@register_pass(mutates_CFG=True, analysis_only=False)
class NoPythonBackend(FunctionPass):

_name = "dpex_nopython_backend"

def __init__(self):
Expand Down Expand Up @@ -380,7 +374,6 @@ def run_pass(self, state):

@register_pass(mutates_CFG=False, analysis_only=True)
class DumpParforDiagnostics(AnalysisPass):

_name = "dpex_dump_parfor_diagnostics"

def __init__(self):
Expand Down
2 changes: 1 addition & 1 deletion numba_dpex/core/passes/rename_numpy_functions_pass.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ def run_pass(self, state):
def get_dpnp_func_typ(func):
from numba.core.typing.templates import builtin_registry

for (k, v) in builtin_registry.globals:
for k, v in builtin_registry.globals:
if k == func:
return v
raise RuntimeError("type for func ", func, " not found")
Expand Down
1 change: 0 additions & 1 deletion numba_dpex/dpnp_iface/dpnp_linalgimpl.py
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,6 @@ def dot_2_vm(a, b):
dpnp_func = dpnp_ext.dpnp_func("dpnp_dot", [a.dtype.name, "NONE"], sig)

def dot_2_vv(a, b):

(m,) = a.shape
(n,) = b.shape

Expand Down
1 change: 1 addition & 0 deletions numba_dpex/examples/kernel/kernel_specialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ def data_parallel_sum(a, b, c):
# Multiple signatures can be specified as a list to eager compile multiple
# versions of the kernel.


# specialize a kernel for the i64arrty
@dpex.kernel([(i64arrty, i64arrty, i64arrty), (f32arrty, f32arrty, f32arrty)])
def data_parallel_sum2(a, b, c):
Expand Down
1 change: 0 additions & 1 deletion numba_dpex/examples/kernel/vector_sum.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ def kernel_vector_sum(a, b, c):

# Utility function for printing and testing
def driver(a, b, c, global_size):

kernel_vector_sum[Range(global_size)](a, b, c)

a_np = dpnp.asnumpy(a) # Copy dpnp array a to NumPy array a_np
Expand Down
2 changes: 1 addition & 1 deletion numba_dpex/numpy_usm_shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ def dprint(*args):
py_name,
c_address,
) in numba_dpex._usm_allocators_ext.c_helpers.items():

llb.add_symbol(py_name, c_address)


Expand Down Expand Up @@ -155,6 +154,7 @@ def typeof_ta_ndarray(val, c):
UsmSharedArrayType, numba.core.datamodel.models.ArrayModel
)


# This tells Numba how to convert from its native representation
# of a UsmArray in a njit function back to a Python UsmArray.
@box(UsmSharedArrayType)
Expand Down
2 changes: 0 additions & 2 deletions numba_dpex/ocl/ocldecl.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ class OCL_local_array(CallableTemplate):

def generic(self):
def typer(shape, dtype):

# Only integer literals and tuples of integer literals are valid
# shapes
if isinstance(shape, types.Integer):
Expand Down Expand Up @@ -184,7 +183,6 @@ class OCL_private_array(CallableTemplate):

def generic(self):
def typer(shape, dtype):

# Only integer literals and tuples of integer literals are valid
# shapes
if isinstance(shape, types.Integer):
Expand Down
5 changes: 2 additions & 3 deletions numba_dpex/tests/kernel_tests/test_kernel_launch_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
InvalidKernelLaunchArgsError,
UnknownGlobalRangeError,
)
from numba_dpex.core.kernel_interface.utils import Range


@dpex.kernel
Expand All @@ -27,9 +28,7 @@ def test_1D_global_range_as_int():


def test_1D_global_range_as_one_tuple():
k = vecadd[
10,
]
k = vecadd[Range(10)]
assert k._global_range == [10]
assert k._local_range is None

Expand Down
9 changes: 3 additions & 6 deletions numba_dpex/tests/kernel_tests/test_kernel_specialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
InvalidKernelSpecializationError,
MissingSpecializationError,
)
from numba_dpex.core.kernel_interface.utils import Range

i64arrty = usm_ndarray(int64, 1, "C")
f32arrty = usm_ndarray(float32, 1, "C")
Expand Down Expand Up @@ -59,9 +60,7 @@ def test_missing_specialization_error():
c = dpt.zeros(1024, dtype=dpt.int32)

with pytest.raises(MissingSpecializationError):
specialized_kernel1(data_parallel_sum)[
1024,
](a, b, c)
specialized_kernel1(data_parallel_sum)[Range(1024)](a, b, c)


def test_execution_of_specialized_kernel():
Expand All @@ -70,9 +69,7 @@ def test_execution_of_specialized_kernel():
b = dpt.ones(1024, dtype=dpt.int64)
c = dpt.zeros(1024, dtype=dpt.int64)

specialized_kernel1(data_parallel_sum)[
1024,
](a, b, c)
specialized_kernel1(data_parallel_sum)[Range(1024)](a, b, c)

npc = dpt.asnumpy(c)
import numpy as np
Expand Down