Skip to content

Commit

Permalink
Remove dead code to silence coverity errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
Diptorup Deb committed Oct 10, 2023
1 parent 5aaf492 commit b2758b8
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 66 deletions.
15 changes: 0 additions & 15 deletions numba_dpex/core/passes/dufunc_inliner.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,8 @@ def _is_dufunc_callsite(expr, block):


def dufunc_inliner(func_ir, calltypes, typemap, typingctx, targetctx):
_DEBUG = False
modified = False

if _DEBUG:
print("GUFunc before inlining DUFunc".center(80, "-"))
print(func_ir.dump())

work_list = list(func_ir.blocks.items())
# use a work list, look for call sites via `ir.Expr.op == call` and
# then pass these to `self._do_work` to make decisions about inlining.
Expand Down Expand Up @@ -152,11 +147,6 @@ def dufunc_inliner(func_ir, calltypes, typemap, typingctx, targetctx):
break # because block structure changed
else:
continue
if _DEBUG:
print("GUFunc after inlining DUFunc".center(80, "-"))
print(func_ir.dump())
print("".center(80, "-"))

if modified:
# clean up leftover load instructions. This step is needed or else
# SpirvLowerer would complain
Expand All @@ -165,9 +155,4 @@ def dufunc_inliner(func_ir, calltypes, typemap, typingctx, targetctx):
# functions introducing blocks
func_ir.blocks = simplify_CFG(func_ir.blocks)

if _DEBUG:
print("GUFunc after inlining DUFunc, DCE, SimplyCFG".center(80, "-"))
print(func_ir.dump())
print("".center(80, "-"))

return True
9 changes: 0 additions & 9 deletions numba_dpex/core/passes/passes.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,6 @@ def run_pass(self, state):
assert state.func_ir
func_ir = state.func_ir

_DEBUG = False

if _DEBUG:
print(
"Checks if size of OpenCL local address space alloca is a "
+ "compile-time constant.".center(80, "-")
)
print(func_ir.dump())

work_list = list(func_ir.blocks.items())
while work_list:
label, block = work_list.pop()
Expand Down
43 changes: 1 addition & 42 deletions numba_dpex/core/types/dpnp_ndarray_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def __array_ufunc__(self, ufunc, method, *inputs, **kwargs):
return

def __str__(self):
return self.name.replace("USMNdArray", "DpnpNdarray")
return self.name.replace("USMNdArray", "DpnpNdArray")

def __repr__(self):
return self.__str__()
Expand Down Expand Up @@ -193,47 +193,6 @@ def __allocate__(
# enable this code path.
raise NotImplementedError("F Arrays are not yet supported")

empty_c_typ = lhs_typ.copy(layout="C")
empty_c_var = ir.Var(scope, mk_unique_var("$empty_c_var"), loc)
if typemap:
typemap[empty_c_var.name] = lhs_typ.copy(layout="C")
empty_c_assign = ir.Assign(alloc_call, empty_c_var, loc)

# attr call: asfortranarray = getattr(g_np_var, asfortranarray)
asfortranarray_attr_call = ir.Expr.getattr(
g_np_var, "asfortranarray", loc
)
afa_attr_var = ir.Var(
scope, mk_unique_var("$asfortran_array_attr"), loc
)
if typemap:
typemap[afa_attr_var.name] = get_np_ufunc_typ(
dpnp.asfortranarray
)
afa_attr_assign = ir.Assign(
asfortranarray_attr_call, afa_attr_var, loc
)
# call asfortranarray
asfortranarray_call = ir.Expr.call(
afa_attr_var, [empty_c_var], (), loc
)
if calltypes:
calltypes[asfortranarray_call] = typemap[
afa_attr_var.name
].get_call_type(typingctx, [empty_c_typ], {})

asfortranarray_assign = ir.Assign(asfortranarray_call, lhs, loc)

out.extend(
[
g_np_assign,
attr_assign,
typ_var_assign,
empty_c_assign,
afa_attr_assign,
asfortranarray_assign,
]
)
else:
alloc_assign = ir.Assign(alloc_call, lhs, loc)
out.extend([g_np_assign, attr_assign, typ_var_assign, alloc_assign])
Expand Down

0 comments on commit b2758b8

Please sign in to comment.