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

[Flang][OpenMP][MLIR][Lower] Update lowering to use wrapper ops #49

Conversation

skatrak
Copy link

@skatrak skatrak commented Mar 8, 2024

This patch introduces the following changes:

  • Complete OpenMP directive sets to include masked and taskloop-related ones.
  • Refactor clause processing to store related operands in structures. These are combined into construct-specific operand structures using a mixin pattern and simplify keeping track of operand lists used for creating OpenMP operations as well as reducing argument lists.
  • Update the lowering to MLIR of loop constructs to follow the wrapper + canonical loop approach. This includes some changes to early privatization (as opposed to "delayed privatization") that need testing.
  • Add lowering for the simplified omp.canonical_loop operation, based on omp.wsloop.
  • Significant refactor of OpenMP construct lowering, separating composite constructs into their own "gen" functions and handling combined loop constructs in a more scalable way. Updated genOMP functions to follow the same set of patterns to make it more understandable. Split clause processing calls from code generation for operations in preparation for reusing the same code when dealing with composite constructs.
  • Add basic support for taskloop, for completeness sake.
  • Document missing clauses.
  • Move some code from OpenMP.cpp to ClauseProcessor.cpp and call it there to simplify calls to certain process...() methods that were always followed by the same post-processing.
  • Add and populate "composite" attribute on wrapper operations.
  • Add empty constructors for wrapper operations.
  • Update LoopWrapperInterface to avoid compilation problems.
  • Update Task* operation's names to follow the same capitalization convention.
  • Changes to SCF to OpenMP conversion to produce a wrapper omp.wsloop with a nested omp.canonical_loop rather than an invalid omp.wsloop.
  • Document missing verifier checks on wrapper operations.

All these changes are still WIP, as they haven't been tested. It's also a TODO to support composite constructs, though almost everything is in place in order to allow that. I'll update this PR after I spend some time testing it and add support for composite constructs.

Copy link

@kparzysz kparzysz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you isolate the addition of CanonicalLoop op into a separate PR?

Overall the changes look ok, but there are several logical groups of changes that make more sense in separate PRs.

This patch introduces the following changes:
  - Complete OpenMP directive sets to include masked and taskloop-related ones.
  - Refactor clause processing to store related operands in structures. These
are combined into construct-specific operand structures using a mixin pattern
and simplify keeping track of operand lists used for creating OpenMP
operations and reduces argument lists.
  - Update the lowering to MLIR of loop constructs to follow the wrapper +
canonical loop approach. This includes some changes to privatization that need
testing.
  - Add lowering for the omp.canonical_loop operation, based on omp.wsloop.
  - Significant refactor of OpenMP construct lowering, separating composite
constructs into their own "gen" functions and handling combined loop constructs
in a more scalable way. Updated genOMP functions to follow the same set of
patterns to make it more understandable. Split clause processing calls from
code generation for operations in preparation for reusing the same code when
dealing with composite constructs.
  - Add basic support for taskloop, for completeness sake.
  - Document missing clauses.
  - Move some code from OpenMP.cpp to ClauseProcessor.cpp and call it there
to simplify calls to certain process methods that were always followed by the
same post-processing.
  - Add and populate "composite" attribute on wrapper operations.
  - Add empty constructors for wrapper operations.
  - Update `LoopWrapperInterface` to avoid compilation problems.
  - Update `Task*` operation's names to follow the same capitalization
convention.
  - Changes to SCF to OpenMP conversion to produce a wrapper omp.wsloop with a
nested omp.canonical_loop rather than an invalid omp.wsloop.
  - Document missing verifier checks on wrapper operations.
  - Make temporary changes to OpenMP to LLVM IR translation to make this
compilable.

All these changes are still WIP, as they haven't been tested.
@skatrak skatrak force-pushed the users/skatrak/composite-03-lowering branch from 2266fb1 to 1e47d70 Compare March 14, 2024 11:45
@skatrak
Copy link
Author

skatrak commented May 8, 2024

Features in this PR already landed via merge from main.

@skatrak skatrak closed this May 8, 2024
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.

None yet

3 participants