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: SingleStateTransformation

Implements the copy-to-device transformation, which copies a nested SDFG and its dependencies to a given device.

The transformation changes all data storage types of a nested SDFG to the given storage property, and creates new arrays and copies around the nested SDFG to that storage.

static annotates_memlets()

Indicates whether the transformation annotates the edges it creates or modifies with the appropriate memlets. This determines whether to apply memlet propagation after the transformation.

apply(state, sdfg)

Applies this transformation instance on the matched pattern graph.

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.expressions and the nodes in graph.

  • expr_index – The list index from PatternTransformation.expressions that was matched.

  • sdfg – The parent SDFG of the matched state.

  • permissive – Whether transformation should run in permissive mode.

Returns:

True if the transformation can be applied.

classmethod expressions()

Returns a list of SDFG state subgraphs that will be matched in the subgraph isomorphism phase. Used as a pre-pass before calling can_be_applied.

nested_sdfg

Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of PatternTransformation to represent the subgraph patterns.

Example use:

class MyTransformation(SingleStateTransformation):
    some_map_node = PatternNode(nodes.MapEntry)
    array = PatternNode(nodes.AccessNode)

The two nodes can then be used in the transformation static methods (e.g., expressions, can_be_applied) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.

properties()
storage

Nested SDFG storage

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: SingleStateTransformation

Implements the double buffering pattern, which pipelines reading and processing data by creating a second copy of the memory. In particular, the transformation takes a 1D map and all internal (directly connected) transients, adds an additional dimension of size 2, and turns the map into a for loop that processes and reads the data in a double-buffered manner. Other memlets will not be transformed.

