Available Passes

Scalar-to-Symbol Promotion

Scalar to symbol promotion functionality.

class dace.transformation.passes.scalar_to_symbol.AttributedCallDetector

Bases: ast.NodeVisitor

Detects calls to functions that are attributes.

visit_Call(node: _ast.Call) → Any
class dace.transformation.passes.scalar_to_symbol.RemoveConstantAttributes

Bases: ast.NodeTransformer

Removes calls to functions that are attributes, if they point to a constant value for a cast.

visit_Call(node: _ast.Call) → Any
class dace.transformation.passes.scalar_to_symbol.ScalarToSymbolPromotion(ignore: Union[Set[str], NoneType] = None, transients_only: bool = True, integers_only: bool = True)

Bases: dace.transformation.pass_pipeline.Pass

apply_pass(sdfg: dace.sdfg.sdfg.SDFG, _: Dict[Any, Any]) → Set[str]

Promotes all matching transient scalars to SDFG symbols, changing all tasklets to inter-state assignments. This enables the transformed symbols to be used within states as part of memlets, and allows further transformations (such as loop detection) to use the information for optimization. :param sdfg: The SDFG to run the pass on. :param ignore: An optional set of strings of scalars to ignore. :param transients_only: If False, also considers global data descriptors (e.g., arguments). :param integers_only: If False, also considers non-integral descriptors for promotion. :return: Set of promoted scalars.

ignore = None
integers_only = True
modifies() → dace.transformation.pass_pipeline.Modifies

Which elements of the SDFG (e.g., memlets, state structure) are modified by this pass, if run successfully. :return: A Modifies set of flags of modified elements.

report(pass_retval: Set[str]) → str

Returns a user-readable string report based on the results of this pass. :param pass_retval: The return value from applying this pass. :return: A string with the user-readable report, or None if nothing to report.

transients_only = True
class dace.transformation.passes.scalar_to_symbol.TaskletIndirectionPromoter(in_edges: Dict[str, dace.memlet.Memlet], out_edges: Dict[str, dace.memlet.Memlet], sdfg: dace.sdfg.sdfg.SDFG, defined_syms: Set[str])

Bases: ast.NodeTransformer

Promotes indirect memory access in Tasklets to symbolic memlets. After visiting an AST, self.{in,out}_mapping will be filled with mappings from unique new connector names to sets of individual memlets.

visit_Subscript(node: _ast.Subscript) → Any
class dace.transformation.passes.scalar_to_symbol.TaskletPromoter(connector: str, symbol: str)

Bases: ast.NodeTransformer

Promotes scalars to symbols in Tasklets. If connector name is used in tasklet as subscript, modifies to symbol name. If connector is used as a standard name, modify tasklet code to use symbol.

visit_Name(node: _ast.Name) → Any
visit_Subscript(node: _ast.Subscript) → Any
class dace.transformation.passes.scalar_to_symbol.TaskletPromoterDict(conn_to_sym: Dict[str, str])

Bases: ast.NodeTransformer

Promotes scalars to symbols in Tasklets. If connector name is used in tasklet as subscript, modifies to symbol name. If connector is used as a standard name, modify tasklet code to use symbol.

visit_Name(node: _ast.Name) → Any
visit_Subscript(node: _ast.Subscript) → Any
dace.transformation.passes.scalar_to_symbol.find_promotable_scalars(sdfg: dace.sdfg.sdfg.SDFG, transients_only: bool = True, integers_only: bool = True) → Set[str]

Finds scalars that can be promoted to symbols in the given SDFG. Conditions for matching a scalar for symbol-promotion are as follows:

  • Size of data must be 1, it must not be a stream and must be transient.
  • Only inputs to candidate scalars must be either arrays or tasklets.
  • All tasklets that lead to it must have one statement, one output, and may have zero or more array inputs and not be in a scope.
  • Scalar must not be accessed with a write-conflict resolution.
  • Scalar must not be written to more than once in a state.
  • If scalar is not integral (i.e., int type), it must also appear in an inter-state condition to be promotable.

These conditions must apply on all occurences of the scalar in order for it to be promotable.

