llvm-project
llvm-project copied to clipboard
[Flang][OpenMP][MLIR][Lower] Update lowering to use wrapper ops
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
LoopWrapperInterfaceto 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.