apply(graph, 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.expressions and the nodes in graph.

  • expr_index – The list index from PatternTransformation.expressions that was matched.

  • sdfg – The parent SDFG of the matched state.

  • permissive – Whether transformation should run in permissive mode.

Returns:

True if the transformation can be applied.

classmethod expressions()

Returns a list of SDFG state subgraphs that will be matched in the subgraph isomorphism phase. Used as a pre-pass before calling can_be_applied.

map_entry

Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of PatternTransformation to represent the subgraph patterns.

Example use:

class MyTransformation(SingleStateTransformation):
    some_map_node = PatternNode(nodes.MapEntry)
    array = PatternNode(nodes.AccessNode)

The two nodes can then be used in the transformation static methods (e.g., expressions, can_be_applied) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.

transient

Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of PatternTransformation to represent the subgraph patterns.

Example use:

class MyTransformation(SingleStateTransformation):
    some_map_node = PatternNode(nodes.MapEntry)
    array = PatternNode(nodes.AccessNode)

The two nodes can then be used in the transformation static methods (e.g., expressions, can_be_applied) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.

dace.transformation.dataflow.gpu_transform module

Contains the GPU Transform Map transformation.

class dace.transformation.dataflow.gpu_transform.GPUTransformMap(*args, **kwargs)

Bases: SingleStateTransformation

Implements the GPUTransformMap transformation.

Converts a single map to a GPU-scheduled map and creates GPU arrays outside it, generating CPU<->GPU memory copies automatically.

apply(graph, 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.expressions and the nodes in graph.

  • expr_index – The list index from PatternTransformation.expressions that was matched.

  • sdfg – The parent SDFG of the matched state.

  • permissive – Whether transformation should run in permissive mode.

Returns:

True if the transformation can be applied.

classmethod expressions()

Returns a list of SDFG state subgraphs that will be matched in the subgraph isomorphism phase. Used as a pre-pass before calling can_be_applied.

fullcopy

Copy whole arrays rather than used subset

map_entry

Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of PatternTransformation to represent the subgraph patterns.

Example use:

class MyTransformation(SingleStateTransformation):
    some_map_node = PatternNode(nodes.MapEntry)
    array = PatternNode(nodes.AccessNode)

The two nodes can then be used in the transformation static methods (e.g., expressions, can_be_applied) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.

match_to_str(graph)

Returns a string representation of the pattern match on the candidate subgraph. Used when identifying matches in the console UI.

properties()
reduce

Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of PatternTransformation to represent the subgraph patterns.

Example use:

class MyTransformation(SingleStateTransformation):
    some_map_node = PatternNode(nodes.MapEntry)
    array = PatternNode(nodes.AccessNode)

The two nodes can then be used in the transformation static methods (e.g., expressions, can_be_applied) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.

register_trans

Make all transients inside GPU maps registers

sequential_innermaps

Make all internal maps Sequential

stdlib = <module 'dace.libraries.standard' from '/home/docs/checkouts/readthedocs.org/user_builds/spcldace/checkouts/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: SingleStateTransformation

Implements the GPUTransformLocalStorage transformation.

Similar to GPUTransformMap, but takes multiple maps leading from the same data node into account, creating a local storage for each range.

Seealso:

GPUTransformMap

apply(graph, sdfg)

Applies this transformation instance on the matched pattern graph.

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.expressions and the nodes in graph.

  • expr_index – The list index from PatternTransformation.expressions that was matched.

  • sdfg – The parent SDFG of the matched state.

  • permissive – Whether transformation should run in permissive mode.

Returns:

True if the transformation can be applied.

classmethod expressions()

Returns a list of SDFG state subgraphs that will be matched in the subgraph isomorphism phase. Used as a pre-pass before calling can_be_applied.

fullcopy

Copy whole arrays rather than used subset

map_entry

Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of PatternTransformation to represent the subgraph patterns.

Example use:

class MyTransformation(SingleStateTransformation):
    some_map_node = PatternNode(nodes.MapEntry)
    array = PatternNode(nodes.AccessNode)

The two nodes can then be used in the transformation static methods (e.g., expressions, can_be_applied) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.

match_to_str(graph)

Returns a string representation of the pattern match on the candidate subgraph. Used when identifying matches in the console UI.

nested_seq

Makes nested code semantically-equivalent to single-core code,transforming nested maps and memory into sequential and local memory respectively.

properties()
reduce

Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of PatternTransformation to represent the subgraph patterns.

Example use:

class MyTransformation(SingleStateTransformation):
    some_map_node = PatternNode(nodes.MapEntry)
    array = PatternNode(nodes.AccessNode)

The two nodes can then be used in the transformation static methods (e.g., expressions, can_be_applied) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.

stdlib = <module 'dace.libraries.standard' from '/home/docs/checkouts/readthedocs.org/user_builds/spcldace/checkouts/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: LocalStorage

Implements the InLocalStorage transformation, which adds a transient data node between two scope entry nodes.

can_be_applied(graph, expr_index, sdfg, permissive=False)

Returns True if this transformation can be applied on the candidate matched subgraph.

Parameters:
  • graph – SDFGState object in which the match was found.

  • candidate – A mapping between node IDs returned from PatternTransformation.expressions and the nodes in graph.

  • expr_index – The list index from PatternTransformation.expressions that was matched.

  • sdfg – The parent SDFG of the matched state.

  • permissive – Whether transformation should run in permissive mode.

Returns:

True if the transformation can be applied.

properties()
class dace.transformation.dataflow.local_storage.LocalStorage(*args, **kwargs)

Bases: SingleStateTransformation, ABC

Implements the Local Storage prototype transformation, which adds a transient data node between two nodes.

static annotates_memlets()

Indicates whether the transformation annotates the edges it creates or modifies with the appropriate memlets. This determines whether to apply memlet propagation after the transformation.

apply(graph, 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 PatternTransformation to represent the subgraph patterns.

Example use:

class MyTransformation(SingleStateTransformation):
    some_map_node = PatternNode(nodes.MapEntry)
    array = PatternNode(nodes.AccessNode)

The two nodes can then be used in the transformation static methods (e.g., expressions, can_be_applied) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.

node_b

Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of PatternTransformation to represent the subgraph patterns.

Example use:

class MyTransformation(SingleStateTransformation):
    some_map_node = PatternNode(nodes.MapEntry)
    array = PatternNode(nodes.AccessNode)

The two nodes can then be used in the transformation static methods (e.g., expressions, can_be_applied) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.

prefix

Prefix for new data node

properties()
class dace.transformation.dataflow.local_storage.OutLocalStorage(*args, **kwargs)

Bases: LocalStorage

Implements the OutLocalStorage transformation, which adds a transient data node between two scope exit nodes.

can_be_applied(graph, expr_index, sdfg, permissive=False)

Returns True if this transformation can be applied on the candidate matched subgraph.

Parameters:
  • graph – SDFGState object in which the match was found.

  • candidate – A mapping between node IDs returned from PatternTransformation.expressions and the nodes in graph.

  • expr_index – The list index from PatternTransformation.expressions that was matched.

  • sdfg – The parent SDFG of the matched state.

  • permissive – Whether transformation should run in permissive mode.

Returns:

True if the transformation can be applied.

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: SingleStateTransformation

Implements the Map Collapse pattern.

Map-collapse takes two nested maps with M and N dimensions respectively, and collapses them to a single M+N dimensional map.

apply(graph, sdfg)

Collapses two maps into one.

Parameters:

sdfg (SDFG) – The SDFG to apply the transformation to.

Return type:

Tuple[MapEntry, MapExit]

Returns:

A 2-tuple of the new map entry and exit nodes.

can_be_applied(graph, expr_index, sdfg, permissive=False)

Returns True if this transformation can be applied on the candidate matched subgraph.

Parameters:
  • graph – SDFGState object in which the match was found.

  • candidate – A mapping between node IDs returned from PatternTransformation.expressions and the nodes in graph.

  • expr_index – The list index from PatternTransformation.expressions that was matched.

  • sdfg – The parent SDFG of the matched state.

  • permissive – Whether transformation should run in permissive mode.

Returns:

True if the transformation can be applied.

classmethod expressions()

Returns a list of SDFG state subgraphs that will be matched in the subgraph isomorphism phase. Used as a pre-pass before calling can_be_applied.

inner_map_entry

Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of PatternTransformation to represent the subgraph patterns.

Example use:

class MyTransformation(SingleStateTransformation):
    some_map_node = PatternNode(nodes.MapEntry)
    array = PatternNode(nodes.AccessNode)

The two nodes can then be used in the transformation static methods (e.g., expressions, can_be_applied) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.

match_to_str(graph)

Returns a string representation of the pattern match on the candidate subgraph. Used when identifying matches in the console UI.

outer_map_entry

Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of PatternTransformation to represent the subgraph patterns.

Example use:

class MyTransformation(SingleStateTransformation):
    some_map_node = PatternNode(nodes.MapEntry)
    array = PatternNode(nodes.AccessNode)

The two nodes can then be used in the transformation static methods (e.g., expressions, can_be_applied) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.

properties()

dace.transformation.dataflow.map_expansion module

Contains classes that implement the map-expansion transformation.

class dace.transformation.dataflow.map_expansion.MapExpansion(*args, **kwargs)

Bases: SingleStateTransformation

Implements 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:
  1. If there are no edges coming from the outside, use empty memlets

  2. Edges with IN_* connectors replicate along the maps

  3. 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.expressions and the nodes in graph.

  • expr_index (int) – The list index from PatternTransformation.expressions that 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 creaed, 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 PatternTransformation to represent the subgraph patterns.

Example use:

class MyTransformation(SingleStateTransformation):
    some_map_node = PatternNode(nodes.MapEntry)
    array = PatternNode(nodes.AccessNode)

The two nodes can then be used in the transformation static methods (e.g., expressions, can_be_applied) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.

properties()

dace.transformation.dataflow.map_fission module

Map Fission transformation.

class dace.transformation.dataflow.map_fission.MapFission(*args, **kwargs)

Bases: SingleStateTransformation

Implements the MapFission transformation. Map fission refers to subsuming a map scope into its internal subgraph, essentially replicating the map into maps in all of its internal components. This also extends the dimensions of “border” transient arrays (i.e., those between the maps), in order to retain program semantics after fission.

There are two cases that match map fission:

  1. A map with an arbitrary subgraph with more than one computational (i.e., non-access) node. The use of arrays connecting the computational nodes must be limited to the subgraph, and non transient arrays may not be used as “border” arrays.

  2. 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.expressions and the nodes in graph.

  • expr_index – The list index from PatternTransformation.expressions that was matched.

  • sdfg – The parent SDFG of the matched state.

  • permissive – Whether transformation should run in permissive mode.

Returns:

True if the transformation can be applied.

classmethod expressions()

Returns a list of SDFG state subgraphs that will be matched in the subgraph isomorphism phase. Used as a pre-pass before calling can_be_applied.

map_entry

Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of PatternTransformation to represent the subgraph patterns.

Example use:

class MyTransformation(SingleStateTransformation):
    some_map_node = PatternNode(nodes.MapEntry)
    array = PatternNode(nodes.AccessNode)

The two nodes can then be used in the transformation static methods (e.g., expressions, can_be_applied) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.

nested_sdfg

Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of PatternTransformation to represent the subgraph patterns.

Example use:

class MyTransformation(SingleStateTransformation):
    some_map_node = PatternNode(nodes.MapEntry)
    array = PatternNode(nodes.AccessNode)

The two nodes can then be used in the transformation static methods (e.g., expressions, can_be_applied) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.

dace.transformation.dataflow.map_for_loop module

This module contains classes that implement a map->for loop transformation.

class dace.transformation.dataflow.map_for_loop.MapToForLoop(*args, **kwargs)

Bases: SingleStateTransformation

Implements the Map to for-loop transformation.

Takes a map and enforces a sequential schedule by transforming it into a state-machine of a for-loop. Creates a nested SDFG, if necessary.

static annotates_memlets()

Indicates whether the transformation annotates the edges it creates or modifies with the appropriate memlets. This determines whether to apply memlet propagation after the transformation.

apply(graph, 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.expressions and the nodes in graph.

  • expr_index – The list index from PatternTransformation.expressions that was matched.

  • sdfg – The parent SDFG of the matched state.

  • permissive – Whether transformation should run in permissive mode.

Returns:

True if the transformation can be applied.

classmethod expressions()

Returns a list of SDFG state subgraphs that will be matched in the subgraph isomorphism phase. Used as a pre-pass before calling can_be_applied.

map_entry

Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of PatternTransformation to represent the subgraph patterns.

Example use:

class MyTransformation(SingleStateTransformation):
    some_map_node = PatternNode(nodes.MapEntry)
    array = PatternNode(nodes.AccessNode)

The two nodes can then be used in the transformation static methods (e.g., expressions, can_be_applied) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.

dace.transformation.dataflow.map_fusion module

This module contains classes that implement the map fusion transformation.

class dace.transformation.dataflow.map_fusion.MapFusion(*args, **kwargs)

Bases: SingleStateTransformation

Implements the MapFusion transformation. It wil check for all patterns MapExit -> AccessNode -> MapEntry, and based on the following rules, fuse them and remove the transient in between. There are several possibilities of what it does to this transient in between.

Essentially, if there is some other place in the sdfg where it is required, or if it is not a transient, then it will not be removed. In such a case, it will be linked to the MapExit node of the new fused map.

Rules for fusing maps:
  1. The map range of the second map should be a permutation of the first map range.

  2. Each of the access nodes that are adjacent to the first map exit should have an edge to the second map entry. If it doesn’t, then the second map entry should not be reachable from this access node.

  3. Any node that has a wcr from the first map exit should not be adjacent to the second map entry.

  4. Access pattern for the access nodes in the second map should be the same permutation of the map parameters as the map ranges of the two maps. Alternatively, this access node should not be adjacent to the first map entry.

static annotates_memlets()

Indicates whether the transformation annotates the edges it creates or modifies with the appropriate memlets. This determines whether to apply memlet propagation after the transformation.

apply(graph, sdfg)

This method applies the mapfusion transformation. Other than the removal of the second map entry node (SME), and the first map exit (FME) node, it has the following side effects:

  1. Any transient adjacent to both FME and SME with degree = 2 will be removed. The tasklets that use/produce it shall be connected directly with a scalar/new transient (if the dataflow is more than a single scalar)

  2. If this transient is adjacent to FME and SME and has other uses, it will be adjacent to the new map exit post fusion. Tasklet-> Tasklet edges will ALSO be added as mentioned above.

  3. If an access node is adjacent to FME but not SME, it will be adjacent to new map exit post fusion.

  4. If an access node is adjacent to SME but not FME, it will be adjacent to the new map entry node post fusion.

array

Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of PatternTransformation to represent the subgraph patterns.

Example use:

class MyTransformation(SingleStateTransformation):
    some_map_node = PatternNode(nodes.MapEntry)
    array = PatternNode(nodes.AccessNode)

The two nodes can then be used in the transformation static methods (e.g., expressions, can_be_applied) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.

can_be_applied(graph, expr_index, sdfg, permissive=False)

Returns True if this transformation can be applied on the candidate matched subgraph.

Parameters:
  • graph – SDFGState object in which the match was found.

  • candidate – A mapping between node IDs returned from PatternTransformation.expressions and the nodes in graph.

  • expr_index – The list index from PatternTransformation.expressions that was matched.

  • sdfg – The parent SDFG of the matched state.

  • permissive – Whether transformation should run in permissive mode.

Returns:

True if the transformation can be applied.

classmethod expressions()

Returns a list of SDFG state subgraphs that will be matched in the subgraph isomorphism phase. Used as a pre-pass before calling can_be_applied.

static find_permutation(first_map, second_map)

Find permutation between two map ranges.

Parameters:
  • first_map (Map) – First map.

  • second_map (Map) – Second map.

Return type:

Optional[List[int]]

Returns:

None if no such permutation exists, otherwise a list of indices L such that L[x]’th parameter of second map has the same range as x’th parameter of the first map.

first_map_exit

Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of PatternTransformation to represent the subgraph patterns.

Example use:

class MyTransformation(SingleStateTransformation):
    some_map_node = PatternNode(nodes.MapEntry)
    array = PatternNode(nodes.AccessNode)

The two nodes can then be used in the transformation static methods (e.g., expressions, can_be_applied) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.

fuse_nodes(sdfg, graph, edge, new_dst, new_dst_conn, other_edges=None)

Fuses two nodes via memlets and possibly transient arrays.

second_map_entry

Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of PatternTransformation to represent the subgraph patterns.

Example use:

class MyTransformation(SingleStateTransformation):
    some_map_node = PatternNode(nodes.MapEntry)
    array = PatternNode(nodes.AccessNode)

The two nodes can then be used in the transformation static methods (e.g., expressions, can_be_applied) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.

dace.transformation.dataflow.map_interchange module

Implements the map interchange transformation.

class dace.transformation.dataflow.map_interchange.MapInterchange(*args, **kwargs)

Bases: SingleStateTransformation

Implements the map-interchange transformation.

Map-interchange takes two nested maps and interchanges their position.

static annotates_memlets()

Indicates whether the transformation annotates the edges it creates or modifies with the appropriate memlets. This determines whether to apply memlet propagation after the transformation.

apply(graph, 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.expressions and the nodes in graph.

  • expr_index – The list index from PatternTransformation.expressions that was matched.

  • sdfg – The parent SDFG of the matched state.

  • permissive – Whether transformation should run in permissive mode.

Returns:

True if the transformation can be applied.

classmethod expressions()

Returns a list of SDFG state subgraphs that will be matched in the subgraph isomorphism phase. Used as a pre-pass before calling can_be_applied.

inner_map_entry

Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of PatternTransformation to represent the subgraph patterns.

Example use:

class MyTransformation(SingleStateTransformation):
    some_map_node = PatternNode(nodes.MapEntry)
    array = PatternNode(nodes.AccessNode)

The two nodes can then be used in the transformation static methods (e.g., expressions, can_be_applied) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.

outer_map_entry

Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of PatternTransformation to represent the subgraph patterns.

Example use:

class MyTransformation(SingleStateTransformation):
    some_map_node = PatternNode(nodes.MapEntry)
    array = PatternNode(nodes.AccessNode)

The two nodes can then be used in the transformation static methods (e.g., expressions, can_be_applied) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.

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: SingleStateTransformation

Implements the map-reduce-fusion transformation. Fuses a map with an immediately following reduction, where the array between the map and the reduction is not used anywhere else.

apply(graph, 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.expressions and the nodes in graph.

  • expr_index – The list index from PatternTransformation.expressions that was matched.

  • sdfg – The parent SDFG of the matched state.

  • permissive – Whether transformation should run in permissive mode.

Returns:

True if the transformation can be applied.

classmethod expressions()

Returns a list of SDFG state subgraphs that will be matched in the subgraph isomorphism phase. Used as a pre-pass before calling can_be_applied.

in_array

Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of PatternTransformation to represent the subgraph patterns.

Example use:

class MyTransformation(SingleStateTransformation):
    some_map_node = PatternNode(nodes.MapEntry)
    array = PatternNode(nodes.AccessNode)

The two nodes can then be used in the transformation static methods (e.g., expressions, can_be_applied) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.

match_to_str(graph)

Returns a string representation of the pattern match on the candidate subgraph. Used when identifying matches in the console UI.

no_init

If enabled, does not create initialization states for reduce nodes with identity

out_array

Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of PatternTransformation to represent the subgraph patterns.

Example use:

class MyTransformation(SingleStateTransformation):
    some_map_node = PatternNode(nodes.MapEntry)
    array = PatternNode(nodes.AccessNode)

The two nodes can then be used in the transformation static methods (e.g., expressions, can_be_applied) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.

properties()
reduce

Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of PatternTransformation to represent the subgraph patterns.

Example use:

class MyTransformation(SingleStateTransformation):
    some_map_node = PatternNode(nodes.MapEntry)
    array = PatternNode(nodes.AccessNode)

The two nodes can then be used in the transformation static methods (e.g., expressions, can_be_applied) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.

stdlib = <module 'dace.libraries.standard' from '/home/docs/checkouts/readthedocs.org/user_builds/spcldace/checkouts/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 PatternTransformation to represent the subgraph patterns.

Example use:

class MyTransformation(SingleStateTransformation):
    some_map_node = PatternNode(nodes.MapEntry)
    array = PatternNode(nodes.AccessNode)

The two nodes can then be used in the transformation static methods (e.g., expressions, can_be_applied) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.

tmap_exit

Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of PatternTransformation to represent the subgraph patterns.

Example use:

class MyTransformation(SingleStateTransformation):
    some_map_node = PatternNode(nodes.MapEntry)
    array = PatternNode(nodes.AccessNode)

The two nodes can then be used in the transformation static methods (e.g., expressions, can_be_applied) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.

class dace.transformation.dataflow.mapreduce.MapWCRFusion(*args, **kwargs)

Bases: SingleStateTransformation

Implements the map expanded-reduce fusion transformation. Fuses a map with an immediately following reduction, where the array between the map and the reduction is not used anywhere else, and the reduction is divided to two maps with a WCR, denoting partial reduction.

apply(graph, 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.expressions and the nodes in graph.

  • expr_index – The list index from PatternTransformation.expressions that was matched.

  • sdfg – The parent SDFG of the matched state.

  • permissive – Whether transformation should run in permissive mode.

Returns:

True if the transformation can be applied.

classmethod expressions()

Returns a list of SDFG state subgraphs that will be matched in the subgraph isomorphism phase. Used as a pre-pass before calling can_be_applied.

in_array

Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of PatternTransformation to represent the subgraph patterns.

Example use:

class MyTransformation(SingleStateTransformation):
    some_map_node = PatternNode(nodes.MapEntry)
    array = PatternNode(nodes.AccessNode)

The two nodes can then be used in the transformation static methods (e.g., expressions, can_be_applied) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.

match_to_str(graph)

Returns a string representation of the pattern match on the candidate subgraph. Used when identifying matches in the console UI.

out_array

Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of PatternTransformation to represent the subgraph patterns.

Example use:

class MyTransformation(SingleStateTransformation):
    some_map_node = PatternNode(nodes.MapEntry)
    array = PatternNode(nodes.AccessNode)

The two nodes can then be used in the transformation static methods (e.g., expressions, can_be_applied) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.

rmap_in_cr

Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of PatternTransformation to represent the subgraph patterns.

Example use:

class MyTransformation(SingleStateTransformation):
    some_map_node = PatternNode(nodes.MapEntry)
    array = PatternNode(nodes.AccessNode)

The two nodes can then be used in the transformation static methods (e.g., expressions, can_be_applied) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.

rmap_in_entry

Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of PatternTransformation to represent the subgraph patterns.

Example use:

class MyTransformation(SingleStateTransformation):
    some_map_node = PatternNode(nodes.MapEntry)
    array = PatternNode(nodes.AccessNode)

The two nodes can then be used in the transformation static methods (e.g., expressions, can_be_applied) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.

rmap_in_tasklet

Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of PatternTransformation to represent the subgraph patterns.

Example use:

class MyTransformation(SingleStateTransformation):
    some_map_node = PatternNode(nodes.MapEntry)
    array = PatternNode(nodes.AccessNode)

The two nodes can then be used in the transformation static methods (e.g., expressions, can_be_applied) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.

rmap_out_entry

Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of PatternTransformation to represent the subgraph patterns.

Example use:

class MyTransformation(SingleStateTransformation):
    some_map_node = PatternNode(nodes.MapEntry)
    array = PatternNode(nodes.AccessNode)

The two nodes can then be used in the transformation static methods (e.g., expressions, can_be_applied) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.

rmap_out_exit

Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of PatternTransformation to represent the subgraph patterns.

Example use:

class MyTransformation(SingleStateTransformation):
    some_map_node = PatternNode(nodes.MapEntry)
    array = PatternNode(nodes.AccessNode)

The two nodes can then be used in the transformation static methods (e.g., expressions, can_be_applied) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.

tasklet

Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of PatternTransformation to represent the subgraph patterns.

Example use:

class MyTransformation(SingleStateTransformation):
    some_map_node = PatternNode(nodes.MapEntry)
    array = PatternNode(nodes.AccessNode)

The two nodes can then be used in the transformation static methods (e.g., expressions, can_be_applied) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.

tmap_exit

Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of PatternTransformation to represent the subgraph patterns.

Example use:

class MyTransformation(SingleStateTransformation):
    some_map_node = PatternNode(nodes.MapEntry)
    array = PatternNode(nodes.AccessNode)

The two nodes can then be used in the transformation static methods (e.g., expressions, can_be_applied) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.

dace.transformation.dataflow.matrix_product_transpose module

Implements the matrix-matrix product transpose transformation.

class dace.transformation.dataflow.matrix_product_transpose.MatrixProductTranspose(*args, **kwargs)

Bases: SingleStateTransformation

Implements the matrix-matrix product transpose transformation.

T(A) @ T(B) = T(B @ A)

a_times_b

Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of PatternTransformation to represent the subgraph patterns.

Example use:

class MyTransformation(SingleStateTransformation):
    some_map_node = PatternNode(nodes.MapEntry)
    array = PatternNode(nodes.AccessNode)

The two nodes can then be used in the transformation static methods (e.g., expressions, can_be_applied) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.

apply(graph, 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 PatternTransformation to represent the subgraph patterns.

Example use:

class MyTransformation(SingleStateTransformation):
    some_map_node = PatternNode(nodes.MapEntry)
    array = PatternNode(nodes.AccessNode)

The two nodes can then be used in the transformation static methods (e.g., expressions, can_be_applied) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.

blas = <module 'dace.libraries.blas' from '/home/docs/checkouts/readthedocs.org/user_builds/spcldace/checkouts/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 PatternTransformation to represent the subgraph patterns.

Example use:

class MyTransformation(SingleStateTransformation):
    some_map_node = PatternNode(nodes.MapEntry)
    array = PatternNode(nodes.AccessNode)

The two nodes can then be used in the transformation static methods (e.g., expressions, can_be_applied) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.

can_be_applied(graph, expr_index, sdfg, permissive=False)

Returns True if this transformation can be applied on the candidate matched subgraph.

Parameters:
  • graph – SDFGState object in which the match was found.

  • candidate – A mapping between node IDs returned from PatternTransformation.expressions and the nodes in graph.

  • expr_index – The list index from PatternTransformation.expressions that was matched.

  • sdfg – The parent SDFG of the matched state.

  • permissive – Whether transformation should run in permissive mode.

Returns:

True if the transformation can be applied.

classmethod expressions()

Returns a list of SDFG state subgraphs that will be matched in the subgraph isomorphism phase. Used as a pre-pass before calling can_be_applied.

match_to_str(graph)

Returns a string representation of the pattern match on the candidate subgraph. Used when identifying matches in the console UI.

properties()
std = <module 'dace.libraries.standard' from '/home/docs/checkouts/readthedocs.org/user_builds/spcldace/checkouts/latest/dace/libraries/standard/__init__.py'>
transpose_a

Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of PatternTransformation to represent the subgraph patterns.

Example use:

class MyTransformation(SingleStateTransformation):
    some_map_node = PatternNode(nodes.MapEntry)
    array = PatternNode(nodes.AccessNode)

The two nodes can then be used in the transformation static methods (e.g., expressions, can_be_applied) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.

transpose_b

Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of PatternTransformation to represent the subgraph patterns.

Example use:

class MyTransformation(SingleStateTransformation):
    some_map_node = PatternNode(nodes.MapEntry)
    array = PatternNode(nodes.AccessNode)

The two nodes can then be used in the transformation static methods (e.g., expressions, can_be_applied) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.

dace.transformation.dataflow.merge_arrays module

class dace.transformation.dataflow.merge_arrays.InMergeArrays(*args, **kwargs)

Bases: SingleStateTransformation

Merge 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 PatternTransformation to represent the subgraph patterns.

Example use:

class MyTransformation(SingleStateTransformation):
    some_map_node = PatternNode(nodes.MapEntry)
    array = PatternNode(nodes.AccessNode)

The two nodes can then be used in the transformation static methods (e.g., expressions, can_be_applied) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.

array2

Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of PatternTransformation to represent the subgraph patterns.

Example use:

class MyTransformation(SingleStateTransformation):
    some_map_node = PatternNode(nodes.MapEntry)
    array = PatternNode(nodes.AccessNode)

The two nodes can then be used in the transformation static methods (e.g., expressions, can_be_applied) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.

can_be_applied(graph, expr_index, sdfg, permissive=False)

Returns True if this transformation can be applied on the candidate matched subgraph.

Parameters:
  • graph (SDFGState) – SDFGState object in which the match was found.

  • candidate – A mapping between node IDs returned from PatternTransformation.expressions and the nodes in graph.

  • expr_index – The list index from PatternTransformation.expressions that was matched.

  • sdfg – The parent SDFG of the matched state.

  • permissive – Whether transformation should run in permissive mode.

Returns:

True if the transformation can be applied.

classmethod expressions()

Returns a list of SDFG state subgraphs that will be matched in the subgraph isomorphism phase. Used as a pre-pass before calling can_be_applied.

map_entry

Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of PatternTransformation to represent the subgraph patterns.

Example use:

class MyTransformation(SingleStateTransformation):
    some_map_node = PatternNode(nodes.MapEntry)
    array = PatternNode(nodes.AccessNode)

The two nodes can then be used in the transformation static methods (e.g., expressions, can_be_applied) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.

match_to_str(graph)

Returns a string representation of the pattern match on the candidate subgraph. Used when identifying matches in the console UI.

class dace.transformation.dataflow.merge_arrays.MergeSourceSinkArrays(*args, **kwargs)

Bases: SingleStateTransformation

Merge 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 PatternTransformation to represent the subgraph patterns.

Example use:

class MyTransformation(SingleStateTransformation):
    some_map_node = PatternNode(nodes.MapEntry)
    array = PatternNode(nodes.AccessNode)

The two nodes can then be used in the transformation static methods (e.g., expressions, can_be_applied) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.

can_be_applied(graph, expr_index, sdfg, permissive=False)

Returns True if this transformation can be applied on the candidate matched subgraph.

Parameters:
  • graph – SDFGState object in which the match was found.

  • candidate – A mapping between node IDs returned from PatternTransformation.expressions and the nodes in graph.

  • expr_index – The list index from PatternTransformation.expressions that was matched.

  • sdfg – The parent SDFG of the matched state.

  • permissive – Whether transformation should run in permissive mode.

Returns:

True if the transformation can be applied.

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: SingleStateTransformation

Merge 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 PatternTransformation to represent the subgraph patterns.

Example use:

class MyTransformation(SingleStateTransformation):
    some_map_node = PatternNode(nodes.MapEntry)
    array = PatternNode(nodes.AccessNode)

The two nodes can then be used in the transformation static methods (e.g., expressions, can_be_applied) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.

array2

Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of PatternTransformation to represent the subgraph patterns.

Example use:

class MyTransformation(SingleStateTransformation):
    some_map_node = PatternNode(nodes.MapEntry)
    array = PatternNode(nodes.AccessNode)

The two nodes can then be used in the transformation static methods (e.g., expressions, can_be_applied) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.

can_be_applied(graph, expr_index, sdfg, permissive=False)

Returns True if this transformation can be applied on the candidate matched subgraph.

Parameters:
  • graph – SDFGState object in which the match was found.

  • candidate – A mapping between node IDs returned from PatternTransformation.expressions and the nodes in graph.

  • expr_index – The list index from PatternTransformation.expressions that was matched.

  • sdfg – The parent SDFG of the matched state.

  • permissive – Whether transformation should run in permissive mode.

Returns:

True if the transformation can be applied.

classmethod expressions()

Returns a list of SDFG state subgraphs that will be matched in the subgraph isomorphism phase. Used as a pre-pass before calling can_be_applied.

map_exit

Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of PatternTransformation to represent the subgraph patterns.

Example use:

class MyTransformation(SingleStateTransformation):
    some_map_node = PatternNode(nodes.MapEntry)
    array = PatternNode(nodes.AccessNode)

The two nodes can then be used in the transformation static methods (e.g., expressions, can_be_applied) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.

match_to_str(graph)

Returns a string representation of the pattern match on the candidate subgraph. Used when identifying matches in the console UI.

dace.transformation.dataflow.mpi module

Contains the MPITransformMap transformation.

class dace.transformation.dataflow.mpi.MPITransformMap(*args, **kwargs)

Bases: SingleStateTransformation

Implements 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 -                                            OutputN

Nothing in R may access other inputs/outputs that are not defined in R itself and do not go through MapEntry/MapExit Map must be a one-dimensional map for now. The range of the map must be a Range object.

  • Add transients for the accessed parts

  • The schedule property of Map is set to MPI

  • The range of Map is changed to var = startexpr + p * chunksize … startexpr + p + 1 * chunksize where p is the current rank and P is the total number of ranks, and chunksize is defined as (endexpr - startexpr) / P, adding the remaining K iterations to the first K procs.

  • For each input InputI, create a new transient transInputI, which has an attribute that specifies that it needs to be filled with (possibly) remote data

  • Collect all accesses to InputI within R, assume their convex hull is InputI[rs … re]

  • The transInputI transient will contain InputI[rs … re]

  • Change all accesses to InputI within R to accesses to transInputI

static annotates_memlets()

Indicates whether the transformation annotates the edges it creates or modifies with the appropriate memlets. This determines whether to apply memlet propagation after the transformation.

apply(graph, 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.expressions and the nodes in graph.

  • expr_index – The list index from PatternTransformation.expressions that was matched.

  • sdfg – The parent SDFG of the matched state.

  • permissive – Whether transformation should run in permissive mode.

Returns:

True if the transformation can be applied.

classmethod expressions()

Returns a list of SDFG state subgraphs that will be matched in the subgraph isomorphism phase. Used as a pre-pass before calling can_be_applied.

map_entry

Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of PatternTransformation to represent the subgraph patterns.

Example use:

class MyTransformation(SingleStateTransformation):
    some_map_node = PatternNode(nodes.MapEntry)
    array = PatternNode(nodes.AccessNode)

The two nodes can then be used in the transformation static methods (e.g., expressions, can_be_applied) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.

properties()

dace.transformation.dataflow.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: SingleStateTransformation

Performs 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 PatternTransformation to represent the subgraph patterns.

Example use:

class MyTransformation(SingleStateTransformation):
    some_map_node = PatternNode(nodes.MapEntry)
    array = PatternNode(nodes.AccessNode)

The two nodes can then be used in the transformation static methods (e.g., expressions, can_be_applied) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.

can_be_applied(graph, expr_index, sdfg, permissive=False)

Returns True if this transformation can be applied on the candidate matched subgraph.

Parameters:
  • graph – SDFGState object in which the match was found.

  • candidate – A mapping between node IDs returned from PatternTransformation.expressions and the nodes in graph.

  • expr_index – The list index from PatternTransformation.expressions that was matched.

  • sdfg – The parent SDFG of the matched state.

  • permissive – Whether transformation should run in permissive mode.

Returns:

True if the transformation can be applied.

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 PatternTransformation to represent the subgraph patterns.

Example use:

class MyTransformation(SingleStateTransformation):
    some_map_node = PatternNode(nodes.MapEntry)
    array = PatternNode(nodes.AccessNode)

The two nodes can then be used in the transformation static methods (e.g., expressions, can_be_applied) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.

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 PatternTransformation to represent the subgraph patterns.

Example use:

class MyTransformation(SingleStateTransformation):
    some_map_node = PatternNode(nodes.MapEntry)
    array = PatternNode(nodes.AccessNode)

The two nodes can then be used in the transformation static methods (e.g., expressions, can_be_applied) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.

static 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: SingleStateTransformation

Implements 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.expressions and the nodes in graph.

  • expr_index – The list index from PatternTransformation.expressions that was matched.

  • sdfg – The parent SDFG of the matched state.

  • permissive – Whether transformation should run in permissive mode.

Returns:

True if the transformation can be applied.

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 PatternTransformation to represent the subgraph patterns.

Example use:

class MyTransformation(SingleStateTransformation):
    some_map_node = PatternNode(nodes.MapEntry)
    array = PatternNode(nodes.AccessNode)

The two nodes can then be used in the transformation static methods (e.g., expressions, can_be_applied) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.

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: SingleStateTransformation

Implements the redundant array removal transformation, applied when a transient array is copied to and from (to another array), but never used anywhere else.

apply(graph, sdfg)

Applies this transformation instance on the matched pattern graph.

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.expressions and the nodes in graph.

  • expr_index – The list index from PatternTransformation.expressions that was matched.

  • sdfg – The parent SDFG of the matched state.

  • permissive – Whether transformation should run in permissive mode.

Returns:

True if the transformation can be applied.

classmethod expressions()

Returns a list of SDFG state subgraphs that will be matched in the subgraph isomorphism phase. Used as a pre-pass before calling can_be_applied.

in_array

Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of PatternTransformation to represent the subgraph patterns.

Example use:

class MyTransformation(SingleStateTransformation):
    some_map_node = PatternNode(nodes.MapEntry)
    array = PatternNode(nodes.AccessNode)

The two nodes can then be used in the transformation static methods (e.g., expressions, can_be_applied) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.

out_array

Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of PatternTransformation to represent the subgraph patterns.

Example use:

class MyTransformation(SingleStateTransformation):
    some_map_node = PatternNode(nodes.MapEntry)
    array = PatternNode(nodes.AccessNode)

The two nodes can then be used in the transformation static methods (e.g., expressions, can_be_applied) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.

class dace.transformation.dataflow.redundant_array.RedundantReadSlice(*args, **kwargs)

Bases: SingleStateTransformation

Detects patterns of the form Array -> View(Array) and removes the View if it is a slice.

apply(graph, sdfg)

Applies this transformation instance on the matched pattern graph.

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.expressions and the nodes in graph.

  • expr_index – The list index from PatternTransformation.expressions that was matched.

  • sdfg – The parent SDFG of the matched state.

  • permissive – Whether transformation should run in permissive mode.

Returns:

True if the transformation can be applied.

classmethod expressions()

Returns a list of SDFG state subgraphs that will be matched in the subgraph isomorphism phase. Used as a pre-pass before calling can_be_applied.

in_array

Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of PatternTransformation to represent the subgraph patterns.

Example use:

class MyTransformation(SingleStateTransformation):
    some_map_node = PatternNode(nodes.MapEntry)
    array = PatternNode(nodes.AccessNode)

The two nodes can then be used in the transformation static methods (e.g., expressions, can_be_applied) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.

out_array

Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of PatternTransformation to represent the subgraph patterns.

Example use:

class MyTransformation(SingleStateTransformation):
    some_map_node = PatternNode(nodes.MapEntry)
    array = PatternNode(nodes.AccessNode)

The two nodes can then be used in the transformation static methods (e.g., expressions, can_be_applied) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.

class dace.transformation.dataflow.redundant_array.RedundantSecondArray(*args, **kwargs)

Bases: SingleStateTransformation

Implements the redundant array removal transformation, applied when a transient array is copied from and to (from another array), but never used anywhere else. This transformation removes the second array.

apply(graph, 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.expressions and the nodes in graph.

  • expr_index – The list index from PatternTransformation.expressions that was matched.

  • sdfg – The parent SDFG of the matched state.

  • permissive – Whether transformation should run in permissive mode.

Returns:

True if the transformation can be applied.

classmethod expressions()

Returns a list of SDFG state subgraphs that will be matched in the subgraph isomorphism phase. Used as a pre-pass before calling can_be_applied.

in_array

Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of PatternTransformation to represent the subgraph patterns.

Example use:

class MyTransformation(SingleStateTransformation):
    some_map_node = PatternNode(nodes.MapEntry)
    array = PatternNode(nodes.AccessNode)

The two nodes can then be used in the transformation static methods (e.g., expressions, can_be_applied) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.

out_array

Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of PatternTransformation to represent the subgraph patterns.

Example use:

class MyTransformation(SingleStateTransformation):
    some_map_node = PatternNode(nodes.MapEntry)
    array = PatternNode(nodes.AccessNode)

The two nodes can then be used in the transformation static methods (e.g., expressions, can_be_applied) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.

class dace.transformation.dataflow.redundant_array.RedundantWriteSlice(*args, **kwargs)

Bases: SingleStateTransformation

Detects patterns of the form View(Array) -> Array and removes the View if it is a slice.

apply(graph, sdfg)

Applies this transformation instance on the matched pattern graph.

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.expressions and the nodes in graph.

  • expr_index – The list index from PatternTransformation.expressions that was matched.

  • sdfg – The parent SDFG of the matched state.

  • permissive – Whether transformation should run in permissive mode.

Returns:

True if the transformation can be applied.

classmethod expressions()

Returns a list of SDFG state subgraphs that will be matched in the subgraph isomorphism phase. Used as a pre-pass before calling can_be_applied.

in_array

Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of PatternTransformation to represent the subgraph patterns.

Example use:

class MyTransformation(SingleStateTransformation):
    some_map_node = PatternNode(nodes.MapEntry)
    array = PatternNode(nodes.AccessNode)

The two nodes can then be used in the transformation static methods (e.g., expressions, can_be_applied) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.

out_array

Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of PatternTransformation to represent the subgraph patterns.

Example use:

class MyTransformation(SingleStateTransformation):
    some_map_node = PatternNode(nodes.MapEntry)
    array = PatternNode(nodes.AccessNode)

The two nodes can then be used in the transformation static methods (e.g., expressions, can_be_applied) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.

class dace.transformation.dataflow.redundant_array.RemoveIntermediateWrite(*args, **kwargs)

Bases: SingleStateTransformation

Moves 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.expressions and the nodes in graph.

  • expr_index – The list index from PatternTransformation.expressions that 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 PatternTransformation to represent the subgraph patterns.

Example use:

class MyTransformation(SingleStateTransformation):
    some_map_node = PatternNode(nodes.MapEntry)
    array = PatternNode(nodes.AccessNode)

The two nodes can then be used in the transformation static methods (e.g., expressions, can_be_applied) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.

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 PatternTransformation to represent the subgraph patterns.

Example use:

class MyTransformation(SingleStateTransformation):
    some_map_node = PatternNode(nodes.MapEntry)
    array = PatternNode(nodes.AccessNode)

The two nodes can then be used in the transformation static methods (e.g., expressions, can_be_applied) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.

class dace.transformation.dataflow.redundant_array.RemoveSliceView(*args, **kwargs)

Bases: SingleStateTransformation

Removes 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.expressions and the nodes in graph.

  • expr_index – The list index from PatternTransformation.expressions that 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 PatternTransformation to represent the subgraph patterns.

Example use:

class MyTransformation(SingleStateTransformation):
    some_map_node = PatternNode(nodes.MapEntry)
    array = PatternNode(nodes.AccessNode)

The two nodes can then be used in the transformation static methods (e.g., expressions, can_be_applied) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.

class dace.transformation.dataflow.redundant_array.SqueezeViewRemove(*args, **kwargs)

Bases: 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.expressions and the nodes in graph.

  • expr_index (int) – The list index from PatternTransformation.expressions that 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 PatternTransformation to represent the subgraph patterns.

Example use:

class MyTransformation(SingleStateTransformation):
    some_map_node = PatternNode(nodes.MapEntry)
    array = PatternNode(nodes.AccessNode)

The two nodes can then be used in the transformation static methods (e.g., expressions, can_be_applied) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.

out_array

Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of PatternTransformation to represent the subgraph patterns.

Example use:

class MyTransformation(SingleStateTransformation):
    some_map_node = PatternNode(nodes.MapEntry)
    array = PatternNode(nodes.AccessNode)

The two nodes can then be used in the transformation static methods (e.g., expressions, can_be_applied) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.

class dace.transformation.dataflow.redundant_array.UnsqueezeViewRemove(*args, **kwargs)

Bases: 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.expressions and the nodes in graph.

  • expr_index (int) – The list index from PatternTransformation.expressions that 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 PatternTransformation to represent the subgraph patterns.

Example use:

class MyTransformation(SingleStateTransformation):
    some_map_node = PatternNode(nodes.MapEntry)
    array = PatternNode(nodes.AccessNode)

The two nodes can then be used in the transformation static methods (e.g., expressions, can_be_applied) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.

out_array

Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of PatternTransformation to represent the subgraph patterns.

Example use:

class MyTransformation(SingleStateTransformation):
    some_map_node = PatternNode(nodes.MapEntry)
    array = PatternNode(nodes.AccessNode)

The two nodes can then be used in the transformation static methods (e.g., expressions, can_be_applied) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.

dace.transformation.dataflow.redundant_array.compose_and_push_back(first, second, dims=None, popped=None)
dace.transformation.dataflow.redundant_array.find_dims_to_pop(a_size, b_size)
dace.transformation.dataflow.redundant_array.pop_dims(subset, dims)

dace.transformation.dataflow.redundant_array_copying module

Contains redundant array removal transformations.

class dace.transformation.dataflow.redundant_array_copying.RedundantArrayCopying(*args, **kwargs)

Bases: SingleStateTransformation

Implements the redundant array removal transformation. Removes the last access node in pattern A -> B -> A, and the second (if possible)

apply(graph, sdfg)

Applies this transformation instance on the matched pattern graph.

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.expressions and the nodes in graph.

  • expr_index – The list index from PatternTransformation.expressions that was matched.

  • sdfg – The parent SDFG of the matched state.

  • permissive – Whether transformation should run in permissive mode.

Returns:

True if the transformation can be applied.

classmethod expressions()

Returns a list of SDFG state subgraphs that will be matched in the subgraph isomorphism phase. Used as a pre-pass before calling can_be_applied.

in_array

Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of PatternTransformation to represent the subgraph patterns.

Example use:

class MyTransformation(SingleStateTransformation):
    some_map_node = PatternNode(nodes.MapEntry)
    array = PatternNode(nodes.AccessNode)

The two nodes can then be used in the transformation static methods (e.g., expressions, can_be_applied) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.

med_array

Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of PatternTransformation to represent the subgraph patterns.

Example use:

class MyTransformation(SingleStateTransformation):
    some_map_node = PatternNode(nodes.MapEntry)
    array = PatternNode(nodes.AccessNode)

The two nodes can then be used in the transformation static methods (e.g., expressions, can_be_applied) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.

out_array

Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of PatternTransformation to represent the subgraph patterns.

Example use:

class MyTransformation(SingleStateTransformation):
    some_map_node = PatternNode(nodes.MapEntry)
    array = PatternNode(nodes.AccessNode)

The two nodes can then be used in the transformation static methods (e.g., expressions, can_be_applied) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.

class dace.transformation.dataflow.redundant_array_copying.RedundantArrayCopying2(*args, **kwargs)

Bases: SingleStateTransformation

Implements the redundant array removal transformation. Removes multiples of array B in pattern A -> B.

apply(graph, sdfg)

Applies this transformation instance on the matched pattern graph.

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.expressions and the nodes in graph.

  • expr_index – The list index from PatternTransformation.expressions that was matched.

  • sdfg – The parent SDFG of the matched state.

  • permissive – Whether transformation should run in permissive mode.

Returns:

True if the transformation can be applied.

classmethod expressions()

Returns a list of SDFG state subgraphs that will be matched in the subgraph isomorphism phase. Used as a pre-pass before calling can_be_applied.

in_array

Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of PatternTransformation to represent the subgraph patterns.

Example use:

class MyTransformation(SingleStateTransformation):
    some_map_node = PatternNode(nodes.MapEntry)
    array = PatternNode(nodes.AccessNode)

The two nodes can then be used in the transformation static methods (e.g., expressions, can_be_applied) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.

out_array

Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of PatternTransformation to represent the subgraph patterns.

Example use:

class MyTransformation(SingleStateTransformation):
    some_map_node = PatternNode(nodes.MapEntry)
    array = PatternNode(nodes.AccessNode)

The two nodes can then be used in the transformation static methods (e.g., expressions, can_be_applied) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.

class dace.transformation.dataflow.redundant_array_copying.RedundantArrayCopying3(*args, **kwargs)

Bases: SingleStateTransformation

Implements the redundant array removal transformation. Removes multiples of array B in pattern MapEntry -> B.

apply(graph, sdfg)

Applies this transformation instance on the matched pattern graph.

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.expressions and the nodes in graph.

  • expr_index – The list index from PatternTransformation.expressions that was matched.

  • sdfg – The parent SDFG of the matched state.

  • permissive – Whether transformation should run in permissive mode.

Returns:

True if the transformation can be applied.

classmethod expressions()

Returns a list of SDFG state subgraphs that will be matched in the subgraph isomorphism phase. Used as a pre-pass before calling can_be_applied.

map_entry

Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of PatternTransformation to represent the subgraph patterns.

Example use:

class MyTransformation(SingleStateTransformation):
    some_map_node = PatternNode(nodes.MapEntry)
    array = PatternNode(nodes.AccessNode)

The two nodes can then be used in the transformation static methods (e.g., expressions, can_be_applied) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.

out_array

Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of PatternTransformation to represent the subgraph patterns.

Example use:

class MyTransformation(SingleStateTransformation):
    some_map_node = PatternNode(nodes.MapEntry)
    array = PatternNode(nodes.AccessNode)

The two nodes can then be used in the transformation static methods (e.g., expressions, can_be_applied) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.

class dace.transformation.dataflow.redundant_array_copying.RedundantArrayCopyingIn(*args, **kwargs)

Bases: SingleStateTransformation

Implements 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.expressions and the nodes in graph.

  • expr_index – The list index from PatternTransformation.expressions that was matched.

  • sdfg – The parent SDFG of the matched state.

  • permissive – Whether transformation should run in permissive mode.

Returns:

True if the transformation can be applied.

classmethod expressions()

Returns a list of SDFG state subgraphs that will be matched in the subgraph isomorphism phase. Used as a pre-pass before calling can_be_applied.

in_array

Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of PatternTransformation to represent the subgraph patterns.

Example use:

class MyTransformation(SingleStateTransformation):
    some_map_node = PatternNode(nodes.MapEntry)
    array = PatternNode(nodes.AccessNode)

The two nodes can then be used in the transformation static methods (e.g., expressions, can_be_applied) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.

med_array

Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of PatternTransformation to represent the subgraph patterns.

Example use:

class MyTransformation(SingleStateTransformation):
    some_map_node = PatternNode(nodes.MapEntry)
    array = PatternNode(nodes.AccessNode)

The two nodes can then be used in the transformation static methods (e.g., expressions, can_be_applied) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.

out_array

Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of PatternTransformation to represent the subgraph patterns.

Example use:

class MyTransformation(SingleStateTransformation):
    some_map_node = PatternNode(nodes.MapEntry)
    array = PatternNode(nodes.AccessNode)

The two nodes can then be used in the transformation static methods (e.g., expressions, can_be_applied) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.

dace.transformation.dataflow.streaming_memory module

class dace.transformation.dataflow.streaming_memory.StreamingComposition(*args, **kwargs)

Bases: SingleStateTransformation

Converts 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 PatternTransformation to represent the subgraph patterns.

Example use:

class MyTransformation(SingleStateTransformation):
    some_map_node = PatternNode(nodes.MapEntry)
    array = PatternNode(nodes.AccessNode)

The two nodes can then be used in the transformation static methods (e.g., expressions, can_be_applied) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.

apply(state, sdfg)

Applies this transformation instance on the matched pattern graph.

Parameters:

sdfg (SDFG) – The SDFG to apply the transformation to.

Return type:

AccessNode

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.expressions and the nodes in graph.

  • expr_index (int) – The list index from PatternTransformation.expressions that 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 PatternTransformation to represent the subgraph patterns.

Example use:

class MyTransformation(SingleStateTransformation):
    some_map_node = PatternNode(nodes.MapEntry)
    array = PatternNode(nodes.AccessNode)

The two nodes can then be used in the transformation static methods (e.g., expressions, can_be_applied) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.

properties()
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 PatternTransformation to represent the subgraph patterns.

Example use:

class MyTransformation(SingleStateTransformation):
    some_map_node = PatternNode(nodes.MapEntry)
    array = PatternNode(nodes.AccessNode)

The two nodes can then be used in the transformation static methods (e.g., expressions, can_be_applied) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.

storage

Set storage type for the newly-created stream

class dace.transformation.dataflow.streaming_memory.StreamingMemory(*args, **kwargs)

Bases: SingleStateTransformation

Converts 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 PatternTransformation to represent the subgraph patterns.

Example use:

class MyTransformation(SingleStateTransformation):
    some_map_node = PatternNode(nodes.MapEntry)
    array = PatternNode(nodes.AccessNode)

The two nodes can then be used in the transformation static methods (e.g., expressions, can_be_applied) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.

apply(state, sdfg)

Applies this transformation instance on the matched pattern graph.

Parameters:

sdfg (SDFG) – The SDFG to apply the transformation to.

Return type:

AccessNode

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.expressions and the nodes in graph.

  • expr_index (int) – The list index from PatternTransformation.expressions that 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 PatternTransformation to represent the subgraph patterns.

Example use:

class MyTransformation(SingleStateTransformation):
    some_map_node = PatternNode(nodes.MapEntry)
    array = PatternNode(nodes.AccessNode)

The two nodes can then be used in the transformation static methods (e.g., expressions, can_be_applied) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.

exit

Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of PatternTransformation to represent the subgraph patterns.

Example use:

class MyTransformation(SingleStateTransformation):
    some_map_node = PatternNode(nodes.MapEntry)
    array = PatternNode(nodes.AccessNode)

The two nodes can then be used in the transformation static methods (e.g., expressions, can_be_applied) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.

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: SingleStateTransformation

Implements the AccumulateTransient transformation, which adds transient stream and data nodes between nested maps that lead to a stream. The transient data nodes then act as a local accumulator.

apply(graph, 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.expressions and the nodes in graph.

  • expr_index – The list index from PatternTransformation.expressions that was matched.

  • sdfg – The parent SDFG of the matched state.

  • permissive – Whether transformation should run in permissive mode.

Returns:

True if the transformation can be applied.

classmethod expressions()

Returns a list of SDFG state subgraphs that will be matched in the subgraph isomorphism phase. Used as a pre-pass before calling can_be_applied.

identity

Identity value to set

map_exit

Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of PatternTransformation to represent the subgraph patterns.

Example use:

class MyTransformation(SingleStateTransformation):
    some_map_node = PatternNode(nodes.MapEntry)
    array = PatternNode(nodes.AccessNode)

The two nodes can then be used in the transformation static methods (e.g., expressions, can_be_applied) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.

outer_map_exit

Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of PatternTransformation to represent the subgraph patterns.

Example use:

class MyTransformation(SingleStateTransformation):
    some_map_node = PatternNode(nodes.MapEntry)
    array = PatternNode(nodes.AccessNode)

The two nodes can then be used in the transformation static methods (e.g., expressions, can_be_applied) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.

properties()
class dace.transformation.dataflow.stream_transient.StreamTransient(*args, **kwargs)

Bases: SingleStateTransformation

Implements the StreamTransient transformation, which adds a transient and stream nodes between nested maps that lead to a stream. The transient then acts as a local buffer.

apply(graph, 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.expressions and the nodes in graph.

  • expr_index – The list index from PatternTransformation.expressions that was matched.

  • sdfg – The parent SDFG of the matched state.

  • permissive – Whether transformation should run in permissive mode.

Returns:

True if the transformation can be applied.

classmethod expressions()

Returns a list of SDFG state subgraphs that will be matched in the subgraph isomorphism phase. Used as a pre-pass before calling can_be_applied.

map_exit

Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of PatternTransformation to represent the subgraph patterns.

Example use:

class MyTransformation(SingleStateTransformation):
    some_map_node = PatternNode(nodes.MapEntry)
    array = PatternNode(nodes.AccessNode)

The two nodes can then be used in the transformation static methods (e.g., expressions, can_be_applied) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.

outer_map_exit

Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of PatternTransformation to represent the subgraph patterns.

Example use:

class MyTransformation(SingleStateTransformation):
    some_map_node = PatternNode(nodes.MapEntry)
    array = PatternNode(nodes.AccessNode)

The two nodes can then be used in the transformation static methods (e.g., expressions, can_be_applied) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.

properties()
tasklet

Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of PatternTransformation to represent the subgraph patterns.

Example use:

class MyTransformation(SingleStateTransformation):
    some_map_node = PatternNode(nodes.MapEntry)
    array = PatternNode(nodes.AccessNode)

The two nodes can then be used in the transformation static methods (e.g., expressions, can_be_applied) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.

with_buffer

Use an intermediate buffer for accumulation

dace.transformation.dataflow.stream_transient.calc_set_image(map_idx, map_set, array_set)
dace.transformation.dataflow.stream_transient.calc_set_image_index(map_idx, map_set, array_idx)
dace.transformation.dataflow.stream_transient.calc_set_image_range(map_idx, map_set, array_range)

dace.transformation.dataflow.strip_mining module

This module contains classes and functions that implement the strip-mining transformation.

class dace.transformation.dataflow.strip_mining.StripMining(*args, **kwargs)

Bases: SingleStateTransformation

Implements the strip-mining transformation.

Strip-mining takes as input a map dimension and splits it into two dimensions. The new dimension iterates over the range of the original one with a parameterizable step, called the tile size. The original dimension is changed to iterates over the range of the tile size, with the same step as before.

static annotates_memlets()

Indicates whether the transformation annotates the edges it creates or modifies with the appropriate memlets. This determines whether to apply memlet propagation after the transformation.

apply(graph, sdfg)

Applies this transformation instance on the matched pattern graph.

Parameters:

sdfg (SDFG) – The SDFG to apply the transformation to.

Return type:

Map

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.expressions and the nodes in graph.

  • expr_index – The list index from PatternTransformation.expressions that was matched.

  • sdfg – The parent SDFG of the matched state.

  • permissive – Whether transformation should run in permissive mode.

Returns:

True if the transformation can be applied.

dim_idx

Index of dimension to be strip-mined

divides_evenly

Tile size divides dimension range evenly?

classmethod expressions()

Returns a list of SDFG state subgraphs that will be matched in the subgraph isomorphism phase. Used as a pre-pass before calling can_be_applied.

map_entry

Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of PatternTransformation to represent the subgraph patterns.

Example use:

class MyTransformation(SingleStateTransformation):
    some_map_node = PatternNode(nodes.MapEntry)
    array = PatternNode(nodes.AccessNode)

The two nodes can then be used in the transformation static methods (e.g., expressions, can_be_applied) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.

match_to_str(graph)

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: SingleStateTransformation

Implements the orthogonal tiling transformation.

Orthogonal tiling is a type of nested map fission that creates tiles in every dimension of the matched Map.

static annotates_memlets()

Indicates whether the transformation annotates the edges it creates or modifies with the appropriate memlets. This determines whether to apply memlet propagation after the transformation.

apply(graph, 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.expressions and the nodes in graph.

  • expr_index – The list index from PatternTransformation.expressions that was matched.

  • sdfg – The parent SDFG of the matched state.

  • permissive – Whether transformation should run in permissive mode.

Returns:

True if the transformation can be applied.

divides_evenly

Tile size divides dimension length evenly

classmethod expressions()

Returns a list of SDFG state subgraphs that will be matched in the subgraph isomorphism phase. Used as a pre-pass before calling can_be_applied.

map_entry

Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of PatternTransformation to represent the subgraph patterns.

Example use:

class MyTransformation(SingleStateTransformation):
    some_map_node = PatternNode(nodes.MapEntry)
    array = PatternNode(nodes.AccessNode)

The two nodes can then be used in the transformation static methods (e.g., expressions, can_be_applied) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.

prefix

Prefix for new range symbols

properties()
strides

Tile stride (enables overlapping tiles). If empty, matches tile

tile_offset

Negative Stride offset per dimension

tile_sizes

Tile size per dimension

tile_trivial

Tiles even if tile_size is 1

dace.transformation.dataflow.vectorization module

Contains classes that implement the vectorization transformation.

class dace.transformation.dataflow.vectorization.Vectorization(*args, **kwargs)

Bases: SingleStateTransformation

Implements the vectorization transformation.

Vectorization matches when all the input and output memlets of a tasklet inside a map access the inner-most loop variable in their last dimension. The transformation changes the step of the inner-most loop to be equal to the length of the vector and vectorizes the memlets.

apply(graph, 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.expressions and the nodes in graph.

  • expr_index – The list index from PatternTransformation.expressions that was matched.

  • sdfg – The parent SDFG of the matched state.

  • permissive – Whether transformation should run in permissive mode.

Returns:

True if the transformation can be applied.

classmethod expressions()

Returns a list of SDFG state subgraphs that will be matched in the subgraph isomorphism phase. Used as a pre-pass before calling can_be_applied.

map_entry

Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of PatternTransformation to represent the subgraph patterns.

Example use:

class MyTransformation(SingleStateTransformation):
    some_map_node = PatternNode(nodes.MapEntry)
    array = PatternNode(nodes.AccessNode)

The two nodes can then be used in the transformation static methods (e.g., expressions, can_be_applied) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.

postamble

Force creation or skipping a postamble map without vectors

preamble

Force creation or skipping a preamble map without vectors

propagate_parent

Propagate vector length through parent SDFGs

properties()
strided_map

Use strided map range (jump by vector length) instead of modifying memlets

vector_len

Vector length

dace.transformation.dataflow.warp_tiling module

class dace.transformation.dataflow.warp_tiling.WarpTiling(*args, **kwargs)

Bases: SingleStateTransformation

Implements 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.

Parameters:

sdfg (SDFG) – The SDFG to apply the transformation to.

Return type:

MapEntry

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)

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.expressions and the nodes in graph.

  • expr_index – The list index from PatternTransformation.expressions that 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 PatternTransformation to represent the subgraph patterns.

Example use:

class MyTransformation(SingleStateTransformation):
    some_map_node = PatternNode(nodes.MapEntry)
    array = PatternNode(nodes.AccessNode)

The two nodes can then be used in the transformation static methods (e.g., expressions, can_be_applied) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.

properties()
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.