diff --git a/dace/codegen/targets/cpu.py b/dace/codegen/targets/cpu.py index 163bbf933e..5eab35d384 100644 --- a/dace/codegen/targets/cpu.py +++ b/dace/codegen/targets/cpu.py @@ -1205,7 +1205,7 @@ def check_dace_defer(elements): elif isinstance(node, nodes.AccessNode): if dst_node != node and not isinstance(dst_node, nodes.Tasklet) : # If it is a size change, reallocate will be called - if edge.dst_conn is not None and edge.dst_conn == "IN_size": + if edge.dst_conn is not None and edge.dst_conn == "_write_size": continue dispatcher.dispatch_copy( @@ -2269,7 +2269,7 @@ def _generate_AccessNode(self, sdfg: SDFG, cfg: ControlFlowRegion, dfg: StateSub if memlet_path[-1].dst == node: src_node = memlet_path[0].src - if in_connector == "IN_size": + if in_connector == "_write_size": self._dispatcher.dispatch_reallocate( src_node, node, diff --git a/dace/codegen/targets/cuda.py b/dace/codegen/targets/cuda.py index d70bb4097d..1feef7ba11 100644 --- a/dace/codegen/targets/cuda.py +++ b/dace/codegen/targets/cuda.py @@ -1507,7 +1507,7 @@ def generate_scope(self, sdfg: SDFG, cfg: ControlFlowRegion, dfg_scope: StateSub const_params = _get_const_params(dfg_scope) # make dynamic map inputs constant # TODO move this into _get_const_params(dfg_scope) - # Do not add src as const if the size is being red (src_conn is OUT_size) + # Do not add src as const if the size is being red (src_conn is _read_size) const_params |= set((str(e.src)) for e in dace.sdfg.dynamic_map_inputs(state, scope_entry) if not e.src_conn.endswith("size")) # Store init/exit code streams diff --git a/dace/sdfg/sdfg.py b/dace/sdfg/sdfg.py index e8cfe3426e..3f49506ad9 100644 --- a/dace/sdfg/sdfg.py +++ b/dace/sdfg/sdfg.py @@ -1085,7 +1085,7 @@ def as_schedule_tree(self, in_place: bool = False) -> 'ScheduleTreeScope': the execution order of the SDFG. Each node in the tree can either represent a single statement (symbol assignment, tasklet, copy, library node, etc.) or a ``ScheduleTreeScope`` block (map, for-loop, pipeline, etc.) that contains other nodes. - + It can be used to generate code from an SDFG, or to perform schedule transformations on the SDFG. For example, erasing an empty if branch, or merging two consecutive for-loops. @@ -1753,20 +1753,21 @@ def add_array(self, if isinstance(dtype, type) and dtype in dtypes._CONSTANT_TYPES[:-1]: dtype = dtypes.typeclass(dtype) - size_desc = dt.Array(dtype=dace.uint64, - shape=(len(shape),), - storage=dtypes.StorageType.Default, - location=None, - allow_conflicts=False, - transient=True, - strides=(1,), - offset=(0,), - lifetime=lifetime, - alignment=alignment, - debuginfo=debuginfo, - total_size=len(shape), - may_alias=False, - size_desc_name=None) + if transient: + size_desc = dt.Array(dtype=dace.uint64, + shape=(len(shape),), + storage=dtypes.StorageType.Default, + location=None, + allow_conflicts=False, + transient=True, + strides=(1,), + offset=(0,), + lifetime=lifetime, + alignment=alignment, + debuginfo=debuginfo, + total_size=len(shape), + may_alias=False, + size_desc_name=None) desc = dt.Array(dtype=dtype, shape=shape, @@ -1784,11 +1785,12 @@ def add_array(self, size_desc_name=None) array_name = self.add_datadesc(name, desc, find_new_name=find_new_name) - size_desc_name = f"{array_name}_size" - self.add_datadesc(size_desc_name, size_desc, find_new_name=False) - # In case find_new_name and a new name is returned - # we need to update the size descriptor name of the array - desc.size_desc_name = size_desc_name + if transient: + size_desc_name = f"{array_name}_size" + self.add_datadesc(size_desc_name, size_desc, find_new_name=False) + # In case find_new_name and a new name is returned + # we need to update the size descriptor name of the array + desc.size_desc_name = size_desc_name return array_name, desc def add_view(self, @@ -2542,7 +2544,7 @@ def auto_optimize(self, """ Runs a basic sequence of transformations to optimize a given SDFG to decent performance. In particular, performs the following: - + * Simplify * Auto-parallelization (loop-to-map) * Greedy application of SubgraphFusion