Skip to content

Commit

Permalink
Change connector names
Browse files Browse the repository at this point in the history
  • Loading branch information
ThrudPrimrose committed Nov 20, 2024
1 parent c14b91e commit 506d0aa
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 24 deletions.
4 changes: 2 additions & 2 deletions dace/codegen/targets/cpu.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion dace/codegen/targets/cuda.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
44 changes: 23 additions & 21 deletions dace/sdfg/sdfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 506d0aa

Please sign in to comment.