Skip to content

Commit 6deb5d4

Browse files
[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
1 parent 428660c commit 6deb5d4

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,16 @@ module attributes {dlti.dl_spec = #dlti.dl_spec<#dlti.dl_entry<"dlti.alloca_memo
1515
}
1616
llvm.return
1717
}
18+
19+
llvm.func @target_empty_wsloop(){
20+
%loop_ub = llvm.mlir.constant(9 : i32) : i32
21+
%loop_lb = llvm.mlir.constant(0 : i32) : i32
22+
%loop_step = llvm.mlir.constant(1 : i32) : i32
23+
omp.wsloop for (%loop_cnt) : i32 = (%loop_lb) to (%loop_ub) inclusive step (%loop_step) {
24+
omp.yield
25+
}
26+
llvm.return
27+
}
1828
}
1929

2030
// CHECK: define void @[[FUNC0:.*]](ptr %[[ARG0:.*]])
@@ -31,3 +41,7 @@ module attributes {dlti.dl_spec = #dlti.dl_spec<#dlti.dl_entry<"dlti.alloca_memo
3141
// CHECK: %[[GEP3:.*]] = getelementptr [10 x i32], ptr %[[LOADGEP]], i32 0, i32 %[[TMP2:.*]]
3242
// CHECK: store i32 %[[VAL0:.*]], ptr %[[GEP3]], align 4
3343

44+
// CHECK: define void @[[FUNC_EMPTY_WSLOOP:.*]]()
45+
// 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)
46+
47+
// CHECK: define internal void @[[LOOP_EMPTY_BODY_FN]](i32 %[[LOOP_CNT:.*]])

0 commit comments

Comments
 (0)