Parameters:
  • sdfg – The SDFG to query.
  • transients_only – If False, also considers global data descriptors (e.g., arguments).
  • integers_only – If False, also considers non-integral descriptors for promotion.
Returns:

A set of promotable scalar names.

dace.transformation.passes.scalar_to_symbol.promote_scalars_to_symbols(sdfg: dace.sdfg.sdfg.SDFG, ignore: Optional[Set[str]] = None, transients_only: bool = True, integers_only: bool = True) → Set[str]

DEPRECATED. Use pass directly instead. Promotes all matching transient scalars to SDFG symbols, changing all tasklets to inter-state assignments. This enables the transformed symbols to be used within states as part of memlets, and allows further transformations (such as loop detection) to use the information for optimization.

Parameters:
  • sdfg – The SDFG to run the pass on.
  • ignore – An optional set of strings of scalars to ignore.
  • transients_only – If False, also considers global data descriptors (e.g., arguments).
  • integers_only – If False, also considers non-integral descriptors for promotion.
Returns:

Set of promoted scalars.

Note:

Operates in-place.

dace.transformation.passes.scalar_to_symbol.remove_scalar_reads(sdfg: dace.sdfg.sdfg.SDFG, array_names: Dict[str, str])

Removes all instances of a promoted symbol’s read accesses in an SDFG. This removes each read-only access node as well as all of its descendant edges (in memlet trees) and connectors. Descends recursively to nested SDFGs and modifies tasklets (Python and C++). :param sdfg: The SDFG to operate on. :param array_names: Mapping between scalar names to replace and their

replacement symbol name.
Note:Operates in-place on the SDFG.
dace.transformation.passes.scalar_to_symbol.remove_symbol_indirection(sdfg: dace.sdfg.sdfg.SDFG)

Converts indirect memory accesses that involve only symbols into explicit memlets.

Parameters:sdfg – The SDFG to run the pass on.
Note:Operates in-place.
dace.transformation.passes.scalar_to_symbol.translate_cpp_tasklet_to_python(code: str)

Dead Memory Elimination and Merging

class dace.transformation.passes.array_elimination.ArrayElimination

Bases: dace.transformation.pass_pipeline.Pass

Merges and removes arrays and their corresponding accesses. This includes redundant array copies, unnecessary views, and duplicate access nodes.

apply_pass(sdfg: dace.sdfg.sdfg.SDFG, pipeline_results: Dict[str, Any]) → Optional[Set[str]]

Removes redundant arrays and access nodes. :param sdfg: The SDFG to modify. :param pipeline_results: If in the context of a Pipeline, a dictionary that is populated with prior Pass

results as {Pass subclass name: returned object from pass}. If not run in a pipeline, an empty dictionary is expected.
Returns:A set of removed data descriptor names, or None if nothing changed.
depends_on()

If in the context of a Pipeline, which other Passes need to run first. :return: A set of Pass subclasses or objects that need to run prior to this Pass.

merge_access_nodes(state: dace.sdfg.state.SDFGState, access_nodes: Dict[str, List[dace.sdfg.nodes.AccessNode]], condition: Callable[[dace.sdfg.nodes.AccessNode], bool])

Merges access nodes that follow the same conditions together to the first access node.

modifies() → dace.transformation.pass_pipeline.Modifies

Which elements of the SDFG (e.g., memlets, state structure) are modified by this pass, if run successfully. :return: A Modifies set of flags of modified elements.

remove_redundant_copies(sdfg: dace.sdfg.sdfg.SDFG, state: dace.sdfg.state.SDFGState, removable_data: Set[str], access_nodes: Dict[str, List[dace.sdfg.nodes.AccessNode]])

Removes access nodes that represent redundant copies and/or views.

report(pass_retval: Set[str]) → str

Returns a user-readable string report based on the results of this pass. :param pass_retval: The return value from applying this pass. :return: A string with the user-readable report, or None if nothing to report.

should_reapply(modified: dace.transformation.pass_pipeline.Modifies) → bool

In the context of a Pipeline, queries whether this Pass should be rerun after other passes have run and modified the SDFG. :param modified: Flags specifying which elements of the SDFG were modified. :return: True if this Pass should be rerun when the given elements are modified.

class dace.transformation.passes.transient_reuse.TransientReuse

