[Mlir-commits] [llvm] [mlir] [MLIR][OpenMP] Add Taskloop Collapse Support (PR #175924)
Jack Styles
llvmlistbot at llvm.org
Wed Jan 14 09:13:23 PST 2026
================
@@ -2797,6 +2789,22 @@ convertOmpTaskloopOp(Operation &opInst, llvm::IRBuilderBase &builder,
return loopInfo;
};
+ llvm::Value *ubVal = builder.getInt32(1);
+ Operation::operand_range lowerBounds = loopOp.getLoopLowerBounds();
+ Operation::operand_range upperBounds = loopOp.getLoopUpperBounds();
+ if (loopOp.getCollapseNumLoops() > 1) {
+ for (uint64_t i = 0; i < loopOp.getCollapseNumLoops(); i++) {
+ ubVal = builder.CreateMul(
+ ubVal,
+ builder.CreateSub(
+ moduleTranslation.lookupValue(upperBounds[i]),
+ builder.CreateSub(moduleTranslation.lookupValue(lowerBounds[i]),
+ builder.getInt32(1))));
+ }
+ } else {
+ ubVal = moduleTranslation.lookupValue(upperBounds[0]);
----------------
Stylie777 wrote:
This approach keeps the original approach of just passing through the outer loop upper bound. I am open to other suggestions on how we can process this, but If let this was the best way to show continuity with the original implementation, and keep the collapse implementation separate as it is different.
https://github.com/llvm/llvm-project/pull/175924
More information about the Mlir-commits
mailing list