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:
SingleStateTransformationImplements 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.
- Parameters:
sdfg – The SDFG to apply the transformation to.
- Returns:
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.
- Parameters:
graph – SDFGState object in which the match was found.
candidate – A mapping between node IDs returned from
PatternTransformation.expressionsand the nodes ingraph.expr_index – The list index from
PatternTransformation.expressionsthat 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.
- 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
PatternTransformationto 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
- 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:
SingleStateTransformationImplements 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, sdfg)
Applies this transformation instance on the matched pattern graph.
- Parameters:
sdfg (
SDFG) – The SDFG to apply the transformation to.- Returns:
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.
- Parameters:
graph – SDFGState object in which the match was found.
candidate – A mapping between node IDs returned from
PatternTransformation.expressionsand the nodes ingraph.expr_index – The list index from
PatternTransformation.expressionsthat 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.
- 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
PatternTransformationto 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
PatternTransformationto 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:
SingleStateTransformationImplements 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, sdfg)
Applies this transformation instance on the matched pattern graph.
- Parameters:
sdfg (
SDFG) – The SDFG to apply the transformation to.- Returns:
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.
- Parameters:
graph – SDFGState object in which the match was found.
candidate – A mapping between node IDs returned from
PatternTransformation.expressionsand the nodes ingraph.expr_index – The list index from
PatternTransformation.expressionsthat 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.
- 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
PatternTransformationto 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
PatternTransformationto 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/latest/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:
SingleStateTransformationImplements 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.
- Parameters:
sdfg – The SDFG to apply the transformation to.
- Returns:
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.
- Parameters:
graph – SDFGState object in which the match was found.
candidate – A mapping between node IDs returned from
PatternTransformation.expressionsand the nodes ingraph.expr_index – The list index from
PatternTransformation.expressionsthat 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.
- 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
PatternTransformationto 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
PatternTransformationto 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/latest/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:
LocalStorageImplements 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.
- Parameters:
graph – SDFGState object in which the match was found.
candidate – A mapping between node IDs returned from
PatternTransformation.expressionsand the nodes ingraph.expr_index – The list index from
PatternTransformation.expressionsthat 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.
- properties()
- class dace.transformation.dataflow.local_storage.LocalStorage(*args, **kwargs)
Bases:
SingleStateTransformation,ABCImplements 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, sdfg)
Applies this transformation instance on the matched pattern graph.
- Parameters:
sdfg (
SDFG) – The SDFG to apply the transformation to.- Returns:
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
PatternTransformationto 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
PatternTransformationto 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()
- class dace.transformation.dataflow.local_storage.OutLocalStorage(*args, **kwargs)
Bases:
LocalStorageImplements 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.
- Parameters:
graph – SDFGState object in which the match was found.
candidate – A mapping between node IDs returned from
PatternTransformation.expressionsand the nodes ingraph.expr_index – The list index from
PatternTransformation.expressionsthat 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.
- 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:
SingleStateTransformationImplements 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, sdfg)
Collapses two maps into one.
- can_be_applied(graph, expr_index, sdfg, permissive=False)
Returns True if this transformation can be applied on the candidate matched subgraph.
- Parameters:
graph – SDFGState object in which the match was found.
candidate – A mapping between node IDs returned from
PatternTransformation.expressionsand the nodes ingraph.expr_index – The list index from
PatternTransformation.expressionsthat 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.
- 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
PatternTransformationto 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
PatternTransformationto 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:
SingleStateTransformationImplements the map-expansion pattern.
Map-expansion takes an N-dimensional map and expands it. It will generate the k nested unidimensional map and a (N-k)-dimensional inner most map. If k is not specified all maps are expanded.
- 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, sdfg)
Applies this transformation instance on the matched pattern graph.
- Parameters:
sdfg (
SDFG) – The SDFG to apply the transformation to.- Returns:
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.
- Parameters:
graph (
SDFGState) – SDFGState object in which the match was found.candidate – A mapping between node IDs returned from
PatternTransformation.expressionsand the nodes ingraph.expr_index (
int) – The list index fromPatternTransformation.expressionsthat was matched.sdfg (
SDFG) – The parent SDFG of the matched state.permissive (
bool) – Whether transformation should run in permissive mode.
- Returns:
True if the transformation can be applied.
- expansion_limit
How many unidimensional maps will be created, known as k. If None, the default no limit is in place.
- 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.
- generate_new_maps(current_map)
- inner_schedule
Schedule for inner maps
- 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
PatternTransformationto 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_fission module
Map Fission transformation.
- class dace.transformation.dataflow.map_fission.MapFission(*args, **kwargs)
Bases:
SingleStateTransformationImplements 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:
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, sdfg)
Applies this transformation instance on the matched pattern graph.
- Parameters:
sdfg (
SDFG) – The SDFG to apply the transformation to.- Returns:
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.
- Parameters:
graph – SDFGState object in which the match was found.
candidate – A mapping between node IDs returned from
PatternTransformation.expressionsand the nodes ingraph.expr_index – The list index from
PatternTransformation.expressionsthat 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.
- 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
PatternTransformationto 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
PatternTransformationto 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:
SingleStateTransformationImplements the Map to for-loop transformation.
Takes a map and enforces a sequential schedule by transforming it into a loop region. 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, sdfg)
Applies the transformation and returns a tuple with the new nested SDFG node and the main state in the for-loop.
- Return type:
Tuple[NestedSDFG,SDFGState]
- can_be_applied(graph, expr_index, sdfg, permissive=False)
Returns True if this transformation can be applied on the candidate matched subgraph.
- Parameters:
graph – SDFGState object in which the match was found.
candidate – A mapping between node IDs returned from
PatternTransformation.expressionsand the nodes ingraph.expr_index – The list index from
PatternTransformation.expressionsthat 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.
- 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.
- loop_region: LoopRegion | None = None
- 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
PatternTransformationto 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_fusion module
- class dace.transformation.dataflow.map_fusion.MapFusion(*args, **kwargs)
Bases:
MapFusionVerticalCompatibility layer for deprecated MapFusion name.
Before there was MapFusionHorizontal there was only MapFusion, which performed the same operations as MapFusionVertical. To enable a smooth transition, this deprecated alias is provided.
dace.transformation.dataflow.map_interchange module
Implements the map interchange transformation.
- class dace.transformation.dataflow.map_interchange.MapInterchange(*args, **kwargs)
Bases:
SingleStateTransformationImplements 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, sdfg)
Applies this transformation instance on the matched pattern graph.
- Parameters:
sdfg (
SDFG) – The SDFG to apply the transformation to.- Returns:
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.
- Parameters:
graph – SDFGState object in which the match was found.
candidate – A mapping between node IDs returned from
PatternTransformation.expressionsand the nodes ingraph.expr_index – The list index from
PatternTransformation.expressionsthat 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.
- 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
PatternTransformationto 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
PatternTransformationto 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.mapreduce module
Contains classes and functions that implement the map-reduce-fusion transformation.
- class dace.transformation.dataflow.mapreduce.MapReduceFusion(*args, **kwargs)
Bases:
SingleStateTransformationImplements 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, sdfg)
Applies this transformation instance on the matched pattern graph.
- Parameters:
sdfg (
SDFG) – The SDFG to apply the transformation to.- Returns:
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.
- Parameters:
graph – SDFGState object in which the match was found.
candidate – A mapping between node IDs returned from
PatternTransformation.expressionsand the nodes ingraph.expr_index – The list index from
PatternTransformation.expressionsthat 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.
- 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
PatternTransformationto 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
PatternTransformationto 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
PatternTransformationto 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/latest/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
PatternTransformationto 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
PatternTransformationto 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:
SingleStateTransformationImplements 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, sdfg)
Applies this transformation instance on the matched pattern graph.
- Parameters:
sdfg (
SDFG) – The SDFG to apply the transformation to.- Returns:
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.
- Parameters:
graph – SDFGState object in which the match was found.
candidate – A mapping between node IDs returned from
PatternTransformation.expressionsand the nodes ingraph.expr_index – The list index from
PatternTransformation.expressionsthat 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.
- 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
PatternTransformationto 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
PatternTransformationto 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
PatternTransformationto 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
PatternTransformationto 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
PatternTransformationto 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
PatternTransformationto 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
PatternTransformationto 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
PatternTransformationto 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
PatternTransformationto 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:
SingleStateTransformationImplements 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
PatternTransformationto 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, sdfg)
Applies this transformation instance on the matched pattern graph.
- Parameters:
sdfg (
SDFG) – The SDFG to apply the transformation to.- Returns:
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
PatternTransformationto 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/latest/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
PatternTransformationto 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.
- Parameters:
graph – SDFGState object in which the match was found.
candidate – A mapping between node IDs returned from
PatternTransformation.expressionsand the nodes ingraph.expr_index – The list index from
PatternTransformation.expressionsthat 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.
- 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.
- linalg = <module 'dace.libraries.linalg' from '/home/docs/checkouts/readthedocs.org/user_builds/spcldace/checkouts/latest/dace/libraries/linalg/__init__.py'>
- 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
PatternTransformationto 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
PatternTransformationto 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:
SingleStateTransformationMerge duplicate arrays connected to the same scope entry.
- apply(graph, sdfg)
Applies this transformation instance on the matched pattern graph.
- Parameters:
sdfg – The SDFG to apply the transformation to.
- Returns:
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
PatternTransformationto 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
PatternTransformationto 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.
- Parameters:
graph (
SDFGState) – SDFGState object in which the match was found.candidate – A mapping between node IDs returned from
PatternTransformation.expressionsand the nodes ingraph.expr_index – The list index from
PatternTransformation.expressionsthat 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.
- 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
PatternTransformationto 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:
SingleStateTransformationMerge duplicate arrays that are source/sink nodes.
- apply(graph, sdfg)
Applies this transformation instance on the matched pattern graph.
- Parameters:
sdfg – The SDFG to apply the transformation to.
- Returns:
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
PatternTransformationto 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.
- Parameters:
graph – SDFGState object in which the match was found.
candidate – A mapping between node IDs returned from
PatternTransformation.expressionsand the nodes ingraph.expr_index – The list index from
PatternTransformation.expressionsthat 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.
- 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:
SingleStateTransformationMerge duplicate arrays connected to the same scope entry.
- apply(graph, sdfg)
Applies this transformation instance on the matched pattern graph.
- Parameters:
sdfg – The SDFG to apply the transformation to.
- Returns:
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
PatternTransformationto 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
PatternTransformationto 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.
- Parameters:
graph – SDFGState object in which the match was found.
candidate – A mapping between node IDs returned from
PatternTransformation.expressionsand the nodes ingraph.expr_index – The list index from
PatternTransformation.expressionsthat 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.
- 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
PatternTransformationto 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:
SingleStateTransformationImplements the MPI parallelization pattern.
Takes a map and makes it an MPI-scheduled map, introduces transients that keep locally accessed data.
Original SDFG:
Input1 - Output1 \ / Input2 --- MapEntry -- Arbitrary R -- MapExit -- Output2 / \ InputN - OutputNNothing 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, sdfg)
Applies this transformation instance on the matched pattern graph.
- Parameters:
sdfg (
SDFG) – The SDFG to apply the transformation to.- Returns:
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.
- Parameters:
graph – SDFGState object in which the match was found.
candidate – A mapping between node IDs returned from
PatternTransformation.expressionsand the nodes ingraph.expr_index – The list index from
PatternTransformation.expressionsthat 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.
- 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
PatternTransformationto 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.otf_map_fusion module
This module contains classes that implement the OTF map fusion transformation.
- class dace.transformation.dataflow.otf_map_fusion.OTFMapFusion(*args, **kwargs)
Bases:
SingleStateTransformationPerforms fusion of two maps by replicating the contents of the first into the second map until all the input dependencies (memlets) of the second one are met.
- apply(graph, sdfg)
Applies this transformation instance on the matched pattern graph.
- Parameters:
sdfg (
SDFG) – The SDFG to apply the transformation to.- Returns:
A transformation-defined return value, which could be used to pass analysis data out, or nothing.
- 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
PatternTransformationto 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.
- Parameters:
graph – SDFGState object in which the match was found.
candidate – A mapping between node IDs returned from
PatternTransformation.expressionsand the nodes ingraph.expr_index – The list index from
PatternTransformation.expressionsthat 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.
- 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.
- 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
PatternTransformationto 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.
- identity
Identity value to set
- properties()
- 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
PatternTransformationto 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 solve(first_params, write_accesses, second_params, read_accesses)
Infers the memory access for the write memlet given the location/parameters of the read access.
Example: - Write memlet:
A[i + 1, j]- Read memlet:A[k, l]- Infer:k -> i - 1, l - > j- Parameters:
first_params (
List[str]) – parameters of the first_map_entry.write_accesses (
Tuple) – subset ranges of the write memlet.second_params (
List[str]) – parameters of the second map_entry.read_accesses (
Tuple) – subset ranges of the read memlet.
- Returns:
mapping of parameters.
- dace.transformation.dataflow.otf_map_fusion.advanced_replace(subgraph, s, s_)
- Return type:
None
dace.transformation.dataflow.reduce_expansion module
This module contains classes that implement the reduce-map transformation.
- class dace.transformation.dataflow.reduce_expansion.ReduceExpansion(*args, **kwargs)
Bases:
SingleStateTransformationImplements the ReduceExpansion transformation. Expands a Reduce node into inner and outer map components, where the outer map consists of the axes not being reduced. A new reduce node is created inside the inner map. Special cases where e.g reduction identities are not defined and arrays being reduced to already exist are handled on the fly.
- apply(graph, sdfg)
Splits the data dimension into an inner and outer dimension, where the inner dimension are the reduction axes and the outer axes the complement. Pushes the reduce inside a new map consisting of the complement axes.
- can_be_applied(graph, expr_index, sdfg, permissive=False)
Returns True if this transformation can be applied on the candidate matched subgraph.
- Parameters:
graph – SDFGState object in which the match was found.
candidate – A mapping between node IDs returned from
PatternTransformation.expressionsand the nodes ingraph.expr_index – The list index from
PatternTransformation.expressionsthat 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.
- create_in_transient
Create local in-transientin registers
- create_out_transient
Create local out-transientin registers
- debug
Debug Info
- expand(sdfg, graph, reduce_node)
Splits the data dimension into an inner and outer dimension, where the inner dimension are the reduction axes and the outer axes the complement. Pushes the reduce inside a new map consisting of the complement axes.
- 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.
- 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
PatternTransformationto 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.
- reduce_implementation
Reduce implementation of inner reduce. If specified,overrides any existing implementations
- reduction_type_identity = {ReductionType.Bitwise_Or: 0, ReductionType.Logical_And: True, ReductionType.Logical_Or: False, ReductionType.Product: 1, ReductionType.Sum: 0}
- reduction_type_update = {ReductionType.Bitwise_And: 'out = reduction_in & array_in', ReductionType.Bitwise_Or: 'out = reduction_in | array_in', ReductionType.Bitwise_Xor: 'out = reduction_in ^ array_in', ReductionType.Logical_And: 'out = reduction_in and array_in', ReductionType.Logical_Or: 'out = reduction_in or array_in', ReductionType.Logical_Xor: 'out = reduction_in != array_in', ReductionType.Max: 'out = max(reduction_in, array_in)', ReductionType.Min: 'out = min(reduction_in, array_in)', ReductionType.Product: 'out = reduction_in * array_in', ReductionType.Sum: 'out = reduction_in + array_in'}
- stdlib = <module 'dace.libraries.standard' from '/home/docs/checkouts/readthedocs.org/user_builds/spcldace/checkouts/latest/dace/libraries/standard/__init__.py'>
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:
SingleStateTransformationImplements 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.
- Parameters:
sdfg – The SDFG to apply the transformation to.
- Returns:
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.
- Parameters:
graph (
SDFGState) – SDFGState object in which the match was found.candidate – A mapping between node IDs returned from
PatternTransformation.expressionsand the nodes ingraph.expr_index – The list index from
PatternTransformation.expressionsthat 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.
- 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
PatternTransformationto 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
PatternTransformationto 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:
SingleStateTransformationDetects 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.
- Parameters:
sdfg – The SDFG to apply the transformation to.
- Returns:
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.
- Parameters:
graph – SDFGState object in which the match was found.
candidate – A mapping between node IDs returned from
PatternTransformation.expressionsand the nodes ingraph.expr_index – The list index from
PatternTransformation.expressionsthat 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.
- 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
PatternTransformationto 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
PatternTransformationto 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:
SingleStateTransformationImplements 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, sdfg)
Applies this transformation instance on the matched pattern graph.
- Parameters:
sdfg (
SDFG) – The SDFG to apply the transformation to.- Returns:
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.
- Parameters:
graph – SDFGState object in which the match was found.
candidate – A mapping between node IDs returned from
PatternTransformation.expressionsand the nodes ingraph.expr_index – The list index from
PatternTransformation.expressionsthat 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.
- 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
PatternTransformationto 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
PatternTransformationto 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:
SingleStateTransformationDetects 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.
- Parameters:
sdfg – The SDFG to apply the transformation to.
- Returns:
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.
- Parameters:
graph – SDFGState object in which the match was found.
candidate – A mapping between node IDs returned from
PatternTransformation.expressionsand the nodes ingraph.expr_index – The list index from
PatternTransformation.expressionsthat 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.
- 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
PatternTransformationto 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
PatternTransformationto 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.RemoveIntermediateWrite(*args, **kwargs)
Bases:
SingleStateTransformationMoves intermediate writes insde a Map’s subgraph outside the Map.
Currently, the transformation supports only the case WriteAccess -> MapExit, where the edge has an empty Memlet.
- apply(state, sdfg)
Applies this transformation instance on the matched pattern graph.
- Parameters:
sdfg (
SDFG) – The SDFG to apply the transformation to.- Returns:
A transformation-defined return value, which could be used to pass analysis data out, or nothing.
- can_be_applied(state, _, sdfg, permissive=False)
Returns True if this transformation can be applied on the candidate matched subgraph.
- Parameters:
graph – SDFGState object in which the match was found.
candidate – A mapping between node IDs returned from
PatternTransformation.expressionsand the nodes ingraph.expr_index – The list index from
PatternTransformation.expressionsthat was matched.sdfg (
SDFG) – The parent SDFG of the matched state.permissive – Whether transformation should run in permissive mode.
- Returns:
True if the transformation can be applied.
- 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
PatternTransformationto 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.
- write
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
PatternTransformationto 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.RemoveSliceView(*args, **kwargs)
Bases:
SingleStateTransformationRemoves views which can be represented by slicing (e.g., A[i, :, j, None]).
- apply(state, sdfg)
Applies this transformation instance on the matched pattern graph.
- Parameters:
sdfg (
SDFG) – The SDFG to apply the transformation to.- Returns:
A transformation-defined return value, which could be used to pass analysis data out, or nothing.
- can_be_applied(state, _, sdfg, permissive=False)
Returns True if this transformation can be applied on the candidate matched subgraph.
- Parameters:
graph – SDFGState object in which the match was found.
candidate – A mapping between node IDs returned from
PatternTransformation.expressionsand the nodes ingraph.expr_index – The list index from
PatternTransformation.expressionsthat was matched.sdfg (
SDFG) – The parent SDFG of the matched state.permissive – Whether transformation should run in permissive mode.
- Returns:
True if the transformation can be applied.
- 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.
- view
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
PatternTransformationto 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:
SingleStateTransformation- apply(state, sdfg)
Applies this transformation instance on the matched pattern graph.
- Parameters:
sdfg (
SDFG) – The SDFG to apply the transformation to.- Returns:
A transformation-defined return value, which could be used to pass analysis data out, or nothing.
- can_be_applied(state, expr_index, sdfg, permissive=False)
Returns True if this transformation can be applied on the candidate matched subgraph.
- Parameters:
graph – SDFGState object in which the match was found.
candidate – A mapping between node IDs returned from
PatternTransformation.expressionsand the nodes ingraph.expr_index (
int) – The list index fromPatternTransformation.expressionsthat was matched.sdfg (
SDFG) – The parent SDFG of the matched state.permissive (
bool) – Whether transformation should run in permissive mode.
- Returns:
True if the transformation can be applied.
- 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
PatternTransformationto 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
PatternTransformationto 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:
SingleStateTransformation- apply(state, sdfg)
Applies this transformation instance on the matched pattern graph.
- Parameters:
sdfg (
SDFG) – The SDFG to apply the transformation to.- Returns:
A transformation-defined return value, which could be used to pass analysis data out, or nothing.
- can_be_applied(state, expr_index, sdfg, permissive=False)
Returns True if this transformation can be applied on the candidate matched subgraph.
- Parameters:
graph – SDFGState object in which the match was found.
candidate – A mapping between node IDs returned from
PatternTransformation.expressionsand the nodes ingraph.expr_index (
int) – The list index fromPatternTransformation.expressionsthat was matched.sdfg (
SDFG) – The parent SDFG of the matched state.permissive (
bool) – Whether transformation should run in permissive mode.
- Returns:
True if the transformation can be applied.
- 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
PatternTransformationto 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
PatternTransformationto 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)
Determine how the first subset has to be squeezed to get to the dimension of the second subset.
Essentially the function determines which dimensions from the subset
Ahave to be removed to get down to the dimensionality of subsetB. In case they have the same dimensionality an empty list is returned. It is important that this function does not operates on the actual subsets but on their sizes.- Returns:
The function will return the list of dimensions that have to be removed in subset
Ato bring it to the same dimensionality as subsetB.- Note:
This function is wrong. However, every attempt of fixing it resulted in breaking other things in strange ways. The only solution would be to redo all transformations. For example, consider the following cases:
a_size := [3, 3], b_size := [9]in this case the function will return[0, 1], whichmight be correct in some cases but not in other, depending on the strides of
A
- While the example above can make sense the following example,
a_size := [4, 4], b_size := [9]which also results in[0, 1]does not make sense and is clearly wrong.
- If a size is listed multiple times, for example
a_size := [1, 1, 5], b := [1, 5]then the function will return
[]although it should return[0]or[1].
- If a size is listed multiple times, for example
- Furthermore, if not all dimensions could be matched then some unspecific value is
returned, for example
a_size := [1, 3, 5], b_size := [1, 8]will return[1, 2]. Note that this in particular is not a real case scenario as it is clearly an error in the subsets.
There is an improved version,
find_dims_to_pop2()which has a better behaviour.
- Parameters:
- Return type:
List[int]- Returns:
The function will return the list of dimensions that have to be removed in subset
Ato bring it to the same dimensionality as subsetB.
- dace.transformation.dataflow.redundant_array.find_dims_to_pop2(a_size, b_size)
Determine how the first subset has to be squeezed to get to the dimension of the second subset.
Essentially the function determines which dimensions from the subset
Ahave to be removed to get down to the dimensionality of subsetB. In case they have the same dimensionality an empty list is returned. A base assumption is the function is that a View is not used to modify the relative order of dimensions, i.e. only dummy dimensions are inserted at certain locations. It is important that this function does not operates on the actual subsets but on their sizes.This is an improved version of
find_dims_to_pop().- Returns:
The function will return the list of dimensions that have to be removed in subset
Ato bring it to the same dimensionality as subsetB. In case the function failed to associate allBdimensions to a correspondingAdimension the function returns None.- Note:
This function behaves differently than
find_dims_to_pop()in some cases. In most cases the function ensures that a matching has been found. Keep in mind that the function assumes that the relative ordering of dimensions is the same on the source and the destination.
- Parameters:
- Return type:
List[int] |None- Returns:
The function will return the list of dimensions that have to be removed in subset
Ato bring it to the same dimensionality as subsetB. In case the function failed to associate allBdimensions to a correspondingAdimension the function returnsNone.
- 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:
SingleStateTransformationImplements 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.
- Parameters:
sdfg – The SDFG to apply the transformation to.
- Returns:
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.
- Parameters:
graph – SDFGState object in which the match was found.
candidate – A mapping between node IDs returned from
PatternTransformation.expressionsand the nodes ingraph.expr_index – The list index from
PatternTransformation.expressionsthat 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.
- 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
PatternTransformationto 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
PatternTransformationto 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
PatternTransformationto 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:
SingleStateTransformationImplements 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.
- Parameters:
sdfg – The SDFG to apply the transformation to.
- Returns:
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.
- Parameters:
graph – SDFGState object in which the match was found.
candidate – A mapping between node IDs returned from
PatternTransformation.expressionsand the nodes ingraph.expr_index – The list index from
PatternTransformation.expressionsthat 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.
- 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
PatternTransformationto 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
PatternTransformationto 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:
SingleStateTransformationImplements 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.
- Parameters:
sdfg – The SDFG to apply the transformation to.
- Returns:
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.
- Parameters:
graph – SDFGState object in which the match was found.
candidate – A mapping between node IDs returned from
PatternTransformation.expressionsand the nodes ingraph.expr_index – The list index from
PatternTransformation.expressionsthat 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.
- 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
PatternTransformationto 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
PatternTransformationto 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:
SingleStateTransformationImplements the redundant array removal transformation. Removes the first and second access nodeds in pattern A -> B -> A
- apply(graph, sdfg)
Applies this transformation instance on the matched pattern graph.
- Parameters:
sdfg (
SDFG) – The SDFG to apply the transformation to.- Returns:
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.
- Parameters:
graph – SDFGState object in which the match was found.
candidate – A mapping between node IDs returned from
PatternTransformation.expressionsand the nodes ingraph.expr_index – The list index from
PatternTransformation.expressionsthat 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.
- 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
PatternTransformationto 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
PatternTransformationto 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
PatternTransformationto 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.streaming_memory module
- class dace.transformation.dataflow.streaming_memory.StreamingComposition(*args, **kwargs)
Bases:
SingleStateTransformationConverts two connected computations (nodes, map scopes) into two separate processing elements, with a stream connecting the results. Only applies if the memory access patterns of the two computations match.
- access
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
PatternTransformationto 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(state, sdfg)
Applies this transformation instance on the matched pattern graph.
- Parameters:
sdfg (
SDFG) – The SDFG to apply the transformation to.- Return type:
- Returns:
A transformation-defined return value, which could be used to pass analysis data out, or nothing.
- buffer_size
Set buffer size for the newly-created stream
- can_be_applied(graph, expr_index, sdfg, permissive=False)
Returns True if this transformation can be applied on the candidate matched subgraph.
- Parameters:
graph (
SDFGState) – SDFGState object in which the match was found.candidate – A mapping between node IDs returned from
PatternTransformation.expressionsand the nodes ingraph.expr_index (
int) – The list index fromPatternTransformation.expressionsthat was matched.sdfg (
SDFG) – The parent SDFG of the matched state.permissive (
bool) – Whether transformation should run in permissive mode.
- Return type:
bool- Returns:
True if the transformation can be applied.
- 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.- Return type:
List[SubgraphView]
- first
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
PatternTransformationto 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()
- second
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
PatternTransformationto 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.
- storage
Set storage type for the newly-created stream
- class dace.transformation.dataflow.streaming_memory.StreamingMemory(*args, **kwargs)
Bases:
SingleStateTransformationConverts a read or a write to streaming memory access, where data is read/written to/from a stream in a separate connected component than the computation. If ‘use_memory_buffering’ is True, the transformation reads/writes data from memory using a wider data format (e.g. 512 bits), and then convert it on the fly to the right data type used by the computation:
- access
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
PatternTransformationto 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(state, sdfg)
Applies this transformation instance on the matched pattern graph.
- Parameters:
sdfg (
SDFG) – The SDFG to apply the transformation to.- Return type:
- Returns:
A transformation-defined return value, which could be used to pass analysis data out, or nothing.
- buffer_size
Set buffer size for the newly-created stream
- can_be_applied(graph, expr_index, sdfg, permissive=False)
Returns True if this transformation can be applied on the candidate matched subgraph.
- Parameters:
graph (
SDFGState) – SDFGState object in which the match was found.candidate – A mapping between node IDs returned from
PatternTransformation.expressionsand the nodes ingraph.expr_index (
int) – The list index fromPatternTransformation.expressionsthat was matched.sdfg (
SDFG) – The parent SDFG of the matched state.permissive (
bool) – Whether transformation should run in permissive mode.
- Return type:
bool- Returns:
True if the transformation can be applied.
- 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
PatternTransformationto 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.
- 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
PatternTransformationto 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.
- 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.- Return type:
List[SubgraphView]
- memory_buffering_target_bytes
Set bytes read/written from memory if memory buffering is enabled.
- properties()
- storage
Set storage type for the newly-created stream
- use_memory_buffering
Set if memory buffering should be used.
- dace.transformation.dataflow.streaming_memory.get_post_state(sdfg, state)
Returns the post state (the state that copies the data a back from the FGPA device) if there is one.
- dace.transformation.dataflow.streaming_memory.is_int(i)
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:
SingleStateTransformationImplements 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, sdfg)
Applies this transformation instance on the matched pattern graph.
- Parameters:
sdfg (
SDFG) – The SDFG to apply the transformation to.- Returns:
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.
- Parameters:
graph – SDFGState object in which the match was found.
candidate – A mapping between node IDs returned from
PatternTransformation.expressionsand the nodes ingraph.expr_index – The list index from
PatternTransformation.expressionsthat 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.
- 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
PatternTransformationto 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
PatternTransformationto 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:
SingleStateTransformationImplements 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, sdfg)
Applies this transformation instance on the matched pattern graph.
- Parameters:
sdfg (
SDFG) – The SDFG to apply the transformation to.- Returns:
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.
- Parameters:
graph – SDFGState object in which the match was found.
candidate – A mapping between node IDs returned from
PatternTransformation.expressionsand the nodes ingraph.expr_index – The list index from
PatternTransformation.expressionsthat 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.
- 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
PatternTransformationto 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
PatternTransformationto 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
PatternTransformationto 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:
SingleStateTransformationImplements the strip-mining transformation.
TODO: Update doc 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, sdfg)
Applies this transformation instance on the matched pattern graph.
- can_be_applied(graph, expr_index, sdfg, permissive=False)
Returns True if this transformation can be applied on the candidate matched subgraph.
- Parameters:
graph – SDFGState object in which the match was found.
candidate – A mapping between node IDs returned from
PatternTransformation.expressionsand the nodes ingraph.expr_index – The list index from
PatternTransformation.expressionsthat 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.
- 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
PatternTransformationto 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.
- Return type:
str
- 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
- 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:
SingleStateTransformationImplements 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, sdfg)
Applies this transformation instance on the matched pattern graph.
- Parameters:
sdfg (
SDFG) – The SDFG to apply the transformation to.- Returns:
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.
- Parameters:
graph – SDFGState object in which the match was found.
candidate – A mapping between node IDs returned from
PatternTransformation.expressionsand the nodes ingraph.expr_index – The list index from
PatternTransformation.expressionsthat 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.
- 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
PatternTransformationto 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()
- skew
If True, offsets inner tile back such that it starts with zero
- 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
dace.transformation.dataflow.vectorization module
Contains classes that implement the vectorization transformation.
- class dace.transformation.dataflow.vectorization.Vectorization(*args, **kwargs)
Bases:
SingleStateTransformationImplements 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, sdfg)
Applies this transformation instance on the matched pattern graph.
- Parameters:
sdfg (
SDFG) – The SDFG to apply the transformation to.- Returns:
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.
- Parameters:
graph (
SDFGState) – SDFGState object in which the match was found.candidate – A mapping between node IDs returned from
PatternTransformation.expressionsand the nodes ingraph.expr_index – The list index from
PatternTransformation.expressionsthat 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.
- 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
PatternTransformationto 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
dace.transformation.dataflow.warp_tiling module
- class dace.transformation.dataflow.warp_tiling.WarpTiling(*args, **kwargs)
Bases:
SingleStateTransformationImplements a GPU specialization tiling that takes a GPU kernel map (with nested maps, but without explicit block sizes) and divides its work across a warp. Specifically, it tiles its contents by a configurable warp size (default: 32), and optionally preferring recomputation (map replication) over local storage within the kernel. If write-conflicted reductions happen within the given map, the transformation adds warp reductions to the tiles.
- apply(graph, sdfg)
Applies this transformation instance on the matched pattern graph.
- can_be_applied(graph, expr_index, sdfg, permissive)
Returns True if this transformation can be applied on the candidate matched subgraph.
- Parameters:
graph (
SDFGState) – SDFGState object in which the match was found.candidate – A mapping between node IDs returned from
PatternTransformation.expressionsand the nodes ingraph.expr_index – The list index from
PatternTransformation.expressionsthat was matched.sdfg (
SDFG) – The parent SDFG of the matched state.permissive – Whether transformation should run in permissive mode.
- Return type:
bool- Returns:
True if the transformation can be applied.
- 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.
- mapentry
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
PatternTransformationto 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()
- replicate_maps
Replicate tiled maps that lead to multiple other tiled maps
- warp_size
Hardware warp size
Module contents
This module initializes the dataflow transformations package.