Bases: dace.transformation.pass_pipeline.Pass

Reduces memory consumption by reusing allocated transient array memory. Only modifies arrays that can safely be reused.

apply_pass(sdfg: dace.sdfg.sdfg.SDFG, _) → Optional[Set[str]]

Applies the pass to the given SDFG. :param sdfg: The SDFG to apply the pass to. :param pipeline_results: If in the context of a Pipeline, a dictionary that is populated with prior Pass

results as {Pass subclass name: returned object from pass}. If not run in a pipeline, an empty dictionary is expected.
Returns:Some object if pass was applied, or None if nothing changed.
modifies() → dace.transformation.pass_pipeline.Modifies

Which elements of the SDFG (e.g., memlets, state structure) are modified by this pass, if run successfully. :return: A Modifies set of flags of modified elements.

should_reapply(modified: dace.transformation.pass_pipeline.Modifies) → bool

In the context of a Pipeline, queries whether this Pass should be rerun after other passes have run and modified the SDFG. :param modified: Flags specifying which elements of the SDFG were modified. :return: True if this Pass should be rerun when the given elements are modified.

Dead Code Elimination

class dace.transformation.passes.dead_state_elimination.DeadStateElimination

Bases: dace.transformation.pass_pipeline.Pass

Removes all unreachable states (e.g., due to a branch that will never be taken) from an SDFG.

apply_pass(sdfg: dace.sdfg.sdfg.SDFG, _) → Optional[Set[Union[dace.sdfg.state.SDFGState, dace.sdfg.graph.Edge[dace.sdfg.sdfg.InterstateEdge][dace.sdfg.sdfg.InterstateEdge]]]]

Removes unreachable states throughout an SDFG. :param sdfg: The SDFG to modify. :param pipeline_results: If in the context of a Pipeline, a dictionary that is populated with prior Pass

results as {Pass subclass name: returned object from pass}. If not run in a pipeline, an empty dictionary is expected.
Parameters:initial_symbols – If not None, sets values of initial symbols.
Returns:A set of the removed states, or None if nothing was changed.
find_dead_states(sdfg: dace.sdfg.sdfg.SDFG, set_unconditional_edges: bool = True) → Tuple[Set[dace.sdfg.state.SDFGState], Set[dace.sdfg.graph.Edge[dace.sdfg.sdfg.InterstateEdge][dace.sdfg.sdfg.InterstateEdge]], bool]
Finds “dead” (unreachable) states in an SDFG. A state is deemed unreachable if it is:
  • Unreachable from the starting state
  • Conditions leading to it will always evaluate to False
  • There is another unconditional (always True) inter-state edge that leads to another state
Parameters:
  • sdfg – The SDFG to traverse.
  • set_unconditional_edges – If True, conditions of edges evaluated as unconditional are removed.
Returns:

A 3-tuple of (unreachable states, unreachable edges, were edges annotated).

is_definitely_not_taken(edge: dace.sdfg.sdfg.InterstateEdge, sdfg: dace.sdfg.sdfg.SDFG) → bool

Returns True iff edge condition definitely evaluates to False.

is_definitely_taken(edge: dace.sdfg.sdfg.InterstateEdge, sdfg: dace.sdfg.sdfg.SDFG) → bool

Returns True iff edge condition definitely evaluates to True.

modifies() → dace.transformation.pass_pipeline.Modifies

Which elements of the SDFG (e.g., memlets, state structure) are modified by this pass, if run successfully. :return: A Modifies set of flags of modified elements.

report(pass_retval: Set[Union[dace.sdfg.state.SDFGState, dace.sdfg.graph.Edge[dace.sdfg.sdfg.InterstateEdge][dace.sdfg.sdfg.InterstateEdge]]]) → str

Returns a user-readable string report based on the results of this pass. :param pass_retval: The return value from applying this pass. :return: A string with the user-readable report, or None if nothing to report.

should_reapply(modified: dace.transformation.pass_pipeline.Modifies) → bool

In the context of a Pipeline, queries whether this Pass should be rerun after other passes have run and modified the SDFG. :param modified: Flags specifying which elements of the SDFG were modified. :return: True if this Pass should be rerun when the given elements are modified.

