[Mlir-commits] [clang] [mlir] [llvm] [OpenMP] Migrate GPU Reductions CodeGen from Clang to OMPIRBuilder (PR #80343)

Jan Leyonberg llvmlistbot at llvm.org
Tue Feb 6 10:18:40 PST 2024


================
@@ -2719,10 +4051,24 @@ getKmpcForStaticLoopForType(Type *Ty, OpenMPIRBuilder *OMPBuilder,
 static void createTargetLoopWorkshareCall(
     OpenMPIRBuilder *OMPBuilder, WorksharingLoopType LoopType,
     BasicBlock *InsertBlock, Value *Ident, Value *LoopBodyArg,
-    Type *ParallelTaskPtr, Value *TripCount, Function &LoopBodyFn) {
-  Type *TripCountTy = TripCount->getType();
+    Type *ParallelTaskPtr, Value *TripCountOrig, Function &LoopBodyFn) {
   Module &M = OMPBuilder->M;
   IRBuilder<> &Builder = OMPBuilder->Builder;
+  Value *TripCount = TripCountOrig;
+  // FIXME(JAN): The trip count is 1 larger than it should be for GPU, this may
+  // not be the right way to fix it, but this works for now.
----------------
jsjodin wrote:

Will this give the correct trip count in Clang? I know Flang's trip count value is +1 compared to what Clang was generating so that's why this was added (temporarily). It would be best if we could agree on the same trip count and this adjustment could go away. Maybe that would have to be a separate patch?

https://github.com/llvm/llvm-project/pull/80343


More information about the Mlir-commits mailing list