[Mlir-commits] [mlir] [MLIR][OpenMP] Add canonical loop LLVM-IR lowering (PR #147069)
Sergio Afonso
llvmlistbot at llvm.org
Wed Aug 6 07:59:25 PDT 2025
================
@@ -108,6 +110,41 @@ class ModuleTranslation {
return blockMapping.lookup(block);
}
+ /// Find the LLVM-IR loop that represents an MLIR loop.
+ llvm::CanonicalLoopInfo *lookupOMPLoop(omp::NewCliOp mlir) const {
----------------
skatrak wrote:
Sorry @Meinersbur for the late comment, was just now able to take a brief look at this. I don't love the idea of introducing OpenMP dialect-specific handling into this generic MLIR translation class, did you consider using stack frames (`OpenMPLoopInfoStackFrame`) similarly to what is done to `omp.loop_nest` instead?
The idea there was to create a stack frame holding a single null `llvm::CanonicalLoopInfo *` when finding the top-level loop wrapper (which we know is associated to a single `omp.loop_nest`), then populating it when that operation is translated to LLVM IR and finally updating it with the processing of each loop wrapper. It would probably work somewhat differently in this case, but if we could use a similar method or even reuse/extend what we have, that might be helpful when supporting e.g. worksharing of transformed loops. Plus, I think we should really try to avoid dialect-specific handling here.
https://github.com/llvm/llvm-project/pull/147069
More information about the Mlir-commits
mailing list