class dace.transformation.passes.dead_dataflow_elimination.DeadDataflowElimination(skip_library_nodes: bool = False, remove_persistent_memory: bool = False)

Bases: dace.transformation.pass_pipeline.Pass

Removes unused computations from SDFG states. Traverses the graph backwards, removing any computations that result in transient descriptors that are not used again. Removal propagates through scopes (maps), tasklets, and optionally library nodes.

apply_pass(sdfg: dace.sdfg.sdfg.SDFG, pipeline_results: Dict[str, Any]) → Optional[Dict[dace.sdfg.state.SDFGState, Set[str]]]

Removes unreachable dataflow throughout SDFG states. :param sdfg: The SDFG to modify. :param pipeline_results: If in the context of a Pipeline, a dictionary that is populated with prior Pass

results as {Pass subclass name: returned object from pass}. If not run in a pipeline, an empty dictionary is expected.
Returns:A dictionary mapping states to removed data descriptor names, or None if nothing changed.
depends_on() → Set[Type[dace.transformation.pass_pipeline.Pass]]

If in the context of a Pipeline, which other Passes need to run first. :return: A set of Pass subclasses or objects that need to run prior to this Pass.

modifies() → dace.transformation.pass_pipeline.Modifies

Which elements of the SDFG (e.g., memlets, state structure) are modified by this pass, if run successfully. :return: A Modifies set of flags of modified elements.

remove_persistent_memory = False

If True, marks code with Persistent allocation lifetime as dead

report(pass_retval: Dict[dace.sdfg.state.SDFGState, Set[str]]) → str

Returns a user-readable string report based on the results of this pass. :param pass_retval: The return value from applying this pass. :return: A string with the user-readable report, or None if nothing to report.

should_reapply(modified: dace.transformation.pass_pipeline.Modifies) → bool

In the context of a Pipeline, queries whether this Pass should be rerun after other passes have run and modified the SDFG. :param modified: Flags specifying which elements of the SDFG were modified. :return: True if this Pass should be rerun when the given elements are modified.

skip_library_nodes = False

If True, does not remove library nodes if their results are unused. Otherwise removes library nodes without side effects.

dace.transformation.passes.dead_dataflow_elimination.PROTECTED_NAMES = {'__pystate'}

A set of names that are not allowed to be erased

class dace.transformation.passes.prune_symbols.RemoveUnusedSymbols(recursive: bool = True)

Bases: dace.transformation.pass_pipeline.Pass

Prunes unused symbols from the SDFG symbol repository (sdfg.symbols). Also includes uses in Tasklets of all languages.

apply_pass(sdfg: dace.sdfg.sdfg.SDFG, _) → Optional[Set[Tuple[int, str]]]

Propagates constants throughout the SDFG. :param sdfg: The SDFG to modify. :param pipeline_results: If in the context of a Pipeline, a dictionary that is populated with prior Pass

results as {Pass subclass name: returned object from pass}. If not run in a pipeline, an empty dictionary is expected.
Parameters:initial_symbols – If not None, sets values of initial symbols.
Returns:A set of propagated constants, or None if nothing was changed.
modifies() → dace.transformation.pass_pipeline.Modifies

Which elements of the SDFG (e.g., memlets, state structure) are modified by this pass, if run successfully. :return: A Modifies set of flags of modified elements.

recursive = True
report(pass_retval: Set[str]) → str

Returns a user-readable string report based on the results of this pass. :param pass_retval: The return value from applying this pass. :return: A string with the user-readable report, or None if nothing to report.

should_reapply(modified: dace.transformation.pass_pipeline.Modifies) → bool

In the context of a Pipeline, queries whether this Pass should be rerun after other passes have run and modified the SDFG. :param modified: Flags specifying which elements of the SDFG were modified. :return: True if this Pass should be rerun when the given elements are modified.

used_symbols(sdfg: dace.sdfg.sdfg.SDFG) → Set[str]

Constant Propagation

class dace.transformation.passes.constant_propagation.ConstantPropagation(recursive: bool = True, progress: Optional[bool] = None)

Bases: dace.transformation.pass_pipeline.Pass

Propagates constants and symbols that were assigned to one value forward through the SDFG, reducing the number of overall symbols.

