DaCe 0.12
API Changes
Important: Pattern-matching transformation API has been significantly simplified. Transformations using the old API must be ported! Summary of changes:
- Transformations now expand either the
SingleStateTransformation
orMultiStateTransformation
classes instead of using decorators - Patterns must be registered as class variables called
PatternNode
s - Nodes in matched patterns can be then accessed in
can_be_applied
andapply
directly usingself.nodename
- The name
strict
is now replaced withpermissive
(False by default). Permissive mode allows transformations to match in more cases, but may be dangerous to apply (e.g., create race conditions). can_be_applied
is now a method of the transformation- The
apply
method accepts a graph and the SDFG.
Example of using the new API:
import dace
from dace import nodes
from dace.sdfg import utils as sdutil
from dace.transformation import transformation as xf
class ExampleTransformation(xf.SingleStateTransformation):
# Define pattern nodes
map_entry = xf.PatternNode(nodes.MapEntry)
access = xf.PatternNode(nodes.AccessNode)
# Define matching subgraphs
@classmethod
def expressions(cls):
# MapEntry -> Access
return [sdutil.node_path_graph(cls.map_entry, cls.access)]
def can_be_applied(self, graph: dace.SDFGState, expr_index: int, sdfg: dace.SDFG, permissive: bool = False) -> bool:
# Returns True if the transformation can be applied on a subgraph
if permissive: # In permissive mode, we will always apply this transformation
return True
return self.map_entry.schedule == dace.ScheduleType.CPU_Multicore
def apply(self, graph: dace.SDFGState, sdfg: dace.SDFG):
# Apply the transformation using the SDFG API
pass
Simplifying SDFGs is renamed from sdfg.apply_strict_transformations()
to sdfg.simplify()
AccessNodes no longer have an AccessType
field.
Other changes
- More nested SDFG inlining opportunities by default with the multi-state inline transformation
- Performance optimizations of the DaCe framework (parsing, transformations, code generation) for large graphs
- Support for Xilinx Vitis 2021.2
- Minor fixes to transformations and deserialization
Full Changelog: v0.11.4...v0.12