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

Extract: Improved region-outlining for complex procedures #412

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

Conversation

mlange05
Copy link
Collaborator

This change brings various improvements to enable the use of outine_pragma_regions for more complex code regions. This is intended to eventually allow us to combine pragma-based extraction with auto-parallelisation to re-rewrite complex control-flow sections.

In particular, this PR refactors the utility structure to allow invocations per-region, deals with derived type symbols and arguments, and imposes an ordering on extracted argument signatures. There are also other small improvements added, as well as a utility to remove unused imports and import symbols.

In more detail:

  • Use of Transformer, instead of the more complex NestedMaskedTransformer to replace PragmaRegion nodes
  • Separation of the outer loop over subroutines from the specific single call-subroutine extraction for a single region
  • A new utility to remove unused imports and trim unused symbols from import statements within a routine
  • Ability to handle C-style imports when pragma-outlining sburoutines
  • Resolving explicitly requested argument symbols (via the "intent" notation) from the parent routine. This allows explicitly requesting arguments that might not be used in the body, but are necessary for shape info in the spec of the extracted routine.
  • Handling of derived-type symbols in extracted body/routine, in particular ensuring that only the parent is added to the extracted routine signature
  • Additional tests for derived-type arguments and associated symbols in extracted bodies/routines. The latter is not strictly needed, but useful to have.
  • Explicit ordering of arguments for reproducibility - this will use lexicographic base ordering, but put derived-type arguments, before array arguments, before scalar arguments.

This now allows us to call outlining extraction on a single pragma
region, while the overarching utility uses this in its own pragma
loop.
Need to explicit give an empty tuple for kwargument when creating
the CallStatement, as dataflow analysis will iterate it.
Copy link

Documentation for this branch can be viewed at https://sites.ecmwf.int/docs/loki/412/index.html

Copy link

codecov bot commented Oct 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.07%. Comparing base (58adb24) to head (657550c).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #412      +/-   ##
==========================================
+ Coverage   93.05%   93.07%   +0.02%     
==========================================
  Files         198      198              
  Lines       39320    39464     +144     
==========================================
+ Hits        36588    36732     +144     
  Misses       2732     2732              
Flag Coverage Δ
lint_rules 96.39% <ø> (ø)
loki 93.02% <100.00%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mlange05 mlange05 marked this pull request as ready for review October 20, 2024 04:59
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

Successfully merging this pull request may close these issues.

1 participant