apply_pass(sdfg: dace.sdfg.sdfg.SDFG, _, initial_symbols: Optional[Dict[str, Any]] = None) → Optional[Set[str]]

Propagates constants throughout the SDFG. :param sdfg: The SDFG to modify. :param pipeline_results: If in the context of a Pipeline, a dictionary that is populated with prior Pass

results as {Pass subclass name: returned object from pass}. If not run in a pipeline, an empty dictionary is expected.
Parameters:initial_symbols – If not None, sets values of initial symbols.
Returns:A set of propagated constants, or None if nothing was changed.
collect_constants(sdfg: dace.sdfg.sdfg.SDFG, initial_symbols: Optional[Dict[str, Any]] = None) → Dict[dace.sdfg.state.SDFGState, Dict[str, Any]]

Finds all constants and constant-assigned symbols in the SDFG for each state. :param sdfg: The SDFG to traverse. :param initial_symbols: If not None, sets values of initial symbols. :return: A dictionary mapping an SDFG state to a mapping of constants and their corresponding values.

modifies() → dace.transformation.pass_pipeline.Modifies

Which elements of the SDFG (e.g., memlets, state structure) are modified by this pass, if run successfully. :return: A Modifies set of flags of modified elements.

progress = None
recursive = True
report(pass_retval: Set[str]) → str

Returns a user-readable string report based on the results of this pass. :param pass_retval: The return value from applying this pass. :return: A string with the user-readable report, or None if nothing to report.

should_apply(sdfg: dace.sdfg.sdfg.SDFG) → bool

Fast check (O(m)) whether the pass should early-exit without traversing the SDFG.

should_reapply(modified: dace.transformation.pass_pipeline.Modifies) → bool

In the context of a Pipeline, queries whether this Pass should be rerun after other passes have run and modified the SDFG. :param modified: Flags specifying which elements of the SDFG were modified. :return: True if this Pass should be rerun when the given elements are modified.

class dace.transformation.passes.optional_arrays.OptionalArrayInference

Bases: dace.transformation.pass_pipeline.Pass

Infers the optional property of arrays, i.e., if they can be given None, throughout the SDFG and all nested SDFGs.

An array will be modified to optional if its previous optional property was set to None and: * it is transient; * it is in a nested SDFG and its parent array was transient; or * it is definitely (unconditionally) read or written in the SDFG.

apply_pass(sdfg: dace.sdfg.sdfg.SDFG, _, parent_arrays: Optional[Dict[str, bool]] = None) → Optional[Set[Tuple[int, str]]]

Infers the optional property of arrays in the SDFG and its nested SDFGs. :param sdfg: The SDFG to modify. :param pipeline_results: If in the context of a Pipeline, a dictionary that is populated with prior Pass

results as {Pass subclass name: returned object from pass}. If not run in a pipeline, an empty dictionary is expected.
Parameters:parent_arrays – If not None, contains values of determined arrays from the parent SDFG.
Returns:A set of the modified array names as a 2-tuple (SDFG ID, name), or None if nothing was changed.
modifies() → dace.transformation.pass_pipeline.Modifies

Which elements of the SDFG (e.g., memlets, state structure) are modified by this pass, if run successfully. :return: A Modifies set of flags of modified elements.

report(pass_retval: Set[Tuple[int, str]]) → str

Returns a user-readable string report based on the results of this pass. :param pass_retval: The return value from applying this pass. :return: A string with the user-readable report, or None if nothing to report.

should_reapply(modified: dace.transformation.pass_pipeline.Modifies) → bool

In the context of a Pipeline, queries whether this Pass should be rerun after other passes have run and modified the SDFG. :param modified: Flags specifying which elements of the SDFG were modified. :return: True if this Pass should be rerun when the given elements are modified.

traverse_unconditional_states(sdfg: dace.sdfg.sdfg.SDFG) → Iterator[dace.sdfg.state.SDFGState]

Traverse SDFG and keep track of whether the state is executed unconditionally.

Memlet Consolidation

class dace.transformation.passes.consolidate_edges.ConsolidateEdges

Bases: dace.transformation.pass_pipeline.Pass

Removes extraneous edges with memlets that refer to the same data containers within the same scope.

