Add loop regions to the frontend's capabilities
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.
The PR depends on https://github.com/spcl/dace/pull/1511.
For more information on LoopRegions please refer to the PR that introduced them.