[MLIR][OpenMP] Refactor translation of omp.loop_nest
#98336
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The
omp.loop_nestoperation is always wrapped by a set of one or more OpenMP loop wrapper operations (i.e. implementing theomp::LoopWrapperInterface), which impact how it must be lowered.However, the creation of the list of canonical loop objects and processing of the
collapseinformation (plus potentially other loop transformations when supported in the future) have to be performed in the same way regardless of the loop wrappers applied. This patch extracts this common handling out of the translation functions foromp.wsloopandomp.simdand makes some infrastructure changes in preparation for handling multiple wrappers (i.e. composite constructs).This work uncovered a couple bugs that are also addressed:
LoopNestOp::gatherWrappers()would includeomp.parallelwhen not taking a loop wrapper role.omp.loop_nestinside ofomp.simdalways assumed the stop value was included, which wasn't caught due to a broken unit test.This patch is implemented assuming
omp.parallelremains a loop wrapper operation, which is currently under discussion in this RFC. Until consensus is reached there, this will remain as a draft PR.