Memlet subsets are unioned in each scope. This effectively reduces the number of connectors and allows more transformations to be performed, at the cost of losing the individual per-tasklet memlets.

apply_pass(sdfg: dace.sdfg.sdfg.SDFG, _) → Optional[int]

Consolidates edges on the given SDFG. :param sdfg: The SDFG to modify. :param pipeline_results: If in the context of a Pipeline, a dictionary that is populated with prior Pass

results as {Pass subclass name: returned object from pass}. If not run in a pipeline, an empty dictionary is expected.
Returns:Number of edges removed, or None if nothing was performed.
modifies() → dace.transformation.pass_pipeline.Modifies

Which elements of the SDFG (e.g., memlets, state structure) are modified by this pass, if run successfully. :return: A Modifies set of flags of modified elements.

report(pass_retval: int) → str

Returns a user-readable string report based on the results of this pass. :param pass_retval: The return value from applying this pass. :return: A string with the user-readable report, or None if nothing to report.

should_reapply(modified: dace.transformation.pass_pipeline.Modifies) → bool

In the context of a Pipeline, queries whether this Pass should be rerun after other passes have run and modified the SDFG. :param modified: Flags specifying which elements of the SDFG were modified. :return: True if this Pass should be rerun when the given elements are modified.

State Fusion and SDFG Inlining

Contains implementations of SDFG inlining and state fusion passes.

class dace.transformation.passes.fusion_inline.FuseStates(permissive: bool = False, progress: Optional[bool] = None)

Bases: dace.transformation.pass_pipeline.Pass

Fuses all possible states of an SDFG (and all sub-SDFGs).

apply_pass(sdfg: dace.sdfg.sdfg.SDFG, _: Dict[str, Any]) → Optional[int]

Fuses all possible states of an SDFG (and all sub-SDFGs). :param sdfg: The SDFG to transform.

Returns:The total number of states fused, or None if did not apply.
modifies() → dace.transformation.pass_pipeline.Modifies

Which elements of the SDFG (e.g., memlets, state structure) are modified by this pass, if run successfully. :return: A Modifies set of flags of modified elements.

permissive = False

If True, ignores some race conditions checks

progress = None

Whether to print progress, or None for default (print after 5 seconds)

report(pass_retval: int) → str

Returns a user-readable string report based on the results of this pass. :param pass_retval: The return value from applying this pass. :return: A string with the user-readable report, or None if nothing to report.

should_reapply(modified: dace.transformation.pass_pipeline.Modifies) → bool

In the context of a Pipeline, queries whether this Pass should be rerun after other passes have run and modified the SDFG. :param modified: Flags specifying which elements of the SDFG were modified. :return: True if this Pass should be rerun when the given elements are modified.

class dace.transformation.passes.fusion_inline.InlineSDFGs(permissive: bool = False, progress: Optional[bool] = None, multistate: bool = True)

Bases: dace.transformation.pass_pipeline.Pass

Inlines all possible nested SDFGs (and sub-SDFGs).

apply_pass(sdfg: dace.sdfg.sdfg.SDFG, _: Dict[str, Any]) → Optional[int]

Fuses all possible states of an SDFG (and all sub-SDFGs). :param sdfg: The SDFG to transform.

Returns:The total number of states fused, or None if did not apply.
modifies() → dace.transformation.pass_pipeline.Modifies

Which elements of the SDFG (e.g., memlets, state structure) are modified by this pass, if run successfully. :return: A Modifies set of flags of modified elements.

multistate = True

If True, include multi-state inlining

permissive = False

If True, ignores some checks on inlining

progress = None

Whether to print progress, or None for default (print after 5 seconds)

report(pass_retval: int) → str

Returns a user-readable string report based on the results of this pass. :param pass_retval: The return value from applying this pass. :return: A string with the user-readable report, or None if nothing to report.

should_reapply(modified: dace.transformation.pass_pipeline.Modifies) → bool

In the context of a Pipeline, queries whether this Pass should be rerun after other passes have run and modified the SDFG. :param modified: Flags specifying which elements of the SDFG were modified. :return: True if this Pass should be rerun when the given elements are modified.

Analysis Passes

