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

Complete Transition to Control Flow Regions #1676

Open
wants to merge 99 commits into
base: main
Choose a base branch
from

Conversation

phschaad
Copy link
Collaborator

@phschaad phschaad commented Oct 8, 2024

This PR completes the transition to hierarchical control flow regions in DaCe. By nature of the significance in change that is brought through the transition to hierarchical control flow regions, this PR is rather substantial. A summary of all adaptations is not feasible, but the most important changes and adaptations are listed below:

  • Change the default of the Python frontend to generate SDFGs using experimental CFG blocks. A subsequent PR will remove the option to not use experimental CFG blocks entirely, but this was left to a separate PR to avoid growing this one even more than it already has.
  • The option to write a pass or transformation that is not compatible with experimental blocks has been removed, forcing new transformations and passes to consider them in their design.
  • Simplifications to loop related transformations by adapting explicit loop regions.
  • Add a new pass base type, ControlFlowRegionPass: This pass works like StatePass or ScopePass, and can be extended to write a pass that applies recursively to each control flow region of an SDFG. An option can be set to either apply bottom-up or top-down.
  • A pass has been added to dead code elimination to prune empty or falsy conditional branches.
  • Include a control flow raising pass in the simplification pipeline, ensuring that even SDFGs generated without the explicit use of experimental blocks are raised to the new style SDFGs.
  • Adapt all passes and transformations currently in main DaCe to work with SDFGs containing experimental CFG blocks.
  • Almost all transformations and analyses now expect that experimental blocks are used for regular / reducible control flow, meaning some control flow analyses have been ditched to improve overall performance and reliability of DaCe, and remove redundancy.
  • Ensure all compiler backends correctly handle experimental blocks.
  • Adapt state propagation into a separate pass that has been made to use experimental blocks. Legacy state propagation has been left in for now, including tests that ensure it works as intended, to avoid making this PR even larger. However, it is planned to remove this in a subsequent PR soon.
  • A block fusion pass has been added to the simplification pipeline. This operates similar to StateFusion, but fuses no-op general control flow blocks (empty states or control flow blocks) with other control flow blocks. This reduces the number of nodes and edges in CFGs further.
  • Numerous bugfixes with respect to experimental blocks and analyses around them, thanks to the ability to now run the entire CI pipeline with them.

Note: The FV3 integration test fails and will continue to fail with this PR, since GT4Py cartesian, which is used by PyFV3, does not consider experimental blocks in their design. Since DaCe v1.0.0 will be released without this PR in it, my suggestion is to limit the application of the FV3 integration and regression tests to PRs which are made to a specific v1.0.0 maintenance branch, which is used for fixes to v1.0.0.

@phschaad phschaad added the no-ci Do not run any CI or actions for this PR label Oct 8, 2024
@phschaad
Copy link
Collaborator Author

Any thoughts on how to go about the pyFV3 tests? It appears that this mostly comes down to GT4Py cartesian, which of course is not adapted to use the new structure but now that control flow raising is in the simplification pass automatically uses it.

@tbennun tbennun removed their request for review October 29, 2024 18:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 👀 In review
3 participants