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

Remove schedule property from NestedSDFG #1318

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
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
7 changes: 1 addition & 6 deletions dace/codegen/targets/cpu.py
Original file line number Diff line number Diff line change
Expand Up @@ -1682,16 +1682,11 @@ def _generate_NestedSDFG(
if not inline:
self._frame.generate_constants(node.sdfg, nested_stream)

old_schedule = self._toplevel_schedule
self._toplevel_schedule = node.schedule

# Generate code for internal SDFG
global_code, local_code, used_targets, used_environments = self._frame.generate_code(
node.sdfg, node.schedule, sdfg_label)
node.sdfg, self._toplevel_schedule, sdfg_label)
self._dispatcher._used_environments |= used_environments

self._toplevel_schedule = old_schedule

nested_stream.write(local_code)

# Process outgoing memlets with the internal SDFG
Expand Down
5 changes: 1 addition & 4 deletions dace/sdfg/infer_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,6 @@ def set_default_schedule_and_storage_types(scope: Union[SDFG, SDFGState, nodes.E
nscope = nnode.sdfg
child_nodes = None
extra_parent_schedules = []
# TODO(later): Remove GPU_Default
if nnode.schedule == dtypes.ScheduleType.GPU_Default:
extra_parent_schedules.append(nnode.schedule)
else:
nscope = nnode
extra_parent_schedules = [nnode.schedule]
Expand Down Expand Up @@ -303,7 +300,7 @@ def _set_default_schedule_in_scope(state: SDFGState,
# Set child schedule type in scope
for node in child_nodes[parent_node]:
# Set default schedule types
if isinstance(node, (nodes.EntryNode, nodes.NestedSDFG)):
if isinstance(node, nodes.EntryNode):
nested_scopes.append(node)
if node.schedule == dtypes.ScheduleType.Default:
# If parent schedules do not determine child schedule,
Expand Down
6 changes: 0 additions & 6 deletions dace/sdfg/nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -520,10 +520,6 @@ class NestedSDFG(CodeNode):

# NOTE: We cannot use SDFG as the type because of an import loop
sdfg = SDFGReferenceProperty(desc="The SDFG", allow_none=True)
schedule = EnumProperty(dtype=dtypes.ScheduleType,
desc="SDFG schedule",
allow_none=True,
default=dtypes.ScheduleType.Default)
symbol_mapping = DictProperty(key_type=str,
value_type=dace.symbolic.pystr_to_symbolic,
desc="Mapping between internal symbols and their values, expressed as "
Expand All @@ -548,7 +544,6 @@ def __init__(self,
inputs: Set[str],
outputs: Set[str],
symbol_mapping: Dict[str, Any] = None,
schedule=dtypes.ScheduleType.Default,
location=None,
debuginfo=None):
from dace.sdfg import SDFG
Expand All @@ -557,7 +552,6 @@ def __init__(self,
# Properties
self.sdfg: SDFG = sdfg
self.symbol_mapping = symbol_mapping or {}
self.schedule = schedule
self.debuginfo = debuginfo

def __deepcopy__(self, memo):
Expand Down
2 changes: 0 additions & 2 deletions dace/sdfg/scope.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,6 @@ def is_in_scope(sdfg: 'dace.sdfg.SDFG', state: 'dace.sdfg.SDFGState', node: Node
parent = sdfg.parent_sdfg
state = sdfg.parent
node = sdfg.parent_nsdfg_node
if node.schedule in schedules:
return True
else:
parent = sdfg.parent
sdfg = parent
Expand Down
2 changes: 0 additions & 2 deletions dace/sdfg/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -1162,7 +1162,6 @@ def add_nested_sdfg(
outputs: Union[Set[str], Dict[str, dtypes.typeclass]],
symbol_mapping: Dict[str, Any] = None,
name=None,
schedule=dtypes.ScheduleType.Default,
location=None,
debuginfo=None,
):
Expand All @@ -1188,7 +1187,6 @@ def add_nested_sdfg(
inputs,
outputs,
symbol_mapping=symbol_mapping,
schedule=schedule,
location=location,
debuginfo=debuginfo,
)
Expand Down
1 change: 0 additions & 1 deletion dace/transformation/dataflow/reduce_expansion.py
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,6 @@ def _expand_reduce(self, sdfg, state, node):
sdfg,
node.in_connectors,
node.out_connectors,
schedule=node.schedule,
name=node.name)

utils.change_edge_dest(state, node, nsdfg)
Expand Down
6 changes: 2 additions & 4 deletions dace/transformation/interstate/multistate_inline.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,6 @@ def can_be_applied(self, state: SDFGState, expr_index, sdfg, permissive=False):
nested_sdfg = self.nested_sdfg
if nested_sdfg.no_inline:
return False
if nested_sdfg.schedule == dtypes.ScheduleType.FPGA_Device:
return False

# Ensure the state only contains a nested SDFG and input/output access
# nodes
Expand Down Expand Up @@ -143,8 +141,8 @@ def apply(self, outer_state: SDFGState, sdfg: SDFG):
nsdfg_node = self.nested_sdfg
nsdfg: SDFG = nsdfg_node.sdfg

if nsdfg_node.schedule != dtypes.ScheduleType.Default:
infer_types.set_default_schedule_and_storage_types(nsdfg, [nsdfg_node.schedule])
# TODO: Enable this one if necessary
#infer_types.set_default_schedule_and_storage_types(nsdfg, [nsdfg_node.schedule])

#######################################################
# Collect and update top-level SDFG metadata
Expand Down
4 changes: 2 additions & 2 deletions dace/transformation/interstate/sdfg_nesting.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,8 @@ def apply(self, state: SDFGState, sdfg: SDFG):
nsdfg: SDFG = nsdfg_node.sdfg
nstate: SDFGState = nsdfg.nodes()[0]

if nsdfg_node.schedule != dtypes.ScheduleType.Default:
infer_types.set_default_schedule_and_storage_types(nsdfg, [nsdfg_node.schedule])
# TODO: Enable this one if necessary
#infer_types.set_default_schedule_and_storage_types(nsdfg, [nsdfg_node.schedule])

nsdfg_scope_entry = state.entry_node(nsdfg_node)
nsdfg_scope_exit = (state.exit_node(nsdfg_scope_entry) if nsdfg_scope_entry is not None else None)
Expand Down
6 changes: 1 addition & 5 deletions dace/transformation/transformation.py
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,6 @@ def apply(self, state, sdfg, *args, **kwargs):
node.in_connectors,
node.out_connectors,
name=node.name,
schedule=node.schedule,
debuginfo=node.debuginfo)
elif isinstance(expansion, nd.CodeNode):
expansion.debuginfo = node.debuginfo
Expand All @@ -618,9 +617,6 @@ def apply(self, state, sdfg, *args, **kwargs):
nsdfg.update_sdfg_list([])
nsdfg.parent_nsdfg_node = expansion

# Update schedule to match library node schedule
nsdfg.schedule = node.schedule

elif isinstance(expansion, (nd.EntryNode, nd.LibraryNode)):
if expansion.schedule is ScheduleType.Default:
expansion.schedule = node.schedule
Expand All @@ -634,7 +630,7 @@ def apply(self, state, sdfg, *args, **kwargs):

# Fix nested schedules
if isinstance(expansion, nd.NestedSDFG):
infer_types.set_default_schedule_and_storage_types(expansion.sdfg, [expansion.schedule], True)
infer_types.set_default_schedule_and_storage_types(expansion.sdfg, [], True)

type(self).postprocessing(sdfg, state, expansion)

Expand Down
Loading