class dace.transformation.passes.analysis.AccessSets

Bases: dace.transformation.pass_pipeline.Pass

Evaluates memory access sets (which arrays/data descriptors are read/written in each state).

apply_pass(top_sdfg: dace.sdfg.sdfg.SDFG, _) → Dict[int, Dict[dace.sdfg.state.SDFGState, Tuple[Set[str], Set[str]]]]
Returns:A dictionary mapping each state to a tuple of its (read, written) data descriptors.
modifies() → dace.transformation.pass_pipeline.Modifies

Which elements of the SDFG (e.g., memlets, state structure) are modified by this pass, if run successfully. :return: A Modifies set of flags of modified elements.

should_reapply(modified: dace.transformation.pass_pipeline.Modifies) → bool

In the context of a Pipeline, queries whether this Pass should be rerun after other passes have run and modified the SDFG. :param modified: Flags specifying which elements of the SDFG were modified. :return: True if this Pass should be rerun when the given elements are modified.

class dace.transformation.passes.analysis.FindAccessNodes

Bases: dace.transformation.pass_pipeline.Pass

For each data descriptor, creates a set of states in which access nodes of that data are used.

apply_pass(top_sdfg: dace.sdfg.sdfg.SDFG, _) → Dict[int, Dict[str, Set[dace.sdfg.state.SDFGState]]]
Returns:A dictionary mapping each data descriptor name to states where it can be found in.
modifies() → dace.transformation.pass_pipeline.Modifies

Which elements of the SDFG (e.g., memlets, state structure) are modified by this pass, if run successfully. :return: A Modifies set of flags of modified elements.

should_reapply(modified: dace.transformation.pass_pipeline.Modifies) → bool

In the context of a Pipeline, queries whether this Pass should be rerun after other passes have run and modified the SDFG. :param modified: Flags specifying which elements of the SDFG were modified. :return: True if this Pass should be rerun when the given elements are modified.

class dace.transformation.passes.analysis.StateReachability

Bases: dace.transformation.pass_pipeline.Pass

Evaluates state reachability (which other states can be executed after each state).

apply_pass(top_sdfg: dace.sdfg.sdfg.SDFG, _) → Dict[int, Dict[dace.sdfg.state.SDFGState, Set[dace.sdfg.state.SDFGState]]]
Returns:A dictionary mapping each state to its other reachable states.
modifies() → dace.transformation.pass_pipeline.Modifies

Which elements of the SDFG (e.g., memlets, state structure) are modified by this pass, if run successfully. :return: A Modifies set of flags of modified elements.

should_reapply(modified: dace.transformation.pass_pipeline.Modifies) → bool

In the context of a Pipeline, queries whether this Pass should be rerun after other passes have run and modified the SDFG. :param modified: Flags specifying which elements of the SDFG were modified. :return: True if this Pass should be rerun when the given elements are modified.

The Simplify Pass Pipeline

class dace.transformation.passes.simplify.SimplifyPass(validate: bool = False, validate_all: bool = False, skip: Union[Set[str], NoneType] = None, verbose: bool = False)

Bases: dace.transformation.pass_pipeline.FixedPointPipeline

apply_pass(sdfg: dace.sdfg.sdfg.SDFG, pipeline_results: Dict[str, Any]) → Optional[Dict[str, Any]]

Applies the pipeline to the SDFG in repeated succession until the SDFG is no longer modified. :param sdfg: The SDFG to apply the pass to. :param pipeline_results: If in the context of a Pipeline, a dictionary that is populated with prior Pass

results as {Pass subclass name: returned object from pass}. If not run in a pipeline, an empty dictionary is expected.
Returns:A dictionary of {Pass subclass name: return value} for applied passes, or None if no Passes were applied in the context of this pipeline.
apply_subpass(sdfg: dace.sdfg.sdfg.SDFG, p: dace.transformation.pass_pipeline.Pass, state: Dict[str, Any])

Apply a pass from the pipeline. This method is meant to be overridden by subclasses.

skip = None

Names of passes to skip in this pipeline

validate = False

Whether to validate the SDFG at the end of the pipeline

validate_all = False

Whether to validate the SDFG after each pass

verbose = False

Whether to print reports after every pass

Module contents