Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi SDFG Auto Optimize Problems #3

Open
ThrudPrimrose opened this issue Oct 9, 2024 · 2 comments
Open

Multi SDFG Auto Optimize Problems #3

ThrudPrimrose opened this issue Oct 9, 2024 · 2 comments
Assignees

Comments

@ThrudPrimrose
Copy link
Owner

I tried merging my auto-profile, auto-apply utility functions and transformations to the multi_sdfg branch. Currently auto_optimize fails in the simplify pass. (Before, it was not failing with an exception and only resulting in an invalid SDFG).

To reproduce:

import dace
from dace.transformation.auto_tile import auto_tile_util, auto_profile
from dace.sdfg import SDFG
from dace.transformation.auto import auto_optimize as aopt

sdfg = SDFG.from_file("velocity_tendencies_simplified_f.sdfgz")
#sdfg.simplify()
#sdfg.apply_gpu_transformations(validate=False, validate_all=False)
sdfg2 = aopt.auto_optimize(sdfg, dace.DeviceType.GPU, validate=False, validate_all=False)
inputs = dict()
profile_results = auto_profile.auto_profile(
    sdfg=sdfg2,
    defined_symbols=inputs,
    verbose=True,
    re_profile=True,
    save_individual_kernels=True,
)

Input file is the velocity tendencies.

Error is:

_4047_p_int_38, 0:__f2dace_SA_geofac_rot_d_1_s_4048_p_int_38, 0:__f2dace_SA_geofac_rot_d_2_s_4049_p_int_38, src_shape: (1,)
  warnings.warn(f'validate_subsets failed: {ex}')
Traceback (most recent call last):
  File "/home/primrose/Work/IconGrounds/auto_profile.py", line 9, in <module>
    sdfg2 = aopt.auto_optimize(sdfg, dace.DeviceType.GPU, validate=False, validate_all=False)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/primrose/Work/forkdace/dace/transformation/auto/auto_optimize.py", line 575, in auto_optimize
    sdfg.simplify(validate=False, validate_all=validate_all)
  File "/home/primrose/Work/forkdace/dace/sdfg/sdfg.py", line 2456, in simplify
    return SimplifyPass(validate=validate, validate_all=validate_all, verbose=verbose).apply_pass(self, {})
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/primrose/Work/forkdace/dace/transformation/passes/simplify.py", line 130, in apply_pass
    result = super().apply_pass(sdfg, pipeline_results)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/primrose/Work/forkdace/dace/transformation/pass_pipeline.py", line 574, in apply_pass
    newret = super().apply_pass(sdfg, state)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/primrose/Work/forkdace/dace/transformation/pass_pipeline.py", line 529, in apply_pass
    r = self.apply_subpass(sdfg, p, state)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/primrose/Work/forkdace/dace/transformation/passes/simplify.py", line 107, in apply_subpass
    ret = p.apply_pass(sdfg, state)
          ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/primrose/Work/forkdace/dace/transformation/passes/fusion_inline.py", line 83, in apply_pass
    inlined = inline_sdfgs(sdfg, self.permissive, self.progress, self.multistate)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/primrose/Work/forkdace/dace/sdfg/utils.py", line 1345, in inline_sdfgs
    inliner.apply(parent_state, parent_sdfg)
  File "/home/primrose/Work/forkdace/dace/transformation/transformation.py", line 1073, in blocksafe_wrapper
    return vanilla_method(tgt, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/primrose/Work/forkdace/dace/transformation/interstate/sdfg_nesting.py", line 517, in apply
    modified_edges |= self._modify_memlet_path(new_incoming_edges, nstate, state, sink_to_outer, True,
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/primrose/Work/forkdace/dace/transformation/interstate/sdfg_nesting.py", line 802, in _modify_memlet_path
    traverse(child, state, nstate)
  File "/home/primrose/Work/forkdace/dace/transformation/interstate/sdfg_nesting.py", line 793, in traverse
    mtree_node.edge._data = helpers.unsqueeze_memlet(mtree_node.edge.data,
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/primrose/Work/forkdace/dace/transformation/helpers.py", line 823, in unsqueeze_memlet
    internal_subset = internal_subset.offset_new(internal_offset, False)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/primrose/Work/forkdace/dace/subsets.py", line 429, in offset_new
    return Range([(self.ranges[i][0] + mult * off[i], self.ranges[i][1] + mult * off[i], self.ranges[i][2])
                                              ~~~^^^
IndexError: list index out of range
@ThrudPrimrose
Copy link
Owner Author

Phil I decided to create issues here than constantly write messages that can get lost

@ThrudPrimrose
Copy link
Owner Author

My first big task is to fix simplify and auto optimize bugs for velocity tendencies. I want to try to be a bit general such that we can apply everything to ECRAD without too much re-writing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants