Skip to content

Commit

Permalink
Add auto_optimize to SDFG API
Browse files Browse the repository at this point in the history
  • Loading branch information
tbennun authored Nov 7, 2024
1 parent d295a62 commit b2a95e8
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions dace/sdfg/sdfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand Down

0 comments on commit b2a95e8

Please sign in to comment.