Skip to content

Commit

Permalink
Revert "use dace auto-optimize on gpu"
Browse files Browse the repository at this point in the history
This reverts commit 5d5992a.
  • Loading branch information
edopao committed Dec 12, 2024
1 parent c167def commit eb17345
Showing 1 changed file with 7 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@
from typing import Optional

import dace
import dace.transformation
import dace.transformation.auto
import dace.transformation.auto.auto_optimize
import factory

from gt4py._core import definitions as core_defs
Expand Down Expand Up @@ -59,31 +56,15 @@ def generate_sdfg(
ir, common.offset_provider_to_type(offset_provider), column_dim
)

# TODO(phimuell): check auto-optimize pipeline on gpu for scan field operators
use_gtx_transformations = not on_gpu

if auto_opt:
if use_gtx_transformations:
gtx_transformations.gt_auto_optimize(sdfg, gpu=on_gpu)
else:
sdfg.simplify()
device_type = dace.dtypes.DeviceType.GPU if on_gpu else dace.dtypes.DeviceType.CPU
sdfg = dace.transformation.auto.auto_optimize.auto_optimize(
sdfg, device_type, use_gpu_storage=on_gpu
)
gtx_transformations.gt_auto_optimize(sdfg, gpu=on_gpu)
elif on_gpu:
if use_gtx_transformations:
# We run simplify to bring the SDFG into a canonical form that the gpu transformations
# can handle. This is a workaround for an issue with scalar expressions that are
# promoted to symbolic expressions and computed on the host (CPU), but the intermediate
# result is written to a GPU global variable (https://github.com/spcl/dace/issues/1773).
gtx_transformations.gt_simplify(sdfg)
gtx_transformations.gt_gpu_transformation(sdfg, try_removing_trivial_maps=True)
else:
sdfg.simplify()
dace.transformation.auto.auto_optimize.apply_gpu_storage(sdfg)
sdfg.apply_gpu_transformations()
sdfg.simplify()
# We run simplify to bring the SDFG into a canonical form that the gpu transformations
# can handle. This is a workaround for an issue with scalar expressions that are
# promoted to symbolic expressions and computed on the host (CPU), but the intermediate
# result is written to a GPU global variable (https://github.com/spcl/dace/issues/1773).
gtx_transformations.gt_simplify(sdfg)
gtx_transformations.gt_gpu_transformation(sdfg, try_removing_trivial_maps=True)

return sdfg

Expand Down

0 comments on commit eb17345

Please sign in to comment.