dace.transformation.dataflow package¶
Submodules¶
dace.transformation.dataflow.copy_to_device module¶
Contains classes and functions that implement copying a nested SDFG and its dependencies to a given device.
-
class
dace.transformation.dataflow.copy_to_device.
CopyToDevice
(*args, **kwargs)¶ Bases:
dace.transformation.transformation.SingleStateTransformation
Implements the copy-to-device transformation, which copies a nested SDFG and its dependencies to a given device.
The transformation changes all data storage types of a nested SDFG to the given storage property, and creates new arrays and copies around the nested SDFG to that storage.
-
static
annotates_memlets
()¶ Indicates whether the transformation annotates the edges it creates or modifies with the appropriate memlets. This determines whether to apply memlet propagation after the transformation.
-
apply
(state, sdfg)¶ Applies this transformation instance on the matched pattern graph. :param sdfg: The SDFG to apply the transformation to. :return: A transformation-defined return value, which could be used
to pass analysis data out, or nothing.
-
can_be_applied
(graph, expr_index, sdfg, permissive=False)¶ Returns True if this transformation can be applied on the candidate matched subgraph. :param graph: SDFGState object in which the match was found. :param candidate: A mapping between node IDs returned from
PatternTransformation.expressions
and the nodes ingraph
.Parameters: - expr_index – The list index from
PatternTransformation.expressions
that was matched. - sdfg – The parent SDFG of the matched state.
- permissive – Whether transformation should run in permissive mode.
Returns: True if the transformation can be applied.
- expr_index – The list index from
-
classmethod
expressions
()¶ Returns a list of SDFG state subgraphs that will be matched in the subgraph isomorphism phase. Used as a pre-pass before calling
can_be_applied
.
-
nested_sdfg
¶ Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of
PatternTransformation
to represent the subgraph patterns.Example use: ``` class MyTransformation(SingleStateTransformation):
some_map_node = PatternNode(nodes.MapEntry) array = PatternNode(nodes.AccessNode)The two nodes can then be used in the transformation static methods (e.g.,
expressions
,can_be_applied
) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.
-
properties
()¶
-
storage
¶ Nested SDFG storage
-
static
-
dace.transformation.dataflow.copy_to_device.
change_storage
(sdfg, storage)¶
dace.transformation.dataflow.double_buffering module¶
Contains classes that implement the double buffering pattern.
-
class
dace.transformation.dataflow.double_buffering.
DoubleBuffering
(*args, **kwargs)¶ Bases:
dace.transformation.transformation.SingleStateTransformation
Implements the double buffering pattern, which pipelines reading and processing data by creating a second copy of the memory. In particular, the transformation takes a 1D map and all internal (directly connected) transients, adds an additional dimension of size 2, and turns the map into a for loop that processes and reads the data in a double-buffered manner. Other memlets will not be transformed.
-
apply
(graph: dace.sdfg.state.SDFGState, sdfg: dace.sdfg.sdfg.SDFG)¶ Applies this transformation instance on the matched pattern graph. :param sdfg: The SDFG to apply the transformation to. :return: A transformation-defined return value, which could be used
to pass analysis data out, or nothing.
-
can_be_applied
(graph, expr_index, sdfg, permissive=False)¶ Returns True if this transformation can be applied on the candidate matched subgraph. :param graph: SDFGState object in which the match was found. :param candidate: A mapping between node IDs returned from
PatternTransformation.expressions
and the nodes ingraph
.Parameters: - expr_index – The list index from
PatternTransformation.expressions
that was matched. - sdfg – The parent SDFG of the matched state.
- permissive – Whether transformation should run in permissive mode.
Returns: True if the transformation can be applied.
- expr_index – The list index from
-
classmethod
expressions
()¶ Returns a list of SDFG state subgraphs that will be matched in the subgraph isomorphism phase. Used as a pre-pass before calling
can_be_applied
.
-
map_entry
¶ Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of
PatternTransformation
to represent the subgraph patterns.Example use: ``` class MyTransformation(SingleStateTransformation):
some_map_node = PatternNode(nodes.MapEntry) array = PatternNode(nodes.AccessNode)The two nodes can then be used in the transformation static methods (e.g.,
expressions
,can_be_applied
) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.
-
transient
¶ Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of
PatternTransformation
to represent the subgraph patterns.Example use: ``` class MyTransformation(SingleStateTransformation):
some_map_node = PatternNode(nodes.MapEntry) array = PatternNode(nodes.AccessNode)The two nodes can then be used in the transformation static methods (e.g.,
expressions
,can_be_applied
) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.
-
dace.transformation.dataflow.gpu_transform module¶
Contains the GPU Transform Map transformation.
-
class
dace.transformation.dataflow.gpu_transform.
GPUTransformMap
(*args, **kwargs)¶ Bases:
dace.transformation.transformation.SingleStateTransformation
Implements the GPUTransformMap transformation.
Converts a single map to a GPU-scheduled map and creates GPU arrays outside it, generating CPU<->GPU memory copies automatically.
-
apply
(graph: dace.sdfg.state.SDFGState, sdfg: dace.sdfg.sdfg.SDFG)¶ Applies this transformation instance on the matched pattern graph. :param sdfg: The SDFG to apply the transformation to. :return: A transformation-defined return value, which could be used
to pass analysis data out, or nothing.
-
can_be_applied
(graph, expr_index, sdfg, permissive=False)¶ Returns True if this transformation can be applied on the candidate matched subgraph. :param graph: SDFGState object in which the match was found. :param candidate: A mapping between node IDs returned from
PatternTransformation.expressions
and the nodes ingraph
.Parameters: - expr_index – The list index from
PatternTransformation.expressions
that was matched. - sdfg – The parent SDFG of the matched state.
- permissive – Whether transformation should run in permissive mode.
Returns: True if the transformation can be applied.
- expr_index – The list index from
-
classmethod
expressions
()¶ Returns a list of SDFG state subgraphs that will be matched in the subgraph isomorphism phase. Used as a pre-pass before calling
can_be_applied
.
-
fullcopy
¶ Copy whole arrays rather than used subset
-
map_entry
¶ Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of
PatternTransformation
to represent the subgraph patterns.Example use: ``` class MyTransformation(SingleStateTransformation):
some_map_node = PatternNode(nodes.MapEntry) array = PatternNode(nodes.AccessNode)The two nodes can then be used in the transformation static methods (e.g.,
expressions
,can_be_applied
) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.
-
match_to_str
(graph)¶ Returns a string representation of the pattern match on the candidate subgraph. Used when identifying matches in the console UI.
-
properties
()¶
-
reduce
¶ Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of
PatternTransformation
to represent the subgraph patterns.Example use: ``` class MyTransformation(SingleStateTransformation):
some_map_node = PatternNode(nodes.MapEntry) array = PatternNode(nodes.AccessNode)The two nodes can then be used in the transformation static methods (e.g.,
expressions
,can_be_applied
) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.
-
register_trans
¶ Make all transients inside GPU maps registers
-
sequential_innermaps
¶ Make all internal maps Sequential
-
stdlib
= <module 'dace.libraries.standard' from '/home/docs/checkouts/readthedocs.org/user_builds/spcldace/checkouts/v0.13.3/dace/libraries/standard/__init__.py'>¶
-
toplevel_trans
¶ Make all GPU transients top-level
-
dace.transformation.dataflow.gpu_transform_local_storage module¶
Contains classes and functions that implement the GPU transformation (with local storage).
-
class
dace.transformation.dataflow.gpu_transform_local_storage.
GPUTransformLocalStorage
(*args, **kwargs)¶ Bases:
dace.transformation.transformation.SingleStateTransformation
Implements the GPUTransformLocalStorage transformation.
Similar to GPUTransformMap, but takes multiple maps leading from the same data node into account, creating a local storage for each range.
Seealso: GPUTransformMap -
apply
(graph, sdfg)¶ Applies this transformation instance on the matched pattern graph. :param sdfg: The SDFG to apply the transformation to. :return: A transformation-defined return value, which could be used
to pass analysis data out, or nothing.
-
can_be_applied
(graph, expr_index, sdfg, permissive=False)¶ Returns True if this transformation can be applied on the candidate matched subgraph. :param graph: SDFGState object in which the match was found. :param candidate: A mapping between node IDs returned from
PatternTransformation.expressions
and the nodes ingraph
.Parameters: - expr_index – The list index from
PatternTransformation.expressions
that was matched. - sdfg – The parent SDFG of the matched state.
- permissive – Whether transformation should run in permissive mode.
Returns: True if the transformation can be applied.
- expr_index – The list index from
-
classmethod
expressions
()¶ Returns a list of SDFG state subgraphs that will be matched in the subgraph isomorphism phase. Used as a pre-pass before calling
can_be_applied
.
-
fullcopy
¶ Copy whole arrays rather than used subset
-
map_entry
¶ Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of
PatternTransformation
to represent the subgraph patterns.Example use: ``` class MyTransformation(SingleStateTransformation):
some_map_node = PatternNode(nodes.MapEntry) array = PatternNode(nodes.AccessNode)The two nodes can then be used in the transformation static methods (e.g.,
expressions
,can_be_applied
) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.
-
match_to_str
(graph)¶ Returns a string representation of the pattern match on the candidate subgraph. Used when identifying matches in the console UI.
-
nested_seq
¶ Makes nested code semantically-equivalent to single-core code,transforming nested maps and memory into sequential and local memory respectively.
-
properties
()¶
-
reduce
¶ Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of
PatternTransformation
to represent the subgraph patterns.Example use: ``` class MyTransformation(SingleStateTransformation):
some_map_node = PatternNode(nodes.MapEntry) array = PatternNode(nodes.AccessNode)The two nodes can then be used in the transformation static methods (e.g.,
expressions
,can_be_applied
) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.
-
stdlib
= <module 'dace.libraries.standard' from '/home/docs/checkouts/readthedocs.org/user_builds/spcldace/checkouts/v0.13.3/dace/libraries/standard/__init__.py'>¶
-
-
dace.transformation.dataflow.gpu_transform_local_storage.
in_path
(path, edge, nodetype, forward=True)¶
-
dace.transformation.dataflow.gpu_transform_local_storage.
in_scope
(graph, node, parent)¶ Returns True if node is in the scope of parent.
dace.transformation.dataflow.local_storage module¶
Contains classes that implement transformations relating to streams and transient nodes.
-
class
dace.transformation.dataflow.local_storage.
InLocalStorage
(*args, **kwargs)¶ Bases:
dace.transformation.dataflow.local_storage.LocalStorage
Implements the InLocalStorage transformation, which adds a transient data node between two scope entry nodes.
-
can_be_applied
(graph, expr_index, sdfg, permissive=False)¶ Returns True if this transformation can be applied on the candidate matched subgraph. :param graph: SDFGState object in which the match was found. :param candidate: A mapping between node IDs returned from
PatternTransformation.expressions
and the nodes ingraph
.Parameters: - expr_index – The list index from
PatternTransformation.expressions
that was matched. - sdfg – The parent SDFG of the matched state.
- permissive – Whether transformation should run in permissive mode.
Returns: True if the transformation can be applied.
- expr_index – The list index from
-
properties
()¶
-
-
class
dace.transformation.dataflow.local_storage.
LocalStorage
(*args, **kwargs)¶ Bases:
dace.transformation.transformation.SingleStateTransformation
,abc.ABC
Implements the Local Storage prototype transformation, which adds a transient data node between two nodes.
-
static
annotates_memlets
()¶ Indicates whether the transformation annotates the edges it creates or modifies with the appropriate memlets. This determines whether to apply memlet propagation after the transformation.
-
apply
(graph: dace.sdfg.state.SDFGState, sdfg: dace.sdfg.sdfg.SDFG)¶ Applies this transformation instance on the matched pattern graph. :param sdfg: The SDFG to apply the transformation to. :return: A transformation-defined return value, which could be used
to pass analysis data out, or nothing.
-
array
¶ Array to create local storage for (if empty, first available)
-
create_array
¶ if false, it does not create a new array.
-
classmethod
expressions
()¶ Returns a list of SDFG state subgraphs that will be matched in the subgraph isomorphism phase. Used as a pre-pass before calling
can_be_applied
.
-
match_to_str
(graph)¶ Returns a string representation of the pattern match on the candidate subgraph. Used when identifying matches in the console UI.
-
node_a
¶ Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of
PatternTransformation
to represent the subgraph patterns.Example use: ``` class MyTransformation(SingleStateTransformation):
some_map_node = PatternNode(nodes.MapEntry) array = PatternNode(nodes.AccessNode)The two nodes can then be used in the transformation static methods (e.g.,
expressions
,can_be_applied
) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.
-
node_b
¶ Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of
PatternTransformation
to represent the subgraph patterns.Example use: ``` class MyTransformation(SingleStateTransformation):
some_map_node = PatternNode(nodes.MapEntry) array = PatternNode(nodes.AccessNode)The two nodes can then be used in the transformation static methods (e.g.,
expressions
,can_be_applied
) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.
-
prefix
¶ Prefix for new data node
-
properties
()¶
-
static
-
class
dace.transformation.dataflow.local_storage.
OutLocalStorage
(*args, **kwargs)¶ Bases:
dace.transformation.dataflow.local_storage.LocalStorage
Implements the OutLocalStorage transformation, which adds a transient data node between two scope exit nodes.
-
can_be_applied
(graph, expr_index, sdfg, permissive=False)¶ Returns True if this transformation can be applied on the candidate matched subgraph. :param graph: SDFGState object in which the match was found. :param candidate: A mapping between node IDs returned from
PatternTransformation.expressions
and the nodes ingraph
.Parameters: - expr_index – The list index from
PatternTransformation.expressions
that was matched. - sdfg – The parent SDFG of the matched state.
- permissive – Whether transformation should run in permissive mode.
Returns: True if the transformation can be applied.
- expr_index – The list index from
-
properties
()¶
-
dace.transformation.dataflow.map_collapse module¶
Contains classes that implement the map-collapse transformation.
-
class
dace.transformation.dataflow.map_collapse.
MapCollapse
(*args, **kwargs)¶ Bases:
dace.transformation.transformation.SingleStateTransformation
Implements the Map Collapse pattern.
Map-collapse takes two nested maps with M and N dimensions respectively, and collapses them to a single M+N dimensional map.
-
apply
(graph: dace.sdfg.state.SDFGState, sdfg: dace.sdfg.sdfg.SDFG) → Tuple[dace.sdfg.nodes.MapEntry, dace.sdfg.nodes.MapExit]¶ Collapses two maps into one. :param sdfg: The SDFG to apply the transformation to. :return: A 2-tuple of the new map entry and exit nodes.
-
can_be_applied
(graph, expr_index, sdfg, permissive=False)¶ Returns True if this transformation can be applied on the candidate matched subgraph. :param graph: SDFGState object in which the match was found. :param candidate: A mapping between node IDs returned from
PatternTransformation.expressions
and the nodes ingraph
.Parameters: - expr_index – The list index from
PatternTransformation.expressions
that was matched. - sdfg – The parent SDFG of the matched state.
- permissive – Whether transformation should run in permissive mode.
Returns: True if the transformation can be applied.
- expr_index – The list index from
-
classmethod
expressions
()¶ Returns a list of SDFG state subgraphs that will be matched in the subgraph isomorphism phase. Used as a pre-pass before calling
can_be_applied
.
-
inner_map_entry
¶ Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of
PatternTransformation
to represent the subgraph patterns.Example use: ``` class MyTransformation(SingleStateTransformation):
some_map_node = PatternNode(nodes.MapEntry) array = PatternNode(nodes.AccessNode)The two nodes can then be used in the transformation static methods (e.g.,
expressions
,can_be_applied
) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.
-
match_to_str
(graph)¶ Returns a string representation of the pattern match on the candidate subgraph. Used when identifying matches in the console UI.
-
outer_map_entry
¶ Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of
PatternTransformation
to represent the subgraph patterns.Example use: ``` class MyTransformation(SingleStateTransformation):
some_map_node = PatternNode(nodes.MapEntry) array = PatternNode(nodes.AccessNode)The two nodes can then be used in the transformation static methods (e.g.,
expressions
,can_be_applied
) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.
-
properties
()¶
-
dace.transformation.dataflow.map_expansion module¶
Contains classes that implement the map-expansion transformation.
-
class
dace.transformation.dataflow.map_expansion.
MapExpansion
(*args, **kwargs)¶ Bases:
dace.transformation.transformation.SingleStateTransformation
Implements the map-expansion pattern.
Map-expansion takes an N-dimensional map and expands it to N unidimensional maps.
- New edges abide by the following rules:
- If there are no edges coming from the outside, use empty memlets
- Edges with IN_* connectors replicate along the maps
- Edges for dynamic map ranges replicate until reaching range(s)
-
apply
(graph: dace.sdfg.state.SDFGState, sdfg: dace.sdfg.sdfg.SDFG)¶ Applies this transformation instance on the matched pattern graph. :param sdfg: The SDFG to apply the transformation to. :return: A transformation-defined return value, which could be used
to pass analysis data out, or nothing.
-
can_be_applied
(graph: dace.sdfg.state.SDFGState, expr_index: int, sdfg: dace.sdfg.sdfg.SDFG, permissive: bool = False)¶ Returns True if this transformation can be applied on the candidate matched subgraph. :param graph: SDFGState object in which the match was found. :param candidate: A mapping between node IDs returned from
PatternTransformation.expressions
and the nodes ingraph
.Parameters: - expr_index – The list index from
PatternTransformation.expressions
that was matched. - sdfg – The parent SDFG of the matched state.
- permissive – Whether transformation should run in permissive mode.
Returns: True if the transformation can be applied.
- expr_index – The list index from
-
classmethod
expressions
()¶ Returns a list of SDFG state subgraphs that will be matched in the subgraph isomorphism phase. Used as a pre-pass before calling
can_be_applied
.
-
map_entry
¶ Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of
PatternTransformation
to represent the subgraph patterns.Example use: ``` class MyTransformation(SingleStateTransformation):
some_map_node = PatternNode(nodes.MapEntry) array = PatternNode(nodes.AccessNode)The two nodes can then be used in the transformation static methods (e.g.,
expressions
,can_be_applied
) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.
dace.transformation.dataflow.map_fission module¶
Map Fission transformation.
-
class
dace.transformation.dataflow.map_fission.
MapFission
(*args, **kwargs)¶ Bases:
dace.transformation.transformation.SingleStateTransformation
Implements the MapFission transformation. Map fission refers to subsuming a map scope into its internal subgraph, essentially replicating the map into maps in all of its internal components. This also extends the dimensions of “border” transient arrays (i.e., those between the maps), in order to retain program semantics after fission.
There are two cases that match map fission: 1. A map with an arbitrary subgraph with more than one computational
(i.e., non-access) node. The use of arrays connecting the computational nodes must be limited to the subgraph, and non transient arrays may not be used as “border” arrays.- A map with one internal node that is a nested SDFG, in which each state matches the conditions of case (1).
If a map has nested SDFGs in its subgraph, they are not considered in the case (1) above, and MapFission must be invoked again on the maps with the nested SDFGs in question.
-
static
annotates_memlets
()¶ Indicates whether the transformation annotates the edges it creates or modifies with the appropriate memlets. This determines whether to apply memlet propagation after the transformation.
-
apply
(graph: dace.sdfg.state.SDFGState, sdfg: dace.sdfg.sdfg.SDFG)¶ Applies this transformation instance on the matched pattern graph. :param sdfg: The SDFG to apply the transformation to. :return: A transformation-defined return value, which could be used
to pass analysis data out, or nothing.
-
can_be_applied
(graph, expr_index, sdfg, permissive=False)¶ Returns True if this transformation can be applied on the candidate matched subgraph. :param graph: SDFGState object in which the match was found. :param candidate: A mapping between node IDs returned from
PatternTransformation.expressions
and the nodes ingraph
.Parameters: - expr_index – The list index from
PatternTransformation.expressions
that was matched. - sdfg – The parent SDFG of the matched state.
- permissive – Whether transformation should run in permissive mode.
Returns: True if the transformation can be applied.
- expr_index – The list index from
-
classmethod
expressions
()¶ Returns a list of SDFG state subgraphs that will be matched in the subgraph isomorphism phase. Used as a pre-pass before calling
can_be_applied
.
-
map_entry
¶ Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of
PatternTransformation
to represent the subgraph patterns.Example use: ``` class MyTransformation(SingleStateTransformation):
some_map_node = PatternNode(nodes.MapEntry) array = PatternNode(nodes.AccessNode)The two nodes can then be used in the transformation static methods (e.g.,
expressions
,can_be_applied
) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.
-
nested_sdfg
¶ Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of
PatternTransformation
to represent the subgraph patterns.Example use: ``` class MyTransformation(SingleStateTransformation):
some_map_node = PatternNode(nodes.MapEntry) array = PatternNode(nodes.AccessNode)The two nodes can then be used in the transformation static methods (e.g.,
expressions
,can_be_applied
) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.
dace.transformation.dataflow.map_for_loop module¶
This module contains classes that implement a map->for loop transformation.
-
class
dace.transformation.dataflow.map_for_loop.
MapToForLoop
(*args, **kwargs)¶ Bases:
dace.transformation.transformation.SingleStateTransformation
Implements the Map to for-loop transformation.
Takes a map and enforces a sequential schedule by transforming it into a state-machine of a for-loop. Creates a nested SDFG, if necessary.
-
static
annotates_memlets
()¶ Indicates whether the transformation annotates the edges it creates or modifies with the appropriate memlets. This determines whether to apply memlet propagation after the transformation.
-
apply
(graph: dace.sdfg.state.SDFGState, sdfg: dace.sdfg.sdfg.SDFG) → Tuple[dace.sdfg.nodes.NestedSDFG, dace.sdfg.state.SDFGState]¶ Applies the transformation and returns a tuple with the new nested SDFG node and the main state in the for-loop.
-
can_be_applied
(graph, expr_index, sdfg, permissive=False)¶ Returns True if this transformation can be applied on the candidate matched subgraph. :param graph: SDFGState object in which the match was found. :param candidate: A mapping between node IDs returned from
PatternTransformation.expressions
and the nodes ingraph
.Parameters: - expr_index – The list index from
PatternTransformation.expressions
that was matched. - sdfg – The parent SDFG of the matched state.
- permissive – Whether transformation should run in permissive mode.
Returns: True if the transformation can be applied.
- expr_index – The list index from
-
classmethod
expressions
()¶ Returns a list of SDFG state subgraphs that will be matched in the subgraph isomorphism phase. Used as a pre-pass before calling
can_be_applied
.
-
map_entry
¶ Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of
PatternTransformation
to represent the subgraph patterns.Example use: ``` class MyTransformation(SingleStateTransformation):
some_map_node = PatternNode(nodes.MapEntry) array = PatternNode(nodes.AccessNode)The two nodes can then be used in the transformation static methods (e.g.,
expressions
,can_be_applied
) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.
-
static
dace.transformation.dataflow.map_fusion module¶
This module contains classes that implement the map fusion transformation.
-
class
dace.transformation.dataflow.map_fusion.
MapFusion
(*args, **kwargs)¶ Bases:
dace.transformation.transformation.SingleStateTransformation
Implements the MapFusion transformation. It wil check for all patterns MapExit -> AccessNode -> MapEntry, and based on the following rules, fuse them and remove the transient in between. There are several possibilities of what it does to this transient in between.
Essentially, if there is some other place in the sdfg where it is required, or if it is not a transient, then it will not be removed. In such a case, it will be linked to the MapExit node of the new fused map.
- Rules for fusing maps:
- The map range of the second map should be a permutation of the first map range.
- Each of the access nodes that are adjacent to the first map exit should have an edge to the second map entry. If it doesn’t, then the second map entry should not be reachable from this access node.
- Any node that has a wcr from the first map exit should not be adjacent to the second map entry.
- Access pattern for the access nodes in the second map should be the same permutation of the map parameters as the map ranges of the two maps. Alternatively, this access node should not be adjacent to the first map entry.
-
static
annotates_memlets
()¶ Indicates whether the transformation annotates the edges it creates or modifies with the appropriate memlets. This determines whether to apply memlet propagation after the transformation.
-
apply
(graph: dace.sdfg.state.SDFGState, sdfg: dace.sdfg.sdfg.SDFG)¶ This method applies the mapfusion transformation. Other than the removal of the second map entry node (SME), and the first map exit (FME) node, it has the following side effects:
- Any transient adjacent to both FME and SME with degree = 2 will be removed. The tasklets that use/produce it shall be connected directly with a scalar/new transient (if the dataflow is more than a single scalar)
- If this transient is adjacent to FME and SME and has other uses, it will be adjacent to the new map exit post fusion. Tasklet-> Tasklet edges will ALSO be added as mentioned above.
- If an access node is adjacent to FME but not SME, it will be adjacent to new map exit post fusion.
- If an access node is adjacent to SME but not FME, it will be adjacent to the new map entry node post fusion.
-
array
¶ Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of
PatternTransformation
to represent the subgraph patterns.Example use: ``` class MyTransformation(SingleStateTransformation):
some_map_node = PatternNode(nodes.MapEntry) array = PatternNode(nodes.AccessNode)The two nodes can then be used in the transformation static methods (e.g.,
expressions
,can_be_applied
) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.
-
can_be_applied
(graph, expr_index, sdfg, permissive=False)¶ Returns True if this transformation can be applied on the candidate matched subgraph. :param graph: SDFGState object in which the match was found. :param candidate: A mapping between node IDs returned from
PatternTransformation.expressions
and the nodes ingraph
.Parameters: - expr_index – The list index from
PatternTransformation.expressions
that was matched. - sdfg – The parent SDFG of the matched state.
- permissive – Whether transformation should run in permissive mode.
Returns: True if the transformation can be applied.
- expr_index – The list index from
-
classmethod
expressions
()¶ Returns a list of SDFG state subgraphs that will be matched in the subgraph isomorphism phase. Used as a pre-pass before calling
can_be_applied
.
-
static
find_permutation
(first_map: dace.sdfg.nodes.Map, second_map: dace.sdfg.nodes.Map) → Optional[List[int]]¶ Find permutation between two map ranges. :param first_map: First map. :param second_map: Second map. :return: None if no such permutation exists, otherwise a list of
indices L such that L[x]’th parameter of second map has the same range as x’th parameter of the first map.
-
first_map_exit
¶ Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of
PatternTransformation
to represent the subgraph patterns.Example use: ``` class MyTransformation(SingleStateTransformation):
some_map_node = PatternNode(nodes.MapEntry) array = PatternNode(nodes.AccessNode)The two nodes can then be used in the transformation static methods (e.g.,
expressions
,can_be_applied
) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.
-
fuse_nodes
(sdfg, graph, edge, new_dst, new_dst_conn, other_edges=None)¶ Fuses two nodes via memlets and possibly transient arrays.
-
second_map_entry
¶ Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of
PatternTransformation
to represent the subgraph patterns.Example use: ``` class MyTransformation(SingleStateTransformation):
some_map_node = PatternNode(nodes.MapEntry) array = PatternNode(nodes.AccessNode)The two nodes can then be used in the transformation static methods (e.g.,
expressions
,can_be_applied
) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.
dace.transformation.dataflow.map_interchange module¶
Implements the map interchange transformation.
-
class
dace.transformation.dataflow.map_interchange.
MapInterchange
(*args, **kwargs)¶ Bases:
dace.transformation.transformation.SingleStateTransformation
Implements the map-interchange transformation.
Map-interchange takes two nested maps and interchanges their position.
-
static
annotates_memlets
()¶ Indicates whether the transformation annotates the edges it creates or modifies with the appropriate memlets. This determines whether to apply memlet propagation after the transformation.
-
apply
(graph: dace.sdfg.state.SDFGState, sdfg: dace.sdfg.sdfg.SDFG)¶ Applies this transformation instance on the matched pattern graph. :param sdfg: The SDFG to apply the transformation to. :return: A transformation-defined return value, which could be used
to pass analysis data out, or nothing.
-
can_be_applied
(graph, expr_index, sdfg, permissive=False)¶ Returns True if this transformation can be applied on the candidate matched subgraph. :param graph: SDFGState object in which the match was found. :param candidate: A mapping between node IDs returned from
PatternTransformation.expressions
and the nodes ingraph
.Parameters: - expr_index – The list index from
PatternTransformation.expressions
that was matched. - sdfg – The parent SDFG of the matched state.
- permissive – Whether transformation should run in permissive mode.
Returns: True if the transformation can be applied.
- expr_index – The list index from
-
classmethod
expressions
()¶ Returns a list of SDFG state subgraphs that will be matched in the subgraph isomorphism phase. Used as a pre-pass before calling
can_be_applied
.
-
inner_map_entry
¶ Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of
PatternTransformation
to represent the subgraph patterns.Example use: ``` class MyTransformation(SingleStateTransformation):
some_map_node = PatternNode(nodes.MapEntry) array = PatternNode(nodes.AccessNode)The two nodes can then be used in the transformation static methods (e.g.,
expressions
,can_be_applied
) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.
-
outer_map_entry
¶ Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of
PatternTransformation
to represent the subgraph patterns.Example use: ``` class MyTransformation(SingleStateTransformation):
some_map_node = PatternNode(nodes.MapEntry) array = PatternNode(nodes.AccessNode)The two nodes can then be used in the transformation static methods (e.g.,
expressions
,can_be_applied
) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.
-
static
dace.transformation.dataflow.mapreduce module¶
Contains classes and functions that implement the map-reduce-fusion transformation.
-
class
dace.transformation.dataflow.mapreduce.
MapReduceFusion
(*args, **kwargs)¶ Bases:
dace.transformation.transformation.SingleStateTransformation
Implements the map-reduce-fusion transformation. Fuses a map with an immediately following reduction, where the array between the map and the reduction is not used anywhere else.
-
apply
(graph: dace.sdfg.state.SDFGState, sdfg: dace.sdfg.sdfg.SDFG)¶ Applies this transformation instance on the matched pattern graph. :param sdfg: The SDFG to apply the transformation to. :return: A transformation-defined return value, which could be used
to pass analysis data out, or nothing.
-
can_be_applied
(graph, expr_index, sdfg, permissive=False)¶ Returns True if this transformation can be applied on the candidate matched subgraph. :param graph: SDFGState object in which the match was found. :param candidate: A mapping between node IDs returned from
PatternTransformation.expressions
and the nodes ingraph
.Parameters: - expr_index – The list index from
PatternTransformation.expressions
that was matched. - sdfg – The parent SDFG of the matched state.
- permissive – Whether transformation should run in permissive mode.
Returns: True if the transformation can be applied.
- expr_index – The list index from
-
classmethod
expressions
()¶ Returns a list of SDFG state subgraphs that will be matched in the subgraph isomorphism phase. Used as a pre-pass before calling
can_be_applied
.
-
in_array
¶ Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of
PatternTransformation
to represent the subgraph patterns.Example use: ``` class MyTransformation(SingleStateTransformation):
some_map_node = PatternNode(nodes.MapEntry) array = PatternNode(nodes.AccessNode)The two nodes can then be used in the transformation static methods (e.g.,
expressions
,can_be_applied
) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.
-
match_to_str
(graph)¶ Returns a string representation of the pattern match on the candidate subgraph. Used when identifying matches in the console UI.
-
no_init
¶ If enabled, does not create initialization states for reduce nodes with identity
-
out_array
¶ Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of
PatternTransformation
to represent the subgraph patterns.Example use: ``` class MyTransformation(SingleStateTransformation):
some_map_node = PatternNode(nodes.MapEntry) array = PatternNode(nodes.AccessNode)The two nodes can then be used in the transformation static methods (e.g.,
expressions
,can_be_applied
) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.
-
properties
()¶
-
reduce
¶ Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of
PatternTransformation
to represent the subgraph patterns.Example use: ``` class MyTransformation(SingleStateTransformation):
some_map_node = PatternNode(nodes.MapEntry) array = PatternNode(nodes.AccessNode)The two nodes can then be used in the transformation static methods (e.g.,
expressions
,can_be_applied
) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.
-
stdlib
= <module 'dace.libraries.standard' from '/home/docs/checkouts/readthedocs.org/user_builds/spcldace/checkouts/v0.13.3/dace/libraries/standard/__init__.py'>¶
-
tasklet
¶ Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of
PatternTransformation
to represent the subgraph patterns.Example use: ``` class MyTransformation(SingleStateTransformation):
some_map_node = PatternNode(nodes.MapEntry) array = PatternNode(nodes.AccessNode)The two nodes can then be used in the transformation static methods (e.g.,
expressions
,can_be_applied
) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.
-
tmap_exit
¶ Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of
PatternTransformation
to represent the subgraph patterns.Example use: ``` class MyTransformation(SingleStateTransformation):
some_map_node = PatternNode(nodes.MapEntry) array = PatternNode(nodes.AccessNode)The two nodes can then be used in the transformation static methods (e.g.,
expressions
,can_be_applied
) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.
-
-
class
dace.transformation.dataflow.mapreduce.
MapWCRFusion
(*args, **kwargs)¶ Bases:
dace.transformation.transformation.SingleStateTransformation
Implements the map expanded-reduce fusion transformation. Fuses a map with an immediately following reduction, where the array between the map and the reduction is not used anywhere else, and the reduction is divided to two maps with a WCR, denoting partial reduction.
-
apply
(graph: dace.sdfg.state.SDFGState, sdfg: dace.sdfg.sdfg.SDFG)¶ Applies this transformation instance on the matched pattern graph. :param sdfg: The SDFG to apply the transformation to. :return: A transformation-defined return value, which could be used
to pass analysis data out, or nothing.
-
can_be_applied
(graph, expr_index, sdfg, permissive=False)¶ Returns True if this transformation can be applied on the candidate matched subgraph. :param graph: SDFGState object in which the match was found. :param candidate: A mapping between node IDs returned from
PatternTransformation.expressions
and the nodes ingraph
.Parameters: - expr_index – The list index from
PatternTransformation.expressions
that was matched. - sdfg – The parent SDFG of the matched state.
- permissive – Whether transformation should run in permissive mode.
Returns: True if the transformation can be applied.
- expr_index – The list index from
-
classmethod
expressions
()¶ Returns a list of SDFG state subgraphs that will be matched in the subgraph isomorphism phase. Used as a pre-pass before calling
can_be_applied
.
-
in_array
¶ Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of
PatternTransformation
to represent the subgraph patterns.Example use: ``` class MyTransformation(SingleStateTransformation):
some_map_node = PatternNode(nodes.MapEntry) array = PatternNode(nodes.AccessNode)The two nodes can then be used in the transformation static methods (e.g.,
expressions
,can_be_applied
) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.
-
match_to_str
(graph)¶ Returns a string representation of the pattern match on the candidate subgraph. Used when identifying matches in the console UI.
-
out_array
¶ Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of
PatternTransformation
to represent the subgraph patterns.Example use: ``` class MyTransformation(SingleStateTransformation):
some_map_node = PatternNode(nodes.MapEntry) array = PatternNode(nodes.AccessNode)The two nodes can then be used in the transformation static methods (e.g.,
expressions
,can_be_applied
) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.
-
rmap_in_cr
¶ Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of
PatternTransformation
to represent the subgraph patterns.Example use: ``` class MyTransformation(SingleStateTransformation):
some_map_node = PatternNode(nodes.MapEntry) array = PatternNode(nodes.AccessNode)The two nodes can then be used in the transformation static methods (e.g.,
expressions
,can_be_applied
) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.
-
rmap_in_entry
¶ Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of
PatternTransformation
to represent the subgraph patterns.Example use: ``` class MyTransformation(SingleStateTransformation):
some_map_node = PatternNode(nodes.MapEntry) array = PatternNode(nodes.AccessNode)The two nodes can then be used in the transformation static methods (e.g.,
expressions
,can_be_applied
) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.
-
rmap_in_tasklet
¶ Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of
PatternTransformation
to represent the subgraph patterns.Example use: ``` class MyTransformation(SingleStateTransformation):
some_map_node = PatternNode(nodes.MapEntry) array = PatternNode(nodes.AccessNode)The two nodes can then be used in the transformation static methods (e.g.,
expressions
,can_be_applied
) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.
-
rmap_out_entry
¶ Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of
PatternTransformation
to represent the subgraph patterns.Example use: ``` class MyTransformation(SingleStateTransformation):
some_map_node = PatternNode(nodes.MapEntry) array = PatternNode(nodes.AccessNode)The two nodes can then be used in the transformation static methods (e.g.,
expressions
,can_be_applied
) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.
-
rmap_out_exit
¶ Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of
PatternTransformation
to represent the subgraph patterns.Example use: ``` class MyTransformation(SingleStateTransformation):
some_map_node = PatternNode(nodes.MapEntry) array = PatternNode(nodes.AccessNode)The two nodes can then be used in the transformation static methods (e.g.,
expressions
,can_be_applied
) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.
-
tasklet
¶ Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of
PatternTransformation
to represent the subgraph patterns.Example use: ``` class MyTransformation(SingleStateTransformation):
some_map_node = PatternNode(nodes.MapEntry) array = PatternNode(nodes.AccessNode)The two nodes can then be used in the transformation static methods (e.g.,
expressions
,can_be_applied
) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.
-
tmap_exit
¶ Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of
PatternTransformation
to represent the subgraph patterns.Example use: ``` class MyTransformation(SingleStateTransformation):
some_map_node = PatternNode(nodes.MapEntry) array = PatternNode(nodes.AccessNode)The two nodes can then be used in the transformation static methods (e.g.,
expressions
,can_be_applied
) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.
-
dace.transformation.dataflow.matrix_product_transpose module¶
Implements the matrix-matrix product transpose transformation.
-
class
dace.transformation.dataflow.matrix_product_transpose.
MatrixProductTranspose
(*args, **kwargs)¶ Bases:
dace.transformation.transformation.SingleStateTransformation
Implements the matrix-matrix product transpose transformation.
T(A) @ T(B) = T(B @ A)
-
a_times_b
¶ Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of
PatternTransformation
to represent the subgraph patterns.Example use: ``` class MyTransformation(SingleStateTransformation):
some_map_node = PatternNode(nodes.MapEntry) array = PatternNode(nodes.AccessNode)The two nodes can then be used in the transformation static methods (e.g.,
expressions
,can_be_applied
) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.
-
apply
(graph: dace.sdfg.state.SDFGState, sdfg: dace.sdfg.sdfg.SDFG)¶ Applies this transformation instance on the matched pattern graph. :param sdfg: The SDFG to apply the transformation to. :return: A transformation-defined return value, which could be used
to pass analysis data out, or nothing.
-
at
¶ Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of
PatternTransformation
to represent the subgraph patterns.Example use: ``` class MyTransformation(SingleStateTransformation):
some_map_node = PatternNode(nodes.MapEntry) array = PatternNode(nodes.AccessNode)The two nodes can then be used in the transformation static methods (e.g.,
expressions
,can_be_applied
) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.
-
blas
= <module 'dace.libraries.blas' from '/home/docs/checkouts/readthedocs.org/user_builds/spcldace/checkouts/v0.13.3/dace/libraries/blas/__init__.py'>¶
-
bt
¶ Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of
PatternTransformation
to represent the subgraph patterns.Example use: ``` class MyTransformation(SingleStateTransformation):
some_map_node = PatternNode(nodes.MapEntry) array = PatternNode(nodes.AccessNode)The two nodes can then be used in the transformation static methods (e.g.,
expressions
,can_be_applied
) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.
-
can_be_applied
(graph, expr_index, sdfg, permissive=False)¶ Returns True if this transformation can be applied on the candidate matched subgraph. :param graph: SDFGState object in which the match was found. :param candidate: A mapping between node IDs returned from
PatternTransformation.expressions
and the nodes ingraph
.Parameters: - expr_index – The list index from
PatternTransformation.expressions
that was matched. - sdfg – The parent SDFG of the matched state.
- permissive – Whether transformation should run in permissive mode.
Returns: True if the transformation can be applied.
- expr_index – The list index from
-
classmethod
expressions
()¶ Returns a list of SDFG state subgraphs that will be matched in the subgraph isomorphism phase. Used as a pre-pass before calling
can_be_applied
.
-
match_to_str
(graph)¶ Returns a string representation of the pattern match on the candidate subgraph. Used when identifying matches in the console UI.
-
properties
()¶
-
transpose_a
¶ Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of
PatternTransformation
to represent the subgraph patterns.Example use: ``` class MyTransformation(SingleStateTransformation):
some_map_node = PatternNode(nodes.MapEntry) array = PatternNode(nodes.AccessNode)The two nodes can then be used in the transformation static methods (e.g.,
expressions
,can_be_applied
) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.
-
transpose_b
¶ Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of
PatternTransformation
to represent the subgraph patterns.Example use: ``` class MyTransformation(SingleStateTransformation):
some_map_node = PatternNode(nodes.MapEntry) array = PatternNode(nodes.AccessNode)The two nodes can then be used in the transformation static methods (e.g.,
expressions
,can_be_applied
) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.
-
dace.transformation.dataflow.merge_arrays module¶
-
class
dace.transformation.dataflow.merge_arrays.
InMergeArrays
(*args, **kwargs)¶ Bases:
dace.transformation.transformation.SingleStateTransformation
,dace.transformation.transformation.SimplifyPass
Merge duplicate arrays connected to the same scope entry.
-
apply
(graph, sdfg)¶ Applies this transformation instance on the matched pattern graph. :param sdfg: The SDFG to apply the transformation to. :return: A transformation-defined return value, which could be used
to pass analysis data out, or nothing.
-
array1
¶ Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of
PatternTransformation
to represent the subgraph patterns.Example use: ``` class MyTransformation(SingleStateTransformation):
some_map_node = PatternNode(nodes.MapEntry) array = PatternNode(nodes.AccessNode)The two nodes can then be used in the transformation static methods (e.g.,
expressions
,can_be_applied
) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.
-
array2
¶ Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of
PatternTransformation
to represent the subgraph patterns.Example use: ``` class MyTransformation(SingleStateTransformation):
some_map_node = PatternNode(nodes.MapEntry) array = PatternNode(nodes.AccessNode)The two nodes can then be used in the transformation static methods (e.g.,
expressions
,can_be_applied
) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.
-
can_be_applied
(graph: dace.sdfg.state.SDFGState, expr_index, sdfg, permissive=False)¶ Returns True if this transformation can be applied on the candidate matched subgraph. :param graph: SDFGState object in which the match was found. :param candidate: A mapping between node IDs returned from
PatternTransformation.expressions
and the nodes ingraph
.Parameters: - expr_index – The list index from
PatternTransformation.expressions
that was matched. - sdfg – The parent SDFG of the matched state.
- permissive – Whether transformation should run in permissive mode.
Returns: True if the transformation can be applied.
- expr_index – The list index from
-
classmethod
expressions
()¶ Returns a list of SDFG state subgraphs that will be matched in the subgraph isomorphism phase. Used as a pre-pass before calling
can_be_applied
.
-
map_entry
¶ Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of
PatternTransformation
to represent the subgraph patterns.Example use: ``` class MyTransformation(SingleStateTransformation):
some_map_node = PatternNode(nodes.MapEntry) array = PatternNode(nodes.AccessNode)The two nodes can then be used in the transformation static methods (e.g.,
expressions
,can_be_applied
) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.
-
match_to_str
(graph)¶ Returns a string representation of the pattern match on the candidate subgraph. Used when identifying matches in the console UI.
-
-
class
dace.transformation.dataflow.merge_arrays.
MergeSourceSinkArrays
(*args, **kwargs)¶ Bases:
dace.transformation.transformation.SingleStateTransformation
,dace.transformation.transformation.SimplifyPass
Merge duplicate arrays that are source/sink nodes.
-
apply
(graph, sdfg)¶ Applies this transformation instance on the matched pattern graph. :param sdfg: The SDFG to apply the transformation to. :return: A transformation-defined return value, which could be used
to pass analysis data out, or nothing.
-
array1
¶ Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of
PatternTransformation
to represent the subgraph patterns.Example use: ``` class MyTransformation(SingleStateTransformation):
some_map_node = PatternNode(nodes.MapEntry) array = PatternNode(nodes.AccessNode)The two nodes can then be used in the transformation static methods (e.g.,
expressions
,can_be_applied
) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.
-
can_be_applied
(graph, expr_index, sdfg, permissive=False)¶ Returns True if this transformation can be applied on the candidate matched subgraph. :param graph: SDFGState object in which the match was found. :param candidate: A mapping between node IDs returned from
PatternTransformation.expressions
and the nodes ingraph
.Parameters: - expr_index – The list index from
PatternTransformation.expressions
that was matched. - sdfg – The parent SDFG of the matched state.
- permissive – Whether transformation should run in permissive mode.
Returns: True if the transformation can be applied.
- expr_index – The list index from
-
classmethod
expressions
()¶ Returns a list of SDFG state subgraphs that will be matched in the subgraph isomorphism phase. Used as a pre-pass before calling
can_be_applied
.
-
-
class
dace.transformation.dataflow.merge_arrays.
OutMergeArrays
(*args, **kwargs)¶ Bases:
dace.transformation.transformation.SingleStateTransformation
,dace.transformation.transformation.SimplifyPass
Merge duplicate arrays connected to the same scope entry.
-
apply
(graph, sdfg)¶ Applies this transformation instance on the matched pattern graph. :param sdfg: The SDFG to apply the transformation to. :return: A transformation-defined return value, which could be used
to pass analysis data out, or nothing.
-
array1
¶ Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of
PatternTransformation
to represent the subgraph patterns.Example use: ``` class MyTransformation(SingleStateTransformation):
some_map_node = PatternNode(nodes.MapEntry) array = PatternNode(nodes.AccessNode)The two nodes can then be used in the transformation static methods (e.g.,
expressions
,can_be_applied
) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.
-
array2
¶ Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of
PatternTransformation
to represent the subgraph patterns.Example use: ``` class MyTransformation(SingleStateTransformation):
some_map_node = PatternNode(nodes.MapEntry) array = PatternNode(nodes.AccessNode)The two nodes can then be used in the transformation static methods (e.g.,
expressions
,can_be_applied
) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.
-
can_be_applied
(graph, expr_index, sdfg, permissive=False)¶ Returns True if this transformation can be applied on the candidate matched subgraph. :param graph: SDFGState object in which the match was found. :param candidate: A mapping between node IDs returned from
PatternTransformation.expressions
and the nodes ingraph
.Parameters: - expr_index – The list index from
PatternTransformation.expressions
that was matched. - sdfg – The parent SDFG of the matched state.
- permissive – Whether transformation should run in permissive mode.
Returns: True if the transformation can be applied.
- expr_index – The list index from
-
classmethod
expressions
()¶ Returns a list of SDFG state subgraphs that will be matched in the subgraph isomorphism phase. Used as a pre-pass before calling
can_be_applied
.
-
map_exit
¶ Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of
PatternTransformation
to represent the subgraph patterns.Example use: ``` class MyTransformation(SingleStateTransformation):
some_map_node = PatternNode(nodes.MapEntry) array = PatternNode(nodes.AccessNode)The two nodes can then be used in the transformation static methods (e.g.,
expressions
,can_be_applied
) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.
-
match_to_str
(graph)¶ Returns a string representation of the pattern match on the candidate subgraph. Used when identifying matches in the console UI.
-
dace.transformation.dataflow.mpi module¶
Contains the MPITransformMap transformation.
-
class
dace.transformation.dataflow.mpi.
MPITransformMap
(*args, **kwargs)¶ Bases:
dace.transformation.transformation.SingleStateTransformation
Implements the MPI parallelization pattern.
Takes a map and makes it an MPI-scheduled map, introduces transients that keep locally accessed data.
``` Input1 - Output1
/- Input2 — MapEntry – Arbitrary R – MapExit – Output2
- / InputN - OutputN
Nothing in R may access other inputs/outputs that are not defined in R itself and do not go through MapEntry/MapExit Map must be a one-dimensional map for now. The range of the map must be a Range object.
- Add transients for the accessed parts
- The schedule property of Map is set to MPI
- The range of Map is changed to var = startexpr + p * chunksize … startexpr + p + 1 * chunksize where p is the current rank and P is the total number of ranks, and chunksize is defined as (endexpr - startexpr) / P, adding the remaining K iterations to the first K procs.
- For each input InputI, create a new transient transInputI, which has an attribute that specifies that it needs to be filled with (possibly) remote data
- Collect all accesses to InputI within R, assume their convex hull is InputI[rs … re]
- The transInputI transient will contain InputI[rs … re]
- Change all accesses to InputI within R to accesses to transInputI
-
static
annotates_memlets
()¶ Indicates whether the transformation annotates the edges it creates or modifies with the appropriate memlets. This determines whether to apply memlet propagation after the transformation.
-
apply
(graph: dace.sdfg.state.SDFGState, sdfg: dace.sdfg.sdfg.SDFG)¶ Applies this transformation instance on the matched pattern graph. :param sdfg: The SDFG to apply the transformation to. :return: A transformation-defined return value, which could be used
to pass analysis data out, or nothing.
-
can_be_applied
(graph, expr_index, sdfg, permissive=False)¶ Returns True if this transformation can be applied on the candidate matched subgraph. :param graph: SDFGState object in which the match was found. :param candidate: A mapping between node IDs returned from
PatternTransformation.expressions
and the nodes ingraph
.Parameters: - expr_index – The list index from
PatternTransformation.expressions
that was matched. - sdfg – The parent SDFG of the matched state.
- permissive – Whether transformation should run in permissive mode.
Returns: True if the transformation can be applied.
- expr_index – The list index from
-
classmethod
expressions
()¶ Returns a list of SDFG state subgraphs that will be matched in the subgraph isomorphism phase. Used as a pre-pass before calling
can_be_applied
.
-
map_entry
¶ Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of
PatternTransformation
to represent the subgraph patterns.Example use: ``` class MyTransformation(SingleStateTransformation):
some_map_node = PatternNode(nodes.MapEntry) array = PatternNode(nodes.AccessNode)The two nodes can then be used in the transformation static methods (e.g.,
expressions
,can_be_applied
) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.
-
properties
()¶
dace.transformation.dataflow.redundant_array module¶
Contains classes that implement a redundant array removal transformation.
-
class
dace.transformation.dataflow.redundant_array.
RedundantArray
(*args, **kwargs)¶ Bases:
dace.transformation.transformation.SingleStateTransformation
,dace.transformation.transformation.SimplifyPass
Implements the redundant array removal transformation, applied when a transient array is copied to and from (to another array), but never used anywhere else.
-
apply
(graph, sdfg)¶ Applies this transformation instance on the matched pattern graph. :param sdfg: The SDFG to apply the transformation to. :return: A transformation-defined return value, which could be used
to pass analysis data out, or nothing.
-
can_be_applied
(graph, expr_index, sdfg, permissive=False)¶ Returns True if this transformation can be applied on the candidate matched subgraph. :param graph: SDFGState object in which the match was found. :param candidate: A mapping between node IDs returned from
PatternTransformation.expressions
and the nodes ingraph
.Parameters: - expr_index – The list index from
PatternTransformation.expressions
that was matched. - sdfg – The parent SDFG of the matched state.
- permissive – Whether transformation should run in permissive mode.
Returns: True if the transformation can be applied.
- expr_index – The list index from
-
classmethod
expressions
()¶ Returns a list of SDFG state subgraphs that will be matched in the subgraph isomorphism phase. Used as a pre-pass before calling
can_be_applied
.
-
in_array
¶ Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of
PatternTransformation
to represent the subgraph patterns.Example use: ``` class MyTransformation(SingleStateTransformation):
some_map_node = PatternNode(nodes.MapEntry) array = PatternNode(nodes.AccessNode)The two nodes can then be used in the transformation static methods (e.g.,
expressions
,can_be_applied
) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.
-
out_array
¶ Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of
PatternTransformation
to represent the subgraph patterns.Example use: ``` class MyTransformation(SingleStateTransformation):
some_map_node = PatternNode(nodes.MapEntry) array = PatternNode(nodes.AccessNode)The two nodes can then be used in the transformation static methods (e.g.,
expressions
,can_be_applied
) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.
-
-
class
dace.transformation.dataflow.redundant_array.
RedundantReadSlice
(*args, **kwargs)¶ Bases:
dace.transformation.transformation.SingleStateTransformation
,dace.transformation.transformation.SimplifyPass
Detects patterns of the form Array -> View(Array) and removes the View if it is a slice.
-
apply
(graph, sdfg)¶ Applies this transformation instance on the matched pattern graph. :param sdfg: The SDFG to apply the transformation to. :return: A transformation-defined return value, which could be used
to pass analysis data out, or nothing.
-
can_be_applied
(graph, expr_index, sdfg, permissive=False)¶ Returns True if this transformation can be applied on the candidate matched subgraph. :param graph: SDFGState object in which the match was found. :param candidate: A mapping between node IDs returned from
PatternTransformation.expressions
and the nodes ingraph
.Parameters: - expr_index – The list index from
PatternTransformation.expressions
that was matched. - sdfg – The parent SDFG of the matched state.
- permissive – Whether transformation should run in permissive mode.
Returns: True if the transformation can be applied.
- expr_index – The list index from
-
classmethod
expressions
()¶ Returns a list of SDFG state subgraphs that will be matched in the subgraph isomorphism phase. Used as a pre-pass before calling
can_be_applied
.
-
in_array
¶ Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of
PatternTransformation
to represent the subgraph patterns.Example use: ``` class MyTransformation(SingleStateTransformation):
some_map_node = PatternNode(nodes.MapEntry) array = PatternNode(nodes.AccessNode)The two nodes can then be used in the transformation static methods (e.g.,
expressions
,can_be_applied
) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.
-
out_array
¶ Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of
PatternTransformation
to represent the subgraph patterns.Example use: ``` class MyTransformation(SingleStateTransformation):
some_map_node = PatternNode(nodes.MapEntry) array = PatternNode(nodes.AccessNode)The two nodes can then be used in the transformation static methods (e.g.,
expressions
,can_be_applied
) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.
-
-
class
dace.transformation.dataflow.redundant_array.
RedundantSecondArray
(*args, **kwargs)¶ Bases:
dace.transformation.transformation.SingleStateTransformation
,dace.transformation.transformation.SimplifyPass
Implements the redundant array removal transformation, applied when a transient array is copied from and to (from another array), but never used anywhere else. This transformation removes the second array.
-
apply
(graph: dace.sdfg.state.SDFGState, sdfg: dace.sdfg.sdfg.SDFG)¶ Applies this transformation instance on the matched pattern graph. :param sdfg: The SDFG to apply the transformation to. :return: A transformation-defined return value, which could be used
to pass analysis data out, or nothing.
-
can_be_applied
(graph, expr_index, sdfg, permissive=False)¶ Returns True if this transformation can be applied on the candidate matched subgraph. :param graph: SDFGState object in which the match was found. :param candidate: A mapping between node IDs returned from
PatternTransformation.expressions
and the nodes ingraph
.Parameters: - expr_index – The list index from
PatternTransformation.expressions
that was matched. - sdfg – The parent SDFG of the matched state.
- permissive – Whether transformation should run in permissive mode.
Returns: True if the transformation can be applied.
- expr_index – The list index from
-
classmethod
expressions
()¶ Returns a list of SDFG state subgraphs that will be matched in the subgraph isomorphism phase. Used as a pre-pass before calling
can_be_applied
.
-
in_array
¶ Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of
PatternTransformation
to represent the subgraph patterns.Example use: ``` class MyTransformation(SingleStateTransformation):
some_map_node = PatternNode(nodes.MapEntry) array = PatternNode(nodes.AccessNode)The two nodes can then be used in the transformation static methods (e.g.,
expressions
,can_be_applied
) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.
-
out_array
¶ Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of
PatternTransformation
to represent the subgraph patterns.Example use: ``` class MyTransformation(SingleStateTransformation):
some_map_node = PatternNode(nodes.MapEntry) array = PatternNode(nodes.AccessNode)The two nodes can then be used in the transformation static methods (e.g.,
expressions
,can_be_applied
) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.
-
-
class
dace.transformation.dataflow.redundant_array.
RedundantWriteSlice
(*args, **kwargs)¶ Bases:
dace.transformation.transformation.SingleStateTransformation
,dace.transformation.transformation.SimplifyPass
Detects patterns of the form View(Array) -> Array and removes the View if it is a slice.
-
apply
(graph, sdfg)¶ Applies this transformation instance on the matched pattern graph. :param sdfg: The SDFG to apply the transformation to. :return: A transformation-defined return value, which could be used
to pass analysis data out, or nothing.
-
can_be_applied
(graph, expr_index, sdfg, permissive=False)¶ Returns True if this transformation can be applied on the candidate matched subgraph. :param graph: SDFGState object in which the match was found. :param candidate: A mapping between node IDs returned from
PatternTransformation.expressions
and the nodes ingraph
.Parameters: - expr_index – The list index from
PatternTransformation.expressions
that was matched. - sdfg – The parent SDFG of the matched state.
- permissive – Whether transformation should run in permissive mode.
Returns: True if the transformation can be applied.
- expr_index – The list index from
-
classmethod
expressions
()¶ Returns a list of SDFG state subgraphs that will be matched in the subgraph isomorphism phase. Used as a pre-pass before calling
can_be_applied
.
-
in_array
¶ Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of
PatternTransformation
to represent the subgraph patterns.Example use: ``` class MyTransformation(SingleStateTransformation):
some_map_node = PatternNode(nodes.MapEntry) array = PatternNode(nodes.AccessNode)The two nodes can then be used in the transformation static methods (e.g.,
expressions
,can_be_applied
) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.
-
out_array
¶ Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of
PatternTransformation
to represent the subgraph patterns.Example use: ``` class MyTransformation(SingleStateTransformation):
some_map_node = PatternNode(nodes.MapEntry) array = PatternNode(nodes.AccessNode)The two nodes can then be used in the transformation static methods (e.g.,
expressions
,can_be_applied
) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.
-
-
class
dace.transformation.dataflow.redundant_array.
SqueezeViewRemove
(*args, **kwargs)¶ Bases:
dace.transformation.transformation.SingleStateTransformation
,dace.transformation.transformation.SimplifyPass
-
apply
(state: dace.sdfg.state.SDFGState, sdfg: dace.sdfg.sdfg.SDFG)¶ Applies this transformation instance on the matched pattern graph. :param sdfg: The SDFG to apply the transformation to. :return: A transformation-defined return value, which could be used
to pass analysis data out, or nothing.
-
can_be_applied
(state: dace.sdfg.state.SDFGState, expr_index: int, sdfg: dace.sdfg.sdfg.SDFG, permissive: bool = False)¶ Returns True if this transformation can be applied on the candidate matched subgraph. :param graph: SDFGState object in which the match was found. :param candidate: A mapping between node IDs returned from
PatternTransformation.expressions
and the nodes ingraph
.Parameters: - expr_index – The list index from
PatternTransformation.expressions
that was matched. - sdfg – The parent SDFG of the matched state.
- permissive – Whether transformation should run in permissive mode.
Returns: True if the transformation can be applied.
- expr_index – The list index from
-
classmethod
expressions
()¶ Returns a list of SDFG state subgraphs that will be matched in the subgraph isomorphism phase. Used as a pre-pass before calling
can_be_applied
.
-
in_array
¶ Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of
PatternTransformation
to represent the subgraph patterns.Example use: ``` class MyTransformation(SingleStateTransformation):
some_map_node = PatternNode(nodes.MapEntry) array = PatternNode(nodes.AccessNode)The two nodes can then be used in the transformation static methods (e.g.,
expressions
,can_be_applied
) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.
-
out_array
¶ Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of
PatternTransformation
to represent the subgraph patterns.Example use: ``` class MyTransformation(SingleStateTransformation):
some_map_node = PatternNode(nodes.MapEntry) array = PatternNode(nodes.AccessNode)The two nodes can then be used in the transformation static methods (e.g.,
expressions
,can_be_applied
) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.
-
-
class
dace.transformation.dataflow.redundant_array.
UnsqueezeViewRemove
(*args, **kwargs)¶ Bases:
dace.transformation.transformation.SingleStateTransformation
,dace.transformation.transformation.SimplifyPass
-
apply
(state: dace.sdfg.state.SDFGState, sdfg: dace.sdfg.sdfg.SDFG)¶ Applies this transformation instance on the matched pattern graph. :param sdfg: The SDFG to apply the transformation to. :return: A transformation-defined return value, which could be used
to pass analysis data out, or nothing.
-
can_be_applied
(state: dace.sdfg.state.SDFGState, expr_index: int, sdfg: dace.sdfg.sdfg.SDFG, permissive: bool = False)¶ Returns True if this transformation can be applied on the candidate matched subgraph. :param graph: SDFGState object in which the match was found. :param candidate: A mapping between node IDs returned from
PatternTransformation.expressions
and the nodes ingraph
.Parameters: - expr_index – The list index from
PatternTransformation.expressions
that was matched. - sdfg – The parent SDFG of the matched state.
- permissive – Whether transformation should run in permissive mode.
Returns: True if the transformation can be applied.
- expr_index – The list index from
-
classmethod
expressions
()¶ Returns a list of SDFG state subgraphs that will be matched in the subgraph isomorphism phase. Used as a pre-pass before calling
can_be_applied
.
-
in_array
¶ Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of
PatternTransformation
to represent the subgraph patterns.Example use: ``` class MyTransformation(SingleStateTransformation):
some_map_node = PatternNode(nodes.MapEntry) array = PatternNode(nodes.AccessNode)The two nodes can then be used in the transformation static methods (e.g.,
expressions
,can_be_applied
) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.
-
out_array
¶ Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of
PatternTransformation
to represent the subgraph patterns.Example use: ``` class MyTransformation(SingleStateTransformation):
some_map_node = PatternNode(nodes.MapEntry) array = PatternNode(nodes.AccessNode)The two nodes can then be used in the transformation static methods (e.g.,
expressions
,can_be_applied
) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.
-
-
dace.transformation.dataflow.redundant_array.
compose_and_push_back
(first, second, dims=None, popped=None)¶
-
dace.transformation.dataflow.redundant_array.
find_dims_to_pop
(a_size, b_size)¶
-
dace.transformation.dataflow.redundant_array.
pop_dims
(subset, dims)¶
dace.transformation.dataflow.redundant_array_copying module¶
Contains redundant array removal transformations.
-
class
dace.transformation.dataflow.redundant_array_copying.
RedundantArrayCopying
(*args, **kwargs)¶ Bases:
dace.transformation.transformation.SingleStateTransformation
Implements the redundant array removal transformation. Removes the last access node in pattern A -> B -> A, and the second (if possible)
-
apply
(graph, sdfg)¶ Applies this transformation instance on the matched pattern graph. :param sdfg: The SDFG to apply the transformation to. :return: A transformation-defined return value, which could be used
to pass analysis data out, or nothing.
-
can_be_applied
(graph, expr_index, sdfg, permissive=False)¶ Returns True if this transformation can be applied on the candidate matched subgraph. :param graph: SDFGState object in which the match was found. :param candidate: A mapping between node IDs returned from
PatternTransformation.expressions
and the nodes ingraph
.Parameters: - expr_index – The list index from
PatternTransformation.expressions
that was matched. - sdfg – The parent SDFG of the matched state.
- permissive – Whether transformation should run in permissive mode.
Returns: True if the transformation can be applied.
- expr_index – The list index from
-
classmethod
expressions
()¶ Returns a list of SDFG state subgraphs that will be matched in the subgraph isomorphism phase. Used as a pre-pass before calling
can_be_applied
.
-
in_array
¶ Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of
PatternTransformation
to represent the subgraph patterns.Example use: ``` class MyTransformation(SingleStateTransformation):
some_map_node = PatternNode(nodes.MapEntry) array = PatternNode(nodes.AccessNode)The two nodes can then be used in the transformation static methods (e.g.,
expressions
,can_be_applied
) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.
-
med_array
¶ Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of
PatternTransformation
to represent the subgraph patterns.Example use: ``` class MyTransformation(SingleStateTransformation):
some_map_node = PatternNode(nodes.MapEntry) array = PatternNode(nodes.AccessNode)The two nodes can then be used in the transformation static methods (e.g.,
expressions
,can_be_applied
) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.
-
out_array
¶ Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of
PatternTransformation
to represent the subgraph patterns.Example use: ``` class MyTransformation(SingleStateTransformation):
some_map_node = PatternNode(nodes.MapEntry) array = PatternNode(nodes.AccessNode)The two nodes can then be used in the transformation static methods (e.g.,
expressions
,can_be_applied
) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.
-
-
class
dace.transformation.dataflow.redundant_array_copying.
RedundantArrayCopying2
(*args, **kwargs)¶ Bases:
dace.transformation.transformation.SingleStateTransformation
Implements the redundant array removal transformation. Removes multiples of array B in pattern A -> B.
-
apply
(graph, sdfg)¶ Applies this transformation instance on the matched pattern graph. :param sdfg: The SDFG to apply the transformation to. :return: A transformation-defined return value, which could be used
to pass analysis data out, or nothing.
-
can_be_applied
(graph, expr_index, sdfg, permissive=False)¶ Returns True if this transformation can be applied on the candidate matched subgraph. :param graph: SDFGState object in which the match was found. :param candidate: A mapping between node IDs returned from
PatternTransformation.expressions
and the nodes ingraph
.Parameters: - expr_index – The list index from
PatternTransformation.expressions
that was matched. - sdfg – The parent SDFG of the matched state.
- permissive – Whether transformation should run in permissive mode.
Returns: True if the transformation can be applied.
- expr_index – The list index from
-
classmethod
expressions
()¶ Returns a list of SDFG state subgraphs that will be matched in the subgraph isomorphism phase. Used as a pre-pass before calling
can_be_applied
.
-
in_array
¶ Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of
PatternTransformation
to represent the subgraph patterns.Example use: ``` class MyTransformation(SingleStateTransformation):
some_map_node = PatternNode(nodes.MapEntry) array = PatternNode(nodes.AccessNode)The two nodes can then be used in the transformation static methods (e.g.,
expressions
,can_be_applied
) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.
-
out_array
¶ Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of
PatternTransformation
to represent the subgraph patterns.Example use: ``` class MyTransformation(SingleStateTransformation):
some_map_node = PatternNode(nodes.MapEntry) array = PatternNode(nodes.AccessNode)The two nodes can then be used in the transformation static methods (e.g.,
expressions
,can_be_applied
) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.
-
-
class
dace.transformation.dataflow.redundant_array_copying.
RedundantArrayCopying3
(*args, **kwargs)¶ Bases:
dace.transformation.transformation.SingleStateTransformation
Implements the redundant array removal transformation. Removes multiples of array B in pattern MapEntry -> B.
-
apply
(graph, sdfg)¶ Applies this transformation instance on the matched pattern graph. :param sdfg: The SDFG to apply the transformation to. :return: A transformation-defined return value, which could be used
to pass analysis data out, or nothing.
-
can_be_applied
(graph, expr_index, sdfg, permissive=False)¶ Returns True if this transformation can be applied on the candidate matched subgraph. :param graph: SDFGState object in which the match was found. :param candidate: A mapping between node IDs returned from
PatternTransformation.expressions
and the nodes ingraph
.Parameters: - expr_index – The list index from
PatternTransformation.expressions
that was matched. - sdfg – The parent SDFG of the matched state.
- permissive – Whether transformation should run in permissive mode.
Returns: True if the transformation can be applied.
- expr_index – The list index from
-
classmethod
expressions
()¶ Returns a list of SDFG state subgraphs that will be matched in the subgraph isomorphism phase. Used as a pre-pass before calling
can_be_applied
.
-
map_entry
¶ Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of
PatternTransformation
to represent the subgraph patterns.Example use: ``` class MyTransformation(SingleStateTransformation):
some_map_node = PatternNode(nodes.MapEntry) array = PatternNode(nodes.AccessNode)The two nodes can then be used in the transformation static methods (e.g.,
expressions
,can_be_applied
) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.
-
out_array
¶ Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of
PatternTransformation
to represent the subgraph patterns.Example use: ``` class MyTransformation(SingleStateTransformation):
some_map_node = PatternNode(nodes.MapEntry) array = PatternNode(nodes.AccessNode)The two nodes can then be used in the transformation static methods (e.g.,
expressions
,can_be_applied
) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.
-
-
class
dace.transformation.dataflow.redundant_array_copying.
RedundantArrayCopyingIn
(*args, **kwargs)¶ Bases:
dace.transformation.transformation.SingleStateTransformation
Implements the redundant array removal transformation. Removes the first and second access nodeds in pattern A -> B -> A
-
apply
(graph: dace.sdfg.state.SDFGState, sdfg: dace.sdfg.sdfg.SDFG)¶ Applies this transformation instance on the matched pattern graph. :param sdfg: The SDFG to apply the transformation to. :return: A transformation-defined return value, which could be used
to pass analysis data out, or nothing.
-
can_be_applied
(graph, expr_index, sdfg, permissive=False)¶ Returns True if this transformation can be applied on the candidate matched subgraph. :param graph: SDFGState object in which the match was found. :param candidate: A mapping between node IDs returned from
PatternTransformation.expressions
and the nodes ingraph
.Parameters: - expr_index – The list index from
PatternTransformation.expressions
that was matched. - sdfg – The parent SDFG of the matched state.
- permissive – Whether transformation should run in permissive mode.
Returns: True if the transformation can be applied.
- expr_index – The list index from
-
classmethod
expressions
()¶ Returns a list of SDFG state subgraphs that will be matched in the subgraph isomorphism phase. Used as a pre-pass before calling
can_be_applied
.
-
in_array
¶ Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of
PatternTransformation
to represent the subgraph patterns.Example use: ``` class MyTransformation(SingleStateTransformation):
some_map_node = PatternNode(nodes.MapEntry) array = PatternNode(nodes.AccessNode)The two nodes can then be used in the transformation static methods (e.g.,
expressions
,can_be_applied
) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.
-
med_array
¶ Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of
PatternTransformation
to represent the subgraph patterns.Example use: ``` class MyTransformation(SingleStateTransformation):
some_map_node = PatternNode(nodes.MapEntry) array = PatternNode(nodes.AccessNode)The two nodes can then be used in the transformation static methods (e.g.,
expressions
,can_be_applied
) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.
-
out_array
¶ Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of
PatternTransformation
to represent the subgraph patterns.Example use: ``` class MyTransformation(SingleStateTransformation):
some_map_node = PatternNode(nodes.MapEntry) array = PatternNode(nodes.AccessNode)The two nodes can then be used in the transformation static methods (e.g.,
expressions
,can_be_applied
) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.
-
dace.transformation.dataflow.stream_transient module¶
Contains classes that implement transformations relating to streams and transient nodes.
-
class
dace.transformation.dataflow.stream_transient.
AccumulateTransient
(*args, **kwargs)¶ Bases:
dace.transformation.transformation.SingleStateTransformation
Implements the AccumulateTransient transformation, which adds transient stream and data nodes between nested maps that lead to a stream. The transient data nodes then act as a local accumulator.
-
apply
(graph: dace.sdfg.state.SDFGState, sdfg: dace.sdfg.sdfg.SDFG)¶ Applies this transformation instance on the matched pattern graph. :param sdfg: The SDFG to apply the transformation to. :return: A transformation-defined return value, which could be used
to pass analysis data out, or nothing.
-
array
¶ Array to create local storage for (if empty, first available)
-
can_be_applied
(graph, expr_index, sdfg, permissive=False)¶ Returns True if this transformation can be applied on the candidate matched subgraph. :param graph: SDFGState object in which the match was found. :param candidate: A mapping between node IDs returned from
PatternTransformation.expressions
and the nodes ingraph
.Parameters: - expr_index – The list index from
PatternTransformation.expressions
that was matched. - sdfg – The parent SDFG of the matched state.
- permissive – Whether transformation should run in permissive mode.
Returns: True if the transformation can be applied.
- expr_index – The list index from
-
classmethod
expressions
()¶ Returns a list of SDFG state subgraphs that will be matched in the subgraph isomorphism phase. Used as a pre-pass before calling
can_be_applied
.
-
identity
¶ Identity value to set
-
map_exit
¶ Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of
PatternTransformation
to represent the subgraph patterns.Example use: ``` class MyTransformation(SingleStateTransformation):
some_map_node = PatternNode(nodes.MapEntry) array = PatternNode(nodes.AccessNode)The two nodes can then be used in the transformation static methods (e.g.,
expressions
,can_be_applied
) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.
-
outer_map_exit
¶ Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of
PatternTransformation
to represent the subgraph patterns.Example use: ``` class MyTransformation(SingleStateTransformation):
some_map_node = PatternNode(nodes.MapEntry) array = PatternNode(nodes.AccessNode)The two nodes can then be used in the transformation static methods (e.g.,
expressions
,can_be_applied
) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.
-
properties
()¶
-
-
class
dace.transformation.dataflow.stream_transient.
StreamTransient
(*args, **kwargs)¶ Bases:
dace.transformation.transformation.SingleStateTransformation
Implements the StreamTransient transformation, which adds a transient and stream nodes between nested maps that lead to a stream. The transient then acts as a local buffer.
-
apply
(graph: dace.sdfg.state.SDFGState, sdfg: dace.sdfg.sdfg.SDFG)¶ Applies this transformation instance on the matched pattern graph. :param sdfg: The SDFG to apply the transformation to. :return: A transformation-defined return value, which could be used
to pass analysis data out, or nothing.
-
can_be_applied
(graph, expr_index, sdfg, permissive=False)¶ Returns True if this transformation can be applied on the candidate matched subgraph. :param graph: SDFGState object in which the match was found. :param candidate: A mapping between node IDs returned from
PatternTransformation.expressions
and the nodes ingraph
.Parameters: - expr_index – The list index from
PatternTransformation.expressions
that was matched. - sdfg – The parent SDFG of the matched state.
- permissive – Whether transformation should run in permissive mode.
Returns: True if the transformation can be applied.
- expr_index – The list index from
-
classmethod
expressions
()¶ Returns a list of SDFG state subgraphs that will be matched in the subgraph isomorphism phase. Used as a pre-pass before calling
can_be_applied
.
-
map_exit
¶ Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of
PatternTransformation
to represent the subgraph patterns.Example use: ``` class MyTransformation(SingleStateTransformation):
some_map_node = PatternNode(nodes.MapEntry) array = PatternNode(nodes.AccessNode)The two nodes can then be used in the transformation static methods (e.g.,
expressions
,can_be_applied
) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.
-
outer_map_exit
¶ Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of
PatternTransformation
to represent the subgraph patterns.Example use: ``` class MyTransformation(SingleStateTransformation):
some_map_node = PatternNode(nodes.MapEntry) array = PatternNode(nodes.AccessNode)The two nodes can then be used in the transformation static methods (e.g.,
expressions
,can_be_applied
) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.
-
properties
()¶
-
tasklet
¶ Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of
PatternTransformation
to represent the subgraph patterns.Example use: ``` class MyTransformation(SingleStateTransformation):
some_map_node = PatternNode(nodes.MapEntry) array = PatternNode(nodes.AccessNode)The two nodes can then be used in the transformation static methods (e.g.,
expressions
,can_be_applied
) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.
-
with_buffer
¶ Use an intermediate buffer for accumulation
-
-
dace.transformation.dataflow.stream_transient.
calc_set_image
(map_idx, map_set, array_set)¶
-
dace.transformation.dataflow.stream_transient.
calc_set_image_index
(map_idx, map_set, array_idx)¶
-
dace.transformation.dataflow.stream_transient.
calc_set_image_range
(map_idx, map_set, array_range)¶
dace.transformation.dataflow.strip_mining module¶
This module contains classes and functions that implement the strip-mining transformation.
-
class
dace.transformation.dataflow.strip_mining.
StripMining
(*args, **kwargs)¶ Bases:
dace.transformation.transformation.SingleStateTransformation
Implements the strip-mining transformation.
Strip-mining takes as input a map dimension and splits it into two dimensions. The new dimension iterates over the range of the original one with a parameterizable step, called the tile size. The original dimension is changed to iterates over the range of the tile size, with the same step as before.
-
static
annotates_memlets
()¶ Indicates whether the transformation annotates the edges it creates or modifies with the appropriate memlets. This determines whether to apply memlet propagation after the transformation.
-
apply
(graph: dace.sdfg.state.SDFGState, sdfg: dace.sdfg.sdfg.SDFG) → dace.sdfg.nodes.Map¶ Applies this transformation instance on the matched pattern graph. :param sdfg: The SDFG to apply the transformation to. :return: A transformation-defined return value, which could be used
to pass analysis data out, or nothing.
-
can_be_applied
(graph, expr_index, sdfg, permissive=False)¶ Returns True if this transformation can be applied on the candidate matched subgraph. :param graph: SDFGState object in which the match was found. :param candidate: A mapping between node IDs returned from
PatternTransformation.expressions
and the nodes ingraph
.Parameters: - expr_index – The list index from
PatternTransformation.expressions
that was matched. - sdfg – The parent SDFG of the matched state.
- permissive – Whether transformation should run in permissive mode.
Returns: True if the transformation can be applied.
- expr_index – The list index from
-
dim_idx
¶ Index of dimension to be strip-mined
-
divides_evenly
¶ Tile size divides dimension range evenly?
-
classmethod
expressions
()¶ Returns a list of SDFG state subgraphs that will be matched in the subgraph isomorphism phase. Used as a pre-pass before calling
can_be_applied
.
-
map_entry
¶ Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of
PatternTransformation
to represent the subgraph patterns.Example use: ``` class MyTransformation(SingleStateTransformation):
some_map_node = PatternNode(nodes.MapEntry) array = PatternNode(nodes.AccessNode)The two nodes can then be used in the transformation static methods (e.g.,
expressions
,can_be_applied
) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.
-
match_to_str
(graph: dace.sdfg.state.SDFGState) → str¶ Returns a string representation of the pattern match on the candidate subgraph. Used when identifying matches in the console UI.
-
new_dim_prefix
¶ Prefix for new dimension name
-
properties
()¶
-
skew
¶ If True, offsets inner tile back such that it starts with zero
-
strided
¶ Continuous (false) or strided (true) elements in tile
-
tile_offset
¶ Tile stride offset (negative)
-
tile_size
¶ Tile size of strip-mined dimension, or number of tiles if tiling_type=number_of_tiles
-
tile_stride
¶ Stride between two tiles of the strip-mined dimension. If zero, it is set equal to the tile size.
-
tiling_type
¶ normal: the outerloop increments with tile_size, ceilrange: uses ceiling(N/tile_size) in outer range, number_of_tiles: tiles the map into the number of provided tiles, provide the number of tiles over tile_size
-
static
-
dace.transformation.dataflow.strip_mining.
calc_set_image
(map_idx, map_set, array_set)¶
-
dace.transformation.dataflow.strip_mining.
calc_set_image_index
(map_idx, map_set, array_idx)¶
-
dace.transformation.dataflow.strip_mining.
calc_set_image_range
(map_idx, map_set, array_range)¶
-
dace.transformation.dataflow.strip_mining.
calc_set_union
(set_a, set_b)¶
dace.transformation.dataflow.tiling module¶
This module contains classes and functions that implement the orthogonal tiling transformation.
-
class
dace.transformation.dataflow.tiling.
MapTiling
(*args, **kwargs)¶ Bases:
dace.transformation.transformation.SingleStateTransformation
Implements the orthogonal tiling transformation.
Orthogonal tiling is a type of nested map fission that creates tiles in every dimension of the matched Map.
-
static
annotates_memlets
()¶ Indicates whether the transformation annotates the edges it creates or modifies with the appropriate memlets. This determines whether to apply memlet propagation after the transformation.
-
apply
(graph: dace.sdfg.state.SDFGState, sdfg: dace.sdfg.sdfg.SDFG)¶ Applies this transformation instance on the matched pattern graph. :param sdfg: The SDFG to apply the transformation to. :return: A transformation-defined return value, which could be used
to pass analysis data out, or nothing.
-
can_be_applied
(graph, expr_index, sdfg, permissive=False)¶ Returns True if this transformation can be applied on the candidate matched subgraph. :param graph: SDFGState object in which the match was found. :param candidate: A mapping between node IDs returned from
PatternTransformation.expressions
and the nodes ingraph
.Parameters: - expr_index – The list index from
PatternTransformation.expressions
that was matched. - sdfg – The parent SDFG of the matched state.
- permissive – Whether transformation should run in permissive mode.
Returns: True if the transformation can be applied.
- expr_index – The list index from
-
divides_evenly
¶ Tile size divides dimension length evenly
-
classmethod
expressions
()¶ Returns a list of SDFG state subgraphs that will be matched in the subgraph isomorphism phase. Used as a pre-pass before calling
can_be_applied
.
-
map_entry
¶ Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of
PatternTransformation
to represent the subgraph patterns.Example use: ``` class MyTransformation(SingleStateTransformation):
some_map_node = PatternNode(nodes.MapEntry) array = PatternNode(nodes.AccessNode)The two nodes can then be used in the transformation static methods (e.g.,
expressions
,can_be_applied
) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.
-
prefix
¶ Prefix for new range symbols
-
properties
()¶
-
strides
¶ Tile stride (enables overlapping tiles). If empty, matches tile
-
tile_offset
¶ Negative Stride offset per dimension
-
tile_sizes
¶ Tile size per dimension
-
tile_trivial
¶ Tiles even if tile_size is 1
-
static
dace.transformation.dataflow.vectorization module¶
Contains classes that implement the vectorization transformation.
-
class
dace.transformation.dataflow.vectorization.
Vectorization
(*args, **kwargs)¶ Bases:
dace.transformation.transformation.SingleStateTransformation
Implements the vectorization transformation.
Vectorization matches when all the input and output memlets of a tasklet inside a map access the inner-most loop variable in their last dimension. The transformation changes the step of the inner-most loop to be equal to the length of the vector and vectorizes the memlets.
-
apply
(graph: dace.sdfg.state.SDFGState, sdfg: dace.sdfg.sdfg.SDFG)¶ Applies this transformation instance on the matched pattern graph. :param sdfg: The SDFG to apply the transformation to. :return: A transformation-defined return value, which could be used
to pass analysis data out, or nothing.
-
can_be_applied
(graph: dace.sdfg.state.SDFGState, expr_index, sdfg, permissive=False)¶ Returns True if this transformation can be applied on the candidate matched subgraph. :param graph: SDFGState object in which the match was found. :param candidate: A mapping between node IDs returned from
PatternTransformation.expressions
and the nodes ingraph
.Parameters: - expr_index – The list index from
PatternTransformation.expressions
that was matched. - sdfg – The parent SDFG of the matched state.
- permissive – Whether transformation should run in permissive mode.
Returns: True if the transformation can be applied.
- expr_index – The list index from
-
classmethod
expressions
()¶ Returns a list of SDFG state subgraphs that will be matched in the subgraph isomorphism phase. Used as a pre-pass before calling
can_be_applied
.
-
map_entry
¶ Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of
PatternTransformation
to represent the subgraph patterns.Example use: ``` class MyTransformation(SingleStateTransformation):
some_map_node = PatternNode(nodes.MapEntry) array = PatternNode(nodes.AccessNode)The two nodes can then be used in the transformation static methods (e.g.,
expressions
,can_be_applied
) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.
-
postamble
¶ Force creation or skipping a postamble map without vectors
-
preamble
¶ Force creation or skipping a preamble map without vectors
-
propagate_parent
¶ Propagate vector length through parent SDFGs
-
properties
()¶
-
strided_map
¶ Use strided map range (jump by vector length) instead of modifying memlets
-
vector_len
¶ Vector length
-
Module contents¶
This module initializes the dataflow transformations package.