[Mlir-commits] [mlir] 6deb5d4 - [NFC][OpenMP][MLIR] Verify if empty workshare loop is lowered correctly (#75518)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Mon Dec 18 02:59:39 PST 2023


Author: Dominik Adamski
Date: 2023-12-18T11:59:35+01:00
New Revision: 6deb5d4e440f34e6838eaf617198caea7ce721c5

URL: https://github.com/llvm/llvm-project/commit/6deb5d4e440f34e6838eaf617198caea7ce721c5
DIFF: https://github.com/llvm/llvm-project/commit/6deb5d4e440f34e6838eaf617198caea7ce721c5.diff

LOG: [NFC][OpenMP][MLIR] Verify if empty workshare loop is lowered correctly (#75518)

Check if workshare loop without loop body is lowered correctly i.e.:
  1) null pointer is passed to OpenMP device RTL function as a
     parameter which denotes loop function body aggregated parameters
  2) Outlined loop function body has only one parameter - loop counter

Added: 
    

Modified: 
    mlir/test/Target/LLVMIR/omptarget-wsloop.mlir

Removed: 
    


################################################################################
diff  --git a/mlir/test/Target/LLVMIR/omptarget-wsloop.mlir b/mlir/test/Target/LLVMIR/omptarget-wsloop.mlir
index ba641be4dada17..220eb85b3483ec 100644
--- a/mlir/test/Target/LLVMIR/omptarget-wsloop.mlir
+++ b/mlir/test/Target/LLVMIR/omptarget-wsloop.mlir
@@ -15,6 +15,16 @@ module attributes {dlti.dl_spec = #dlti.dl_spec<#dlti.dl_entry<"dlti.alloca_memo
       }
     llvm.return
   }
+
+  llvm.func @target_empty_wsloop(){
+      %loop_ub = llvm.mlir.constant(9 : i32) : i32
+      %loop_lb = llvm.mlir.constant(0 : i32) : i32
+      %loop_step = llvm.mlir.constant(1 : i32) : i32
+      omp.wsloop for  (%loop_cnt) : i32 = (%loop_lb) to (%loop_ub) inclusive step (%loop_step) {
+        omp.yield
+      }
+    llvm.return
+  }
 }
 
 // CHECK: define void @[[FUNC0:.*]](ptr %[[ARG0:.*]])
@@ -31,3 +41,7 @@ module attributes {dlti.dl_spec = #dlti.dl_spec<#dlti.dl_entry<"dlti.alloca_memo
 // CHECK:   %[[GEP3:.*]] = getelementptr [10 x i32], ptr %[[LOADGEP]], i32 0, i32 %[[TMP2:.*]]
 // CHECK:   store i32 %[[VAL0:.*]], ptr %[[GEP3]], align 4
 
+// CHECK: define void @[[FUNC_EMPTY_WSLOOP:.*]]()
+// CHECK:   call void @__kmpc_for_static_loop_4u(ptr addrspacecast (ptr addrspace(1) @[[GLOB2:[0-9]+]] to ptr), ptr @[[LOOP_EMPTY_BODY_FN:.*]], ptr null, i32 10, i32 %[[NUM_THREADS:.*]], i32 0)
+
+// CHECK: define internal void @[[LOOP_EMPTY_BODY_FN]](i32 %[[LOOP_CNT:.*]])


        


More information about the Mlir-commits mailing list