[llvm] bdf3060 - [LLVM][OpenMP] Correct the function signature of `__kmpc_parallel_level`
Shilei Tian via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 20 06:46:51 PST 2023
Author: Shilei Tian
Date: 2023-01-20T09:46:45-05:00
New Revision: bdf30603f28f5a97a63350e575e1b5cef052e7d0
URL: https://github.com/llvm/llvm-project/commit/bdf30603f28f5a97a63350e575e1b5cef052e7d0
DIFF: https://github.com/llvm/llvm-project/commit/bdf30603f28f5a97a63350e575e1b5cef052e7d0.diff
LOG: [LLVM][OpenMP] Correct the function signature of `__kmpc_parallel_level`
`__kmpc_parallel_level` used to be a function w/o any argument, but in the new
device runtime, it accepts two. This patch simply corrects it in `OMPKinds.def`.
```
uint16_t __kmpc_parallel_level(IdentTy *Loc, uint32_t);
```
Reviewed By: jhuber6
Differential Revision: https://reviews.llvm.org/D141655
Added:
Modified:
llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
llvm/test/Transforms/OpenMP/parallel_level_fold.ll
Removed:
################################################################################
diff --git a/llvm/include/llvm/Frontend/OpenMP/OMPKinds.def b/llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
index 3a928ea86ed12..6d7f3adfc0ae5 100644
--- a/llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
+++ b/llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
@@ -473,7 +473,7 @@ __OMP_RTL(__kmpc_free_shared, false, Void, VoidPtr, SizeTy)
__OMP_RTL(__kmpc_begin_sharing_variables, false, Void, VoidPtrPtrPtr, SizeTy)
__OMP_RTL(__kmpc_end_sharing_variables, false, Void, )
__OMP_RTL(__kmpc_get_shared_variables, false, Void, VoidPtrPtrPtr)
-__OMP_RTL(__kmpc_parallel_level, false, Int8, )
+__OMP_RTL(__kmpc_parallel_level, false, Int16, IdentPtr, Int32)
__OMP_RTL(__kmpc_is_spmd_exec_mode, false, Int8, )
__OMP_RTL(__kmpc_barrier_simple_spmd, false, Void, IdentPtr, Int32)
__OMP_RTL(__kmpc_barrier_simple_generic, false, Void, IdentPtr, Int32)
diff --git a/llvm/test/Transforms/OpenMP/parallel_level_fold.ll b/llvm/test/Transforms/OpenMP/parallel_level_fold.ll
index 654f7b486283a..8cb8abe95fc44 100644
--- a/llvm/test/Transforms/OpenMP/parallel_level_fold.ll
+++ b/llvm/test/Transforms/OpenMP/parallel_level_fold.ll
@@ -7,15 +7,18 @@ target triple = "nvptx64"
@no_spmd_exec_mode = weak constant i8 1
@spmd_exec_mode = weak constant i8 0
@parallel_exec_mode = weak constant i8 0
- at G = external global i8
+ at G = external global i16
@llvm.compiler.used = appending global [3 x ptr] [ptr @no_spmd_exec_mode, ptr @spmd_exec_mode, ptr @parallel_exec_mode], section "llvm.metadata"
;.
; CHECK: @[[NO_SPMD_EXEC_MODE:[a-zA-Z0-9_$"\\.-]+]] = weak constant i8 1
; CHECK: @[[SPMD_EXEC_MODE:[a-zA-Z0-9_$"\\.-]+]] = weak constant i8 0
; CHECK: @[[PARALLEL_EXEC_MODE:[a-zA-Z0-9_$"\\.-]+]] = weak constant i8 0
-; CHECK: @[[G:[a-zA-Z0-9_$"\\.-]+]] = external global i8
+; CHECK: @[[G:[a-zA-Z0-9_$"\\.-]+]] = external global i16
; CHECK: @[[LLVM_COMPILER_USED:[a-zA-Z0-9_$"\\.-]+]] = appending global [3 x ptr] [ptr @no_spmd_exec_mode, ptr @spmd_exec_mode, ptr @parallel_exec_mode], section "llvm.metadata"
+; CHECK: @[[NONE_SPMD_NESTED_PARALLELISM:[a-zA-Z0-9_$"\\.-]+]] = weak constant i8 0
+; CHECK: @[[SPMD_NESTED_PARALLELISM:[a-zA-Z0-9_$"\\.-]+]] = weak constant i8 0
+; CHECK: @[[PARALLEL_NESTED_PARALLELISM:[a-zA-Z0-9_$"\\.-]+]] = weak constant i8 0
;.
define weak void @none_spmd() {
; CHECK-LABEL: define {{[^@]+}}@none_spmd() {
@@ -64,19 +67,19 @@ define weak void @parallel() {
define internal void @mixed_helper() {
; CHECK-LABEL: define {{[^@]+}}@mixed_helper() {
-; CHECK-NEXT: [[LEVEL:%.*]] = call i8 @__kmpc_parallel_level()
-; CHECK-NEXT: store i8 [[LEVEL]], ptr @G, align 1
+; CHECK-NEXT: [[LEVEL:%.*]] = call zeroext i16 @__kmpc_parallel_level(ptr null, i32 0)
+; CHECK-NEXT: store i16 [[LEVEL]], ptr @G, align 2
; CHECK-NEXT: ret void
;
- %level = call i8 @__kmpc_parallel_level()
- store i8 %level, ptr @G
+ %level = call zeroext i16 @__kmpc_parallel_level(ptr null, i32 0)
+ store i16 %level, ptr @G
ret void
}
define internal void @none_spmd_helper() {
; CHECK-LABEL: define {{[^@]+}}@none_spmd_helper() {
-; CHECK-NEXT: [[LEVEL12:%.*]] = call i8 @__kmpc_parallel_level()
-; CHECK-NEXT: [[C:%.*]] = icmp eq i8 [[LEVEL12]], 0
+; CHECK-NEXT: [[LEVEL12:%.*]] = call zeroext i16 @__kmpc_parallel_level(ptr null, i32 0)
+; CHECK-NEXT: [[C:%.*]] = icmp eq i16 [[LEVEL12]], 0
; CHECK-NEXT: br i1 [[C]], label [[T:%.*]], label [[F:%.*]]
; CHECK: t:
; CHECK-NEXT: call void @foo()
@@ -85,8 +88,8 @@ define internal void @none_spmd_helper() {
; CHECK-NEXT: call void @bar()
; CHECK-NEXT: ret void
;
- %level12 = call i8 @__kmpc_parallel_level()
- %c = icmp eq i8 %level12, 0
+ %level12 = call zeroext i16 @__kmpc_parallel_level(ptr null, i32 0)
+ %c = icmp eq i16 %level12, 0
br i1 %c, label %t, label %f
t:
call void @foo()
@@ -98,11 +101,11 @@ f:
define internal void @spmd_helper() {
; CHECK-LABEL: define {{[^@]+}}@spmd_helper() {
-; CHECK-NEXT: store i8 1, ptr @G, align 1
+; CHECK-NEXT: store i8 1, ptr @G, align 2
; CHECK-NEXT: ret void
;
- %level = call i8 @__kmpc_parallel_level()
- store i8 %level, ptr @G
+ %level = call zeroext i16 @__kmpc_parallel_level(ptr null, i32 0)
+ store i16 %level, ptr @G
ret void
}
@@ -118,18 +121,18 @@ define internal void @__kmpc_parallel_51(ptr, i32, i32, i32, i32, ptr, ptr, ptr,
define internal void @parallel_helper() {
; CHECK-LABEL: define {{[^@]+}}@parallel_helper() {
-; CHECK-NEXT: [[LEVEL:%.*]] = call i8 @__kmpc_parallel_level()
-; CHECK-NEXT: store i8 [[LEVEL]], ptr @G, align 1
+; CHECK-NEXT: [[LEVEL:%.*]] = call zeroext i16 @__kmpc_parallel_level(ptr null, i32 0)
+; CHECK-NEXT: store i16 [[LEVEL]], ptr @G, align 2
; CHECK-NEXT: ret void
;
- %level = call i8 @__kmpc_parallel_level()
- store i8 %level, ptr @G
+ %level = call zeroext i16 @__kmpc_parallel_level(ptr null, i32 0)
+ store i16 %level, ptr @G
ret void
}
declare void @foo()
declare void @bar()
-declare i8 @__kmpc_parallel_level()
+declare zeroext i16 @__kmpc_parallel_level(ptr, i32)
declare i32 @__kmpc_target_init(ptr, i8 zeroext, i1 zeroext) #1
declare void @__kmpc_target_deinit(ptr nocapture readnone, i8 zeroext) #1
More information about the llvm-commits
mailing list