diff --git a/dace/sdfg/sdfg.py b/dace/sdfg/sdfg.py index 3be268e44d..92602cdaeb 100644 --- a/dace/sdfg/sdfg.py +++ b/dace/sdfg/sdfg.py @@ -2463,6 +2463,38 @@ def simplify(self, validate=True, validate_all=False, verbose=False): from dace.transformation.passes.simplify import SimplifyPass return SimplifyPass(validate=validate, validate_all=validate_all, verbose=verbose).apply_pass(self, {}) + def auto_optimize(self, + device: dtypes.DeviceType, + validate: bool = True, + validate_all: bool = False, + symbols: Dict[str, int] = None, + use_gpu_storage: bool = False): + """ + Runs a basic sequence of transformations to optimize a given SDFG to decent + performance. In particular, performs the following: + + * Simplify + * Auto-parallelization (loop-to-map) + * Greedy application of SubgraphFusion + * Tiled write-conflict resolution (MapTiling -> AccumulateTransient) + * Tiled stream accumulation (MapTiling -> AccumulateTransient) + * Collapse all maps to parallelize across all dimensions + * Set all library nodes to expand to ``fast`` expansion, which calls + the fastest library on the target device + + :param device: the device to optimize for. + :param validate: If True, validates the SDFG after all transformations + have been applied. + :param validate_all: If True, validates the SDFG after every step. + :param symbols: Optional dict that maps symbols (str/symbolic) to int/float + :param use_gpu_storage: If True, changes the storage of non-transient data to GPU global memory. + :note: Operates in-place on the given SDFG. + :note: This function is still experimental and may harm correctness in + certain cases. Please report an issue if it does. + """ + from dace.transformation.auto.auto_optimize import auto_optimize + auto_optimize(device, validate, validate_all, symbols, use_gpu_storage) + def _initialize_transformations_from_type( self, xforms: Union[Type, List[Type], 'dace.transformation.PatternTransformation'],