Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge Gold/2021 into Main #1172

Merged
merged 4 commits into from
Oct 12, 2023
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
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.21.4] - 2023-10-12

### Fixed
* Remove dead code to silence Coverity errors. (#1163)

## [0.21.3] - 2023-09-28

### Fixed
Expand Down
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
Loading