Skip to content

Commit

Permalink
Merge pull request #1314 from spcl/pace-fixes-0
Browse files Browse the repository at this point in the history
Pace Fixes 0
  • Loading branch information
alexnick83 authored Jul 22, 2023
2 parents 182ef86 + 1d34f38 commit 892d614
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
18 changes: 11 additions & 7 deletions dace/frontend/python/newast.py
Original file line number Diff line number Diff line change
Expand Up @@ -3655,6 +3655,11 @@ def _parse_sdfg_call(self, funcname: str, func: Union[SDFG, SDFGConvertible], no
# If the symbol is a callback, but is not used in the nested SDFG, skip it
continue

# NOTE: Is it possible that an array in the SDFG's closure is not in the SDFG?
# NOTE: Perhaps its use was simplified/optimized away?
if aname not in sdfg.arrays:
continue

# First, we do an inverse lookup on the already added closure arrays for `arr`.
is_new_arr = True
for k, v in self.nested_closure_arrays.items():
Expand Down Expand Up @@ -3831,6 +3836,12 @@ def _parse_sdfg_call(self, funcname: str, func: Union[SDFG, SDFGConvertible], no
for k, v in argdict.items() if self._is_outputnode(sdfg, k)
}

# If an argument does not register as input nor as output, put it in the inputs.
# This may happen with input arguments that are used to set a promoted scalar.
for k, v in argdict.items():
if k not in inputs.keys() and k not in outputs.keys():
inputs[k] = v

# Add closure to global inputs/outputs (e.g., if processed as part of a map)
for arrname in closure_arrays.keys():
if arrname not in names_to_replace:
Expand All @@ -3842,13 +3853,6 @@ def _parse_sdfg_call(self, funcname: str, func: Union[SDFG, SDFGConvertible], no
if narrname in outputs:
self.outputs[arrname] = (state, outputs[narrname], [])

# If an argument does not register as input nor as output,
# put it in the inputs.
# This may happen with input argument that are used to set
# a promoted scalar.
for k, v in argdict.items():
if k not in inputs.keys() and k not in outputs.keys():
inputs[k] = v
# Unset parent inputs/read accesses that
# turn out to be outputs/write accesses.
for memlet in outputs.values():
Expand Down
3 changes: 3 additions & 0 deletions dace/transformation/passes/array_elimination.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,9 @@ def remove_redundant_copies(self, sdfg: SDFG, state: SDFGState, removable_data:
for anode in access_nodes[aname]:
if anode in removed_nodes:
continue
if anode not in state.nodes():
removed_nodes.add(anode)
continue

if state.out_degree(anode) == 1:
succ = state.successors(anode)[0]
Expand Down

0 comments on commit 892d614

Please sign in to comment.