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

Add loop regions to the frontend's capabilities #1475

Open
wants to merge 54 commits into
base: master
Choose a base branch
from

Conversation

phschaad
Copy link
Collaborator

@phschaad phschaad commented Dec 11, 2023

This PR lets the Python and Fortran frontends (optionally) generate LoopRegions for DaCe programs. This forms the third core element of the plan to make loops first class citizens of SDFGs.

This PR is fully backwards compatible. LoopRegions are always generated from new Python DaCe programs, and the legacy way of constructing a while / for loop is gone to remove complexity. To provide backwards compatibility, these LoopRegions are by default immediately inlined into a traditional single level state machine loop as soon as program parsing is completed, before simplification and / or validation. However, an optional boolean parameter use_experimental_cfg_blocks can be set to True when declaring a DaCe program in Python to enable their use, which skips this inlining step.

Example use:

import dace
import numpy

N = dace.symbol('N')

@dace.program(use_experimental_cfg_blocks=True):
def mat_mult(A: dace.float64[N, N], B: dace.float64[N, N]):
    return A @ B

The Fortran frontend similarly only utilizes LoopRegions if an additional parameter use_experimenatl_cfg_blocks is passed to the parser together with the program.

Many passes and transformations (including in simplify) do not yet have the capability of handling the new, hierarchical SDFGs. To not break the pipeline and to provide backwards compatibility, a new decorator @single_level_sdfg_only has been added, which can be (and has been) placed over any pass or transformation that is not compatible with the new style SDFGs. Passes annotated with this decorator are skipped in all pipelines where they occur and instead generate warnings that they were skipped due to compatibility issues.

For more information on LoopRegions please refer to the PR that introduced them.

@phschaad phschaad added enhancement New feature or request frontend core labels Dec 11, 2023
@phschaad phschaad marked this pull request as ready for review December 11, 2023 19:21
@phschaad phschaad marked this pull request as draft December 11, 2023 19:26
@phschaad phschaad marked this pull request as ready for review May 16, 2024 12:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core enhancement New feature or request frontend
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant