Skip to content
Draft
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
8 changes: 4 additions & 4 deletions dace/distr_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -451,9 +451,9 @@ def init_code(self, sdfg):
tmp += f"""
if (__state->{array_b.pgrid}_valid) {{
"""
grid_a = sdfg.process_grids[array_a.pgrid]
grid_a = sdfg.pgrids[array_a.pgrid]
if grid_a.is_subgrid:
pgrid_a = sdfg.process_grids[grid_a.parent_grid]
pgrid_a = sdfg.pgrids[grid_a.parent_grid]
tmp += f"""
int pgrid_exact_coords[{len(pgrid_a.shape)}];
dace::comm::cart_coords({grid_a.exact_grid}, {len(pgrid_a.shape)}, __state->{pgrid_a.name}_dims, pgrid_exact_coords);
Expand Down Expand Up @@ -520,9 +520,9 @@ def init_code(self, sdfg):
tmp += f"""
if (__state->{array_a.pgrid}_valid) {{
"""
grid_b = sdfg.process_grids[array_b.pgrid]
grid_b = sdfg.pgrids[array_b.pgrid]
if grid_b.is_subgrid:
pgrid_b = sdfg.process_grids[grid_b.parent_grid]
pgrid_b = sdfg.pgrids[grid_b.parent_grid]
tmp += f"""
int pgrid_exact_coords[{len(pgrid_b.shape)}];
dace::comm::cart_coords({grid_b.exact_grid}, {len(pgrid_b.shape)}, __state->{pgrid_b.name}_dims, pgrid_exact_coords);
Expand Down
22 changes: 9 additions & 13 deletions dace/frontend/python/newast.py
Original file line number Diff line number Diff line change
Expand Up @@ -1369,10 +1369,7 @@ def defined(self):
result.update(self.sdfg.arrays)

# MPI-related stuff
result.update({
v: self.sdfg.process_grids[v]
for k, v in self.variables.items() if v in self.sdfg.process_grids
})
result.update({v: self.sdfg.pgrids[v] for k, v in self.variables.items() if v in self.sdfg.pgrids})
try:
from mpi4py import MPI
result.update({k: v for k, v in self.globals.items() if isinstance(v, MPI.Comm)})
Expand Down Expand Up @@ -3604,11 +3601,10 @@ def _visit_assign(self, node, node_target, op, dtype=None, is_return=False):

new_data, rng = None, None
dtype_keys = tuple(dtypes.dtype_to_typeclass().keys())
if not (
result in self.sdfg.symbols or symbolic.issymbolic(result) or isinstance(result, dtype_keys) or
(isinstance(result, str) and any(
result in x
for x in [self.sdfg.arrays, self.sdfg._pgrids, self.sdfg._subarrays, self.sdfg._rdistrarrays]))):
if not (result in self.sdfg.symbols or symbolic.issymbolic(result) or isinstance(result, dtype_keys) or
(isinstance(result, str) and any(
result in x
for x in [self.sdfg.arrays, self.sdfg.pgrids, self.sdfg.subarrays, self.sdfg.rdistrarrays]))):
raise DaceSyntaxError(
self, node, "In assignments, the rhs may only be "
"data, numerical/boolean constants "
Expand All @@ -3632,7 +3628,7 @@ def _visit_assign(self, node, node_target, op, dtype=None, is_return=False):
true_name, new_data = self.sdfg.add_scalar(true_name, ttype, transient=True, find_new_name=True)
self.variables[name] = true_name
defined_vars[name] = true_name
if any(result in x for x in [self.sdfg._pgrids, self.sdfg._rdistrarrays, self.sdfg._subarrays]):
if any(result in x for x in [self.sdfg.pgrids, self.sdfg.rdistrarrays, self.sdfg.subarrays]):
# NOTE: In previous versions some `pgrid` and subgrid related replacement function,
# see `dace/frontend/common/distr.py`, created dummy variables with the same name
# as the entities, such as process grids, they created. Thus the frontend was
Expand Down Expand Up @@ -4654,7 +4650,7 @@ def parse_target(t: Union[ast.Name, ast.Subscript]):
# Avoid cast of output pointers to scalars in code generation
for cname in outargs:
if (cname in self.sdfg.arrays and tuple(self.sdfg.arrays[cname].shape) == (1, )):
tasklet._out_connectors[f'__out_{cname}'] = dtypes.pointer(self.sdfg.arrays[cname].dtype)
tasklet.out_connectors[f'__out_{cname}'] = dtypes.pointer(self.sdfg.arrays[cname].dtype)

# Setup arguments in graph
for arg in dtypes.deduplicate(args):
Expand Down Expand Up @@ -5195,8 +5191,8 @@ def _gettype(self, opnode: ast.AST) -> List[Tuple[str, str]]:

result = []
for operand in operands:
if isinstance(operand, str) and operand in self.sdfg.process_grids:
result.append((operand, type(self.sdfg.process_grids[operand]).__name__))
if isinstance(operand, str) and operand in self.sdfg.pgrids:
result.append((operand, type(self.sdfg.pgrids[operand]).__name__))
elif isinstance(operand, str) and operand in self.sdfg.arrays:
result.append((operand, type(self.sdfg.arrays[operand])))
elif isinstance(operand, str) and operand in self.scope_arrays:
Expand Down
28 changes: 14 additions & 14 deletions dace/memlet.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,17 +207,17 @@ def __deepcopy__(self, memo):
node = object.__new__(Memlet)

# Immutable objects are: Python strings, integer, boolean but also SymPy expressions, i.e. symbols.
node._volume = self._volume
node._dynamic = self._dynamic
node._subset = dcpy(self._subset, memo=memo)
node._other_subset = dcpy(self._other_subset, memo=memo)
node._data = self._data
node._wcr = dcpy(self._wcr, memo=memo)
node._wcr_nonatomic = self._wcr_nonatomic
node._debuginfo = dcpy(self._debuginfo, memo=memo)
node._wcr_nonatomic = self._wcr_nonatomic
node._allow_oob = self._allow_oob
node._guid = generate_element_id(node)
node.volume = self.volume
node.dynamic = self.dynamic
node.subset = dcpy(self.subset, memo=memo)
node.other_subset = dcpy(self.other_subset, memo=memo)
node.data = self.data
node.wcr = dcpy(self.wcr, memo=memo)
node.wcr_nonatomic = self.wcr_nonatomic
node.debuginfo = dcpy(self.debuginfo, memo=memo)
node.wcr_nonatomic = self.wcr_nonatomic
node.allow_oob = self.allow_oob
node.guid = generate_element_id(node)

# TODO: Since we set the `.sdfg` and friends to `None` we should probably also set this to `None`.
node._is_data_src = self._is_data_src
Expand Down Expand Up @@ -305,7 +305,7 @@ def simple(data,
else:
result.volume = num_accesses
else:
result.volume = result._subset.num_elements()
result.volume = result.subset.num_elements()

if wcr_str is not None:
if isinstance(wcr_str, ast.AST):
Expand Down Expand Up @@ -413,10 +413,10 @@ def try_initialize(self, sdfg: 'dace.sdfg.SDFG', state: 'dace.sdfg.SDFGState',
is_data_src = False
is_data_dst = False
if isinstance(path[0].src, AccessNode):
if path[0].src.data == self._data:
if path[0].src.data == self.data:
is_data_src = True
if isinstance(path[-1].dst, AccessNode):
if path[-1].dst.data == self._data:
if path[-1].dst.data == self.data:
is_data_dst = True
if is_data_src and is_data_dst:
# In case both point to the same array,
Expand Down
2 changes: 1 addition & 1 deletion dace/optimization/data_layout_tuner.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def evaluate(self, config, cutout, arguments: Dict, measurements: int, **kwargs)
modified_arrays, new_arrays = config

# Modify data layout prior to calling
cutout._arrays = new_arrays
cutout.arrays = new_arrays
for marray in modified_arrays:
arguments[marray] = dt.make_array_from_descriptor(cutout.arrays[marray], arguments[marray])

Expand Down
Loading
Loading