[PATCH] D80730: [OPENMP50]Codegen for use_device_addr clauses.
MaskRay added a comment. Hi, you can drop `Reviewers:` `Subscribers:` `Tags:` and the text `Summary:` with the following script arcfilter () { arc amend git log -1 --pretty=%B | awk '/Reviewers:|Subscribers:/{p=1} /Reviewed By:|Differential Revision:/{p=0} !p && !/^Summary:$/ {sub(/^Summary: /,"");print}' | git commit --amend --date=now -F - } `Reviewed By: ` is considered important by some people. You should keep the tag. (I have updated my script to use `--date=now` (setting author date to committer date)) `https://reviews.llvm.org/D80978` contains a git pre-push hook to automate this. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D80730/new/ https://reviews.llvm.org/D80730 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D80730: [OPENMP50]Codegen for use_device_addr clauses.
This revision was automatically updated to reflect the committed changes. Closed by commit rG90b54fa045e3: [OPENMP50]Codegen for use_device_addr clauses. (authored by ABataev). Changed prior to commit: https://reviews.llvm.org/D80730?vs=269618=270131#toc Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D80730/new/ https://reviews.llvm.org/D80730 Files: clang/lib/AST/OpenMPClause.cpp clang/lib/CodeGen/CGOpenMPRuntime.cpp clang/lib/CodeGen/CGStmtOpenMP.cpp clang/lib/CodeGen/CodeGenFunction.h clang/lib/Sema/SemaOpenMP.cpp clang/test/OpenMP/target_data_use_device_addr_codegen.cpp Index: clang/test/OpenMP/target_data_use_device_addr_codegen.cpp === --- /dev/null +++ clang/test/OpenMP/target_data_use_device_addr_codegen.cpp @@ -0,0 +1,224 @@ +// RUN: %clang_cc1 -DCK1 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s +// RUN: %clang_cc1 -DCK1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s + +// RUN: %clang_cc1 -DCK1 -verify -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY0 %s +// RUN: %clang_cc1 -DCK1 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY0 %s +// SIMD-ONLY0-NOT: {{__kmpc|__tgt}} +// expected-no-diagnostics + +#ifndef HEADER +#define HEADER + +// CHECK-DAG: [[SIZES1:@.+]] = private unnamed_addr constant [5 x i64] zeroinitializer +// 96 = 0x60 = OMP_MAP_TARGET_PARAM | OMP_MAP_RETURN_PARAM +// CHECK-DAG: [[MAPTYPES1:@.+]] = private unnamed_addr constant [5 x i64] [i64 96, i64 96, i64 96, i64 96, i64 96] +// 32 = 0x20 = OMP_MAP_TARGET_PARAM +// 281474976710720 = 0x10040 = OMP_MAP_MEMBER_OF | OMP_MAP_RETURN_PARAM +// CHECK-DAG: [[MAPTYPES2:@.+]] = private unnamed_addr constant [5 x i64] [i64 32, i64 281474976710720, i64 281474976710720, i64 281474976710720, i64 281474976710720] +struct S { + int a = 0; + int *ptr = + int = a; + int arr[4]; + S() {} + void foo() { +#pragma omp target data use_device_addr(a, ptr [3:4], ref, ptr[0], arr[:a]) +++a, ++*ptr, ++ref, ++arr[0]; + } +}; + +int main() { + float a = 0; + float *ptr = + float = a; + float arr[4]; + float vla[(int)a]; + S s; + s.foo(); +#pragma omp target data use_device_addr(a, ptr [3:4], ref, ptr[0], arr[:(int)a], vla[0]) + ++a, ++*ptr, ++ref, ++arr[0], ++vla[0]; + return a; +} + +// CHECK-LABEL: @main() +// CHECK: [[A_ADDR:%.+]] = alloca float, +// CHECK: [[PTR_ADDR:%.+]] = alloca float*, +// CHECK: [[REF_ADDR:%.+]] = alloca float*, +// CHECK: [[ARR_ADDR:%.+]] = alloca [4 x float], +// CHECK: [[BPTRS:%.+]] = alloca [5 x i8*], +// CHECK: [[PTRS:%.+]] = alloca [5 x i8*], +// CHECK: [[VLA_ADDR:%.+]] = alloca float, i64 %{{.+}}, +// CHECK: [[PTR:%.+]] = load float*, float** [[PTR_ADDR]], +// CHECK: [[REF:%.+]] = load float*, float** [[REF_ADDR]], +// CHECK: [[ARR:%.+]] = getelementptr inbounds [4 x float], [4 x float]* [[ARR_ADDR]], i64 0, i64 0 +// CHECK: [[BPTR0:%.+]] = getelementptr inbounds [5 x i8*], [5 x i8*]* [[BPTRS]], i32 0, i32 0 +// CHECK: [[BPTR0_A_ADDR:%.+]] = bitcast i8** [[BPTR0]] to float** +// CHECK: store float* [[A_ADDR]], float** [[BPTR0_A_ADDR]], +// CHECK: [[PTR0:%.+]] = getelementptr inbounds [5 x i8*], [5 x i8*]* [[PTRS]], i32 0, i32 0 +// CHECK: [[PTR0_A_ADDR:%.+]] = bitcast i8** [[PTR0]] to float** +// CHECK: store float* [[A_ADDR]], float** [[PTR0_A_ADDR]], +// CHECK: [[BPTR1:%.+]] = getelementptr inbounds [5 x i8*], [5 x i8*]* [[BPTRS]], i32 0, i32 1 +// CHECK: [[BPTR1_PTR_ADDR:%.+]] = bitcast i8** [[BPTR1]] to float** +// CHECK: store float* [[PTR]], float** [[BPTR1_PTR_ADDR]], +// CHECK: [[PTR1:%.+]] = getelementptr inbounds [5 x i8*], [5 x i8*]* [[PTRS]], i32 0, i32 1 +// CHECK: [[PTR1_PTR_ADDR:%.+]] = bitcast i8** [[PTR1]] to float** +// CHECK: store float* [[PTR]], float** [[PTR1_PTR_ADDR]], +// CHECK: [[BPTR2:%.+]] = getelementptr inbounds [5 x i8*], [5 x i8*]* [[BPTRS]], i32 0, i32 2 +// CHECK: [[BPTR2_REF_ADDR:%.+]] = bitcast i8** [[BPTR2]] to float** +// CHECK: store float* [[REF]], float** [[BPTR2_REF_ADDR]], +// CHECK: [[PTR2:%.+]] = getelementptr inbounds [5 x i8*], [5 x i8*]* [[PTRS]], i32 0, i32 2 +//
[PATCH] D80730: [OPENMP50]Codegen for use_device_addr clauses.
ABataev marked an inline comment as done. ABataev added inline comments. Comment at: clang/lib/Sema/SemaOpenMP.cpp:18508 + // Component = CreateBuiltinUnaryOp(ELoc, UO_Deref, Component).get(); + // Component = DefaultFunctionArrayLvalueConversion(Component).get(); +} jdoerfert wrote: > Leftover? Yes, forgot to remove Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D80730/new/ https://reviews.llvm.org/D80730 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D80730: [OPENMP50]Codegen for use_device_addr clauses.
jdoerfert accepted this revision. jdoerfert added a comment. This revision is now accepted and ready to land. One nit below, the others seem silent. LGTM. Comment at: clang/lib/Sema/SemaOpenMP.cpp:18508 + // Component = CreateBuiltinUnaryOp(ELoc, UO_Deref, Component).get(); + // Component = DefaultFunctionArrayLvalueConversion(Component).get(); +} Leftover? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D80730/new/ https://reviews.llvm.org/D80730 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D80730: [OPENMP50]Codegen for use_device_addr clauses.
ABataev updated this revision to Diff 269618. ABataev added a comment. Rebase Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D80730/new/ https://reviews.llvm.org/D80730 Files: clang/lib/AST/OpenMPClause.cpp clang/lib/CodeGen/CGOpenMPRuntime.cpp clang/lib/CodeGen/CGStmtOpenMP.cpp clang/lib/CodeGen/CodeGenFunction.h clang/lib/Sema/SemaOpenMP.cpp clang/test/OpenMP/target_data_use_device_addr_codegen.cpp Index: clang/test/OpenMP/target_data_use_device_addr_codegen.cpp === --- /dev/null +++ clang/test/OpenMP/target_data_use_device_addr_codegen.cpp @@ -0,0 +1,224 @@ +// RUN: %clang_cc1 -DCK1 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s +// RUN: %clang_cc1 -DCK1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s + +// RUN: %clang_cc1 -DCK1 -verify -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY0 %s +// RUN: %clang_cc1 -DCK1 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY0 %s +// SIMD-ONLY0-NOT: {{__kmpc|__tgt}} +// expected-no-diagnostics + +#ifndef HEADER +#define HEADER + +// CHECK-DAG: [[SIZES1:@.+]] = private unnamed_addr constant [5 x i64] zeroinitializer +// 96 = 0x60 = OMP_MAP_TARGET_PARAM | OMP_MAP_RETURN_PARAM +// CHECK-DAG: [[MAPTYPES1:@.+]] = private unnamed_addr constant [5 x i64] [i64 96, i64 96, i64 96, i64 96, i64 96] +// 32 = 0x20 = OMP_MAP_TARGET_PARAM +// 281474976710720 = 0x10040 = OMP_MAP_MEMBER_OF | OMP_MAP_RETURN_PARAM +// CHECK-DAG: [[MAPTYPES2:@.+]] = private unnamed_addr constant [5 x i64] [i64 32, i64 281474976710720, i64 281474976710720, i64 281474976710720, i64 281474976710720] +struct S { + int a = 0; + int *ptr = + int = a; + int arr[4]; + S() {} + void foo() { +#pragma omp target data use_device_addr(a, ptr [3:4], ref, ptr[0], arr[:a]) +++a, ++*ptr, ++ref, ++arr[0]; + } +}; + +int main() { + float a = 0; + float *ptr = + float = a; + float arr[4]; + float vla[(int)a]; + S s; + s.foo(); +#pragma omp target data use_device_addr(a, ptr [3:4], ref, ptr[0], arr[:(int)a], vla[0]) + ++a, ++*ptr, ++ref, ++arr[0], ++vla[0]; + return a; +} + +// CHECK-LABEL: @main() +// CHECK: [[A_ADDR:%.+]] = alloca float, +// CHECK: [[PTR_ADDR:%.+]] = alloca float*, +// CHECK: [[REF_ADDR:%.+]] = alloca float*, +// CHECK: [[ARR_ADDR:%.+]] = alloca [4 x float], +// CHECK: [[BPTRS:%.+]] = alloca [5 x i8*], +// CHECK: [[PTRS:%.+]] = alloca [5 x i8*], +// CHECK: [[VLA_ADDR:%.+]] = alloca float, i64 %{{.+}}, +// CHECK: [[PTR:%.+]] = load float*, float** [[PTR_ADDR]], +// CHECK: [[REF:%.+]] = load float*, float** [[REF_ADDR]], +// CHECK: [[ARR:%.+]] = getelementptr inbounds [4 x float], [4 x float]* [[ARR_ADDR]], i64 0, i64 0 +// CHECK: [[BPTR0:%.+]] = getelementptr inbounds [5 x i8*], [5 x i8*]* [[BPTRS]], i32 0, i32 0 +// CHECK: [[BPTR0_A_ADDR:%.+]] = bitcast i8** [[BPTR0]] to float** +// CHECK: store float* [[A_ADDR]], float** [[BPTR0_A_ADDR]], +// CHECK: [[PTR0:%.+]] = getelementptr inbounds [5 x i8*], [5 x i8*]* [[PTRS]], i32 0, i32 0 +// CHECK: [[PTR0_A_ADDR:%.+]] = bitcast i8** [[PTR0]] to float** +// CHECK: store float* [[A_ADDR]], float** [[PTR0_A_ADDR]], +// CHECK: [[BPTR1:%.+]] = getelementptr inbounds [5 x i8*], [5 x i8*]* [[BPTRS]], i32 0, i32 1 +// CHECK: [[BPTR1_PTR_ADDR:%.+]] = bitcast i8** [[BPTR1]] to float** +// CHECK: store float* [[PTR]], float** [[BPTR1_PTR_ADDR]], +// CHECK: [[PTR1:%.+]] = getelementptr inbounds [5 x i8*], [5 x i8*]* [[PTRS]], i32 0, i32 1 +// CHECK: [[PTR1_PTR_ADDR:%.+]] = bitcast i8** [[PTR1]] to float** +// CHECK: store float* [[PTR]], float** [[PTR1_PTR_ADDR]], +// CHECK: [[BPTR2:%.+]] = getelementptr inbounds [5 x i8*], [5 x i8*]* [[BPTRS]], i32 0, i32 2 +// CHECK: [[BPTR2_REF_ADDR:%.+]] = bitcast i8** [[BPTR2]] to float** +// CHECK: store float* [[REF]], float** [[BPTR2_REF_ADDR]], +// CHECK: [[PTR2:%.+]] = getelementptr inbounds [5 x i8*], [5 x i8*]* [[PTRS]], i32 0, i32 2 +// CHECK: [[PTR2_REF_ADDR:%.+]] = bitcast i8** [[PTR2]] to float** +// CHECK: store float* [[REF]], float** [[PTR2_REF_ADDR]], +// CHECK: [[BPTR3:%.+]] = getelementptr inbounds [5 x
[PATCH] D80730: [OPENMP50]Codegen for use_device_addr clauses.
ABataev updated this revision to Diff 268587. ABataev added a comment. Rebase and fixes Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D80730/new/ https://reviews.llvm.org/D80730 Files: clang/lib/AST/OpenMPClause.cpp clang/lib/CodeGen/CGOpenMPRuntime.cpp clang/lib/CodeGen/CGStmtOpenMP.cpp clang/lib/CodeGen/CodeGenFunction.h clang/lib/Sema/SemaOpenMP.cpp clang/test/OpenMP/target_data_use_device_addr_codegen.cpp Index: clang/test/OpenMP/target_data_use_device_addr_codegen.cpp === --- /dev/null +++ clang/test/OpenMP/target_data_use_device_addr_codegen.cpp @@ -0,0 +1,224 @@ +// RUN: %clang_cc1 -DCK1 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s +// RUN: %clang_cc1 -DCK1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s + +// RUN: %clang_cc1 -DCK1 -verify -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY0 %s +// RUN: %clang_cc1 -DCK1 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY0 %s +// SIMD-ONLY0-NOT: {{__kmpc|__tgt}} +// expected-no-diagnostics + +#ifndef HEADER +#define HEADER + +// CHECK-DAG: [[SIZES1:@.+]] = private unnamed_addr constant [5 x i64] zeroinitializer +// 96 = 0x60 = OMP_MAP_TARGET_PARAM | OMP_MAP_RETURN_PARAM +// CHECK-DAG: [[MAPTYPES1:@.+]] = private unnamed_addr constant [5 x i64] [i64 96, i64 96, i64 96, i64 96, i64 96] +// 32 = 0x20 = OMP_MAP_TARGET_PARAM +// 281474976710720 = 0x10040 = OMP_MAP_MEMBER_OF | OMP_MAP_RETURN_PARAM +// CHECK-DAG: [[MAPTYPES2:@.+]] = private unnamed_addr constant [5 x i64] [i64 32, i64 281474976710720, i64 281474976710720, i64 281474976710720, i64 281474976710720] +struct S { + int a = 0; + int *ptr = + int = a; + int arr[4]; + S() {} + void foo() { +#pragma omp target data use_device_addr(a, ptr [3:4], ref, ptr[0], arr[:a]) +++a, ++*ptr, ++ref, ++arr[0]; + } +}; + +int main() { + float a = 0; + float *ptr = + float = a; + float arr[4]; + float vla[(int)a]; + S s; + s.foo(); +#pragma omp target data use_device_addr(a, ptr [3:4], ref, ptr[0], arr[:(int)a], vla[0]) + ++a, ++*ptr, ++ref, ++arr[0], ++vla[0]; + return a; +} + +// CHECK-LABEL: @main() +// CHECK: [[A_ADDR:%.+]] = alloca float, +// CHECK: [[PTR_ADDR:%.+]] = alloca float*, +// CHECK: [[REF_ADDR:%.+]] = alloca float*, +// CHECK: [[ARR_ADDR:%.+]] = alloca [4 x float], +// CHECK: [[BPTRS:%.+]] = alloca [5 x i8*], +// CHECK: [[PTRS:%.+]] = alloca [5 x i8*], +// CHECK: [[VLA_ADDR:%.+]] = alloca float, i64 %{{.+}}, +// CHECK: [[PTR:%.+]] = load float*, float** [[PTR_ADDR]], +// CHECK: [[REF:%.+]] = load float*, float** [[REF_ADDR]], +// CHECK: [[ARR:%.+]] = getelementptr inbounds [4 x float], [4 x float]* [[ARR_ADDR]], i64 0, i64 0 +// CHECK: [[BPTR0:%.+]] = getelementptr inbounds [5 x i8*], [5 x i8*]* [[BPTRS]], i32 0, i32 0 +// CHECK: [[BPTR0_A_ADDR:%.+]] = bitcast i8** [[BPTR0]] to float** +// CHECK: store float* [[A_ADDR]], float** [[BPTR0_A_ADDR]], +// CHECK: [[PTR0:%.+]] = getelementptr inbounds [5 x i8*], [5 x i8*]* [[PTRS]], i32 0, i32 0 +// CHECK: [[PTR0_A_ADDR:%.+]] = bitcast i8** [[PTR0]] to float** +// CHECK: store float* [[A_ADDR]], float** [[PTR0_A_ADDR]], +// CHECK: [[BPTR1:%.+]] = getelementptr inbounds [5 x i8*], [5 x i8*]* [[BPTRS]], i32 0, i32 1 +// CHECK: [[BPTR1_PTR_ADDR:%.+]] = bitcast i8** [[BPTR1]] to float** +// CHECK: store float* [[PTR]], float** [[BPTR1_PTR_ADDR]], +// CHECK: [[PTR1:%.+]] = getelementptr inbounds [5 x i8*], [5 x i8*]* [[PTRS]], i32 0, i32 1 +// CHECK: [[PTR1_PTR_ADDR:%.+]] = bitcast i8** [[PTR1]] to float** +// CHECK: store float* [[PTR]], float** [[PTR1_PTR_ADDR]], +// CHECK: [[BPTR2:%.+]] = getelementptr inbounds [5 x i8*], [5 x i8*]* [[BPTRS]], i32 0, i32 2 +// CHECK: [[BPTR2_REF_ADDR:%.+]] = bitcast i8** [[BPTR2]] to float** +// CHECK: store float* [[REF]], float** [[BPTR2_REF_ADDR]], +// CHECK: [[PTR2:%.+]] = getelementptr inbounds [5 x i8*], [5 x i8*]* [[PTRS]], i32 0, i32 2 +// CHECK: [[PTR2_REF_ADDR:%.+]] = bitcast i8** [[PTR2]] to float** +// CHECK: store float* [[REF]], float** [[PTR2_REF_ADDR]], +// CHECK: [[BPTR3:%.+]] = getelementptr inbounds
[PATCH] D80730: [OPENMP50]Codegen for use_device_addr clauses.
jdoerfert added a subscriber: RaviNarayanaswamy. jdoerfert added a comment. I was hoping @dreachem and maybe @RaviNarayanaswamy would look at this. Comment at: clang/lib/CodeGen/CGOpenMPRuntime.cpp:7630 +// OMPC_MAP_MODIFIER_last is used to identify data members used in +// used_device_adddr clause. +bool IsMemberPointerOrAddr = jdoerfert wrote: > I'm not a fan of this implicit encoding. Can't we add a new map type or > modifier? Better, thanks. The comment change is probably not needed anymore. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D80730/new/ https://reviews.llvm.org/D80730 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D80730: [OPENMP50]Codegen for use_device_addr clauses.
ABataev updated this revision to Diff 268299. ABataev added a comment. Rebase + fixes Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D80730/new/ https://reviews.llvm.org/D80730 Files: clang/lib/AST/OpenMPClause.cpp clang/lib/CodeGen/CGOpenMPRuntime.cpp clang/lib/CodeGen/CGStmtOpenMP.cpp clang/lib/CodeGen/CodeGenFunction.h clang/lib/Sema/SemaOpenMP.cpp clang/test/OpenMP/target_data_use_device_addr_codegen.cpp Index: clang/test/OpenMP/target_data_use_device_addr_codegen.cpp === --- /dev/null +++ clang/test/OpenMP/target_data_use_device_addr_codegen.cpp @@ -0,0 +1,224 @@ +// RUN: %clang_cc1 -DCK1 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s +// RUN: %clang_cc1 -DCK1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s + +// RUN: %clang_cc1 -DCK1 -verify -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY0 %s +// RUN: %clang_cc1 -DCK1 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY0 %s +// SIMD-ONLY0-NOT: {{__kmpc|__tgt}} +// expected-no-diagnostics + +#ifndef HEADER +#define HEADER + +// CHECK-DAG: [[SIZES1:@.+]] = private unnamed_addr constant [5 x i64] zeroinitializer +// 96 = 0x60 = OMP_MAP_TARGET_PARAM | OMP_MAP_RETURN_PARAM +// CHECK-DAG: [[MAPTYPES1:@.+]] = private unnamed_addr constant [5 x i64] [i64 96, i64 96, i64 96, i64 96, i64 96] +// 32 = 0x20 = OMP_MAP_TARGET_PARAM +// 281474976710720 = 0x10040 = OMP_MAP_MEMBER_OF | OMP_MAP_RETURN_PARAM +// CHECK-DAG: [[MAPTYPES2:@.+]] = private unnamed_addr constant [5 x i64] [i64 32, i64 281474976710720, i64 281474976710720, i64 281474976710720, i64 281474976710720] +struct S { + int a = 0; + int *ptr = + int = a; + int arr[4]; + S() {} + void foo() { +#pragma omp target data use_device_addr(a, ptr [3:4], ref, ptr[0], arr[:a]) +++a, ++*ptr, ++ref, ++arr[0]; + } +}; + +int main() { + float a = 0; + float *ptr = + float = a; + float arr[4]; + float vla[(int)a]; + S s; + s.foo(); +#pragma omp target data use_device_addr(a, ptr [3:4], ref, ptr[0], arr[:(int)a], vla[0]) + ++a, ++*ptr, ++ref, ++arr[0], ++vla[0]; + return a; +} + +// CHECK-LABEL: @main() +// CHECK: [[A_ADDR:%.+]] = alloca float, +// CHECK: [[PTR_ADDR:%.+]] = alloca float*, +// CHECK: [[REF_ADDR:%.+]] = alloca float*, +// CHECK: [[ARR_ADDR:%.+]] = alloca [4 x float], +// CHECK: [[BPTRS:%.+]] = alloca [5 x i8*], +// CHECK: [[PTRS:%.+]] = alloca [5 x i8*], +// CHECK: [[VLA_ADDR:%.+]] = alloca float, i64 %{{.+}}, +// CHECK: [[PTR:%.+]] = load float*, float** [[PTR_ADDR]], +// CHECK: [[REF:%.+]] = load float*, float** [[REF_ADDR]], +// CHECK: [[ARR:%.+]] = getelementptr inbounds [4 x float], [4 x float]* [[ARR_ADDR]], i64 0, i64 0 +// CHECK: [[BPTR0:%.+]] = getelementptr inbounds [5 x i8*], [5 x i8*]* [[BPTRS]], i32 0, i32 0 +// CHECK: [[BPTR0_A_ADDR:%.+]] = bitcast i8** [[BPTR0]] to float** +// CHECK: store float* [[A_ADDR]], float** [[BPTR0_A_ADDR]], +// CHECK: [[PTR0:%.+]] = getelementptr inbounds [5 x i8*], [5 x i8*]* [[PTRS]], i32 0, i32 0 +// CHECK: [[PTR0_A_ADDR:%.+]] = bitcast i8** [[PTR0]] to float** +// CHECK: store float* [[A_ADDR]], float** [[PTR0_A_ADDR]], +// CHECK: [[BPTR1:%.+]] = getelementptr inbounds [5 x i8*], [5 x i8*]* [[BPTRS]], i32 0, i32 1 +// CHECK: [[BPTR1_PTR_ADDR:%.+]] = bitcast i8** [[BPTR1]] to float** +// CHECK: store float* [[PTR]], float** [[BPTR1_PTR_ADDR]], +// CHECK: [[PTR1:%.+]] = getelementptr inbounds [5 x i8*], [5 x i8*]* [[PTRS]], i32 0, i32 1 +// CHECK: [[PTR1_PTR_ADDR:%.+]] = bitcast i8** [[PTR1]] to float** +// CHECK: store float* [[PTR]], float** [[PTR1_PTR_ADDR]], +// CHECK: [[BPTR2:%.+]] = getelementptr inbounds [5 x i8*], [5 x i8*]* [[BPTRS]], i32 0, i32 2 +// CHECK: [[BPTR2_REF_ADDR:%.+]] = bitcast i8** [[BPTR2]] to float** +// CHECK: store float* [[REF]], float** [[BPTR2_REF_ADDR]], +// CHECK: [[PTR2:%.+]] = getelementptr inbounds [5 x i8*], [5 x i8*]* [[PTRS]], i32 0, i32 2 +// CHECK: [[PTR2_REF_ADDR:%.+]] = bitcast i8** [[PTR2]] to float** +// CHECK: store float* [[REF]], float** [[PTR2_REF_ADDR]], +// CHECK: [[BPTR3:%.+]] = getelementptr inbounds
[PATCH] D80730: [OPENMP50]Codegen for use_device_addr clauses.
jdoerfert added reviewers: kkwli0, dreachem. jdoerfert added inline comments. Comment at: clang/lib/CodeGen/CGOpenMPRuntime.cpp:7630 +// OMPC_MAP_MODIFIER_last is used to identify data members used in +// used_device_adddr clause. +bool IsMemberPointerOrAddr = I'm not a fan of this implicit encoding. Can't we add a new map type or modifier? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D80730/new/ https://reviews.llvm.org/D80730 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D80730: [OPENMP50]Codegen for use_device_addr clauses.
ABataev updated this revision to Diff 268219. ABataev added a comment. Rebase Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D80730/new/ https://reviews.llvm.org/D80730 Files: clang/lib/AST/OpenMPClause.cpp clang/lib/CodeGen/CGOpenMPRuntime.cpp clang/lib/CodeGen/CGStmtOpenMP.cpp clang/lib/CodeGen/CodeGenFunction.h clang/lib/Sema/SemaOpenMP.cpp clang/test/OpenMP/target_data_use_device_addr_codegen.cpp Index: clang/test/OpenMP/target_data_use_device_addr_codegen.cpp === --- /dev/null +++ clang/test/OpenMP/target_data_use_device_addr_codegen.cpp @@ -0,0 +1,224 @@ +// RUN: %clang_cc1 -DCK1 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s +// RUN: %clang_cc1 -DCK1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s + +// RUN: %clang_cc1 -DCK1 -verify -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY0 %s +// RUN: %clang_cc1 -DCK1 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY0 %s +// SIMD-ONLY0-NOT: {{__kmpc|__tgt}} +// expected-no-diagnostics + +#ifndef HEADER +#define HEADER + +// CHECK-DAG: [[SIZES1:@.+]] = private unnamed_addr constant [5 x i64] zeroinitializer +// 96 = 0x60 = OMP_MAP_TARGET_PARAM | OMP_MAP_RETURN_PARAM +// CHECK-DAG: [[MAPTYPES1:@.+]] = private unnamed_addr constant [5 x i64] [i64 96, i64 96, i64 96, i64 96, i64 96] +// 32 = 0x20 = OMP_MAP_TARGET_PARAM +// 281474976710720 = 0x10040 = OMP_MAP_MEMBER_OF | OMP_MAP_RETURN_PARAM +// CHECK-DAG: [[MAPTYPES2:@.+]] = private unnamed_addr constant [5 x i64] [i64 32, i64 281474976710720, i64 281474976710720, i64 281474976710720, i64 281474976710720] +struct S { + int a = 0; + int *ptr= + int = a; + int arr[4]; + S() {} + void foo() { +#pragma omp target data use_device_addr(a, ptr[3:4], ref, ptr[0], arr[:a]) + ++a, ++*ptr, ++ref, ++arr[0]; + } +}; + +int main() { + float a = 0; + float *ptr= + float = a; + float arr[4]; + float vla[(int)a]; + S s; + s.foo(); +#pragma omp target data use_device_addr(a, ptr[3:4], ref, ptr[0], arr[:(int)a], vla[0]) + ++a, ++*ptr, ++ref, ++arr[0], ++vla[0]; + return a; +} + +// CHECK-LABEL: @main() +// CHECK: [[A_ADDR:%.+]] = alloca float, +// CHECK: [[PTR_ADDR:%.+]] = alloca float*, +// CHECK: [[REF_ADDR:%.+]] = alloca float*, +// CHECK: [[ARR_ADDR:%.+]] = alloca [4 x float], +// CHECK: [[BPTRS:%.+]] = alloca [5 x i8*], +// CHECK: [[PTRS:%.+]] = alloca [5 x i8*], +// CHECK: [[VLA_ADDR:%.+]] = alloca float, i64 %{{.+}}, +// CHECK: [[PTR:%.+]] = load float*, float** [[PTR_ADDR]], +// CHECK: [[REF:%.+]] = load float*, float** [[REF_ADDR]], +// CHECK: [[ARR:%.+]] = getelementptr inbounds [4 x float], [4 x float]* [[ARR_ADDR]], i64 0, i64 0 +// CHECK: [[BPTR0:%.+]] = getelementptr inbounds [5 x i8*], [5 x i8*]* [[BPTRS]], i32 0, i32 0 +// CHECK: [[BPTR0_A_ADDR:%.+]] = bitcast i8** [[BPTR0]] to float** +// CHECK: store float* [[A_ADDR]], float** [[BPTR0_A_ADDR]], +// CHECK: [[PTR0:%.+]] = getelementptr inbounds [5 x i8*], [5 x i8*]* [[PTRS]], i32 0, i32 0 +// CHECK: [[PTR0_A_ADDR:%.+]] = bitcast i8** [[PTR0]] to float** +// CHECK: store float* [[A_ADDR]], float** [[PTR0_A_ADDR]], +// CHECK: [[BPTR1:%.+]] = getelementptr inbounds [5 x i8*], [5 x i8*]* [[BPTRS]], i32 0, i32 1 +// CHECK: [[BPTR1_PTR_ADDR:%.+]] = bitcast i8** [[BPTR1]] to float** +// CHECK: store float* [[PTR]], float** [[BPTR1_PTR_ADDR]], +// CHECK: [[PTR1:%.+]] = getelementptr inbounds [5 x i8*], [5 x i8*]* [[PTRS]], i32 0, i32 1 +// CHECK: [[PTR1_PTR_ADDR:%.+]] = bitcast i8** [[PTR1]] to float** +// CHECK: store float* [[PTR]], float** [[PTR1_PTR_ADDR]], +// CHECK: [[BPTR2:%.+]] = getelementptr inbounds [5 x i8*], [5 x i8*]* [[BPTRS]], i32 0, i32 2 +// CHECK: [[BPTR2_REF_ADDR:%.+]] = bitcast i8** [[BPTR2]] to float** +// CHECK: store float* [[REF]], float** [[BPTR2_REF_ADDR]], +// CHECK: [[PTR2:%.+]] = getelementptr inbounds [5 x i8*], [5 x i8*]* [[PTRS]], i32 0, i32 2 +// CHECK: [[PTR2_REF_ADDR:%.+]] = bitcast i8** [[PTR2]] to float** +// CHECK: store float* [[REF]], float** [[PTR2_REF_ADDR]], +// CHECK: [[BPTR3:%.+]] = getelementptr inbounds [5 x i8*], [5 x
[PATCH] D80730: [OPENMP50]Codegen for use_device_addr clauses.
ABataev created this revision. ABataev added a reviewer: jdoerfert. Herald added subscribers: sstefan1, guansong, yaxunl. Herald added a project: clang. Added codegen for use_device_addr clause. The components of the list items are mapped as a kind of RETURN components and then the returned base address is used instead of the real address of the base declaration used in the use_device_addr expressions. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D80730 Files: clang/lib/AST/OpenMPClause.cpp clang/lib/CodeGen/CGOpenMPRuntime.cpp clang/lib/CodeGen/CGStmtOpenMP.cpp clang/lib/CodeGen/CodeGenFunction.h clang/lib/Sema/SemaOpenMP.cpp clang/test/OpenMP/target_data_use_device_addr_codegen.cpp Index: clang/test/OpenMP/target_data_use_device_addr_codegen.cpp === --- /dev/null +++ clang/test/OpenMP/target_data_use_device_addr_codegen.cpp @@ -0,0 +1,224 @@ +// RUN: %clang_cc1 -DCK1 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s +// RUN: %clang_cc1 -DCK1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s + +// RUN: %clang_cc1 -DCK1 -verify -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY0 %s +// RUN: %clang_cc1 -DCK1 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY0 %s +// SIMD-ONLY0-NOT: {{__kmpc|__tgt}} +// expected-no-diagnostics + +#ifndef HEADER +#define HEADER + +// CHECK-DAG: [[SIZES1:@.+]] = private unnamed_addr constant [5 x i64] zeroinitializer +// 96 = 0x60 = OMP_MAP_TARGET_PARAM | OMP_MAP_RETURN_PARAM +// CHECK-DAG: [[MAPTYPES1:@.+]] = private unnamed_addr constant [5 x i64] [i64 96, i64 96, i64 96, i64 96, i64 96] +// 32 = 0x20 = OMP_MAP_TARGET_PARAM +// 281474976710720 = 0x10040 = OMP_MAP_MEMBER_OF | OMP_MAP_RETURN_PARAM +// CHECK-DAG: [[MAPTYPES2:@.+]] = private unnamed_addr constant [5 x i64] [i64 32, i64 281474976710720, i64 281474976710720, i64 281474976710720, i64 281474976710720] +struct S { + int a = 0; + int *ptr= + int = a; + int arr[4]; + S() {} + void foo() { +#pragma omp target data use_device_addr(a, ptr[3:4], ref, ptr[0], arr[:a]) + ++a, ++*ptr, ++ref, ++arr[0]; + } +}; + +int main() { + float a = 0; + float *ptr= + float = a; + float arr[4]; + float vla[(int)a]; + S s; + s.foo(); +#pragma omp target data use_device_addr(a, ptr[3:4], ref, ptr[0], arr[:(int)a], vla[0]) + ++a, ++*ptr, ++ref, ++arr[0], ++vla[0]; + return a; +} + +// CHECK-LABEL: @main() +// CHECK: [[A_ADDR:%.+]] = alloca float, +// CHECK: [[PTR_ADDR:%.+]] = alloca float*, +// CHECK: [[REF_ADDR:%.+]] = alloca float*, +// CHECK: [[ARR_ADDR:%.+]] = alloca [4 x float], +// CHECK: [[BPTRS:%.+]] = alloca [5 x i8*], +// CHECK: [[PTRS:%.+]] = alloca [5 x i8*], +// CHECK: [[VLA_ADDR:%.+]] = alloca float, i64 %{{.+}}, +// CHECK: [[PTR:%.+]] = load float*, float** [[PTR_ADDR]], +// CHECK: [[REF:%.+]] = load float*, float** [[REF_ADDR]], +// CHECK: [[ARR:%.+]] = getelementptr inbounds [4 x float], [4 x float]* [[ARR_ADDR]], i64 0, i64 0 +// CHECK: [[BPTR0:%.+]] = getelementptr inbounds [5 x i8*], [5 x i8*]* [[BPTRS]], i32 0, i32 0 +// CHECK: [[BPTR0_A_ADDR:%.+]] = bitcast i8** [[BPTR0]] to float** +// CHECK: store float* [[A_ADDR]], float** [[BPTR0_A_ADDR]], +// CHECK: [[PTR0:%.+]] = getelementptr inbounds [5 x i8*], [5 x i8*]* [[PTRS]], i32 0, i32 0 +// CHECK: [[PTR0_A_ADDR:%.+]] = bitcast i8** [[PTR0]] to float** +// CHECK: store float* [[A_ADDR]], float** [[PTR0_A_ADDR]], +// CHECK: [[BPTR1:%.+]] = getelementptr inbounds [5 x i8*], [5 x i8*]* [[BPTRS]], i32 0, i32 1 +// CHECK: [[BPTR1_PTR_ADDR:%.+]] = bitcast i8** [[BPTR1]] to float** +// CHECK: store float* [[PTR]], float** [[BPTR1_PTR_ADDR]], +// CHECK: [[PTR1:%.+]] = getelementptr inbounds [5 x i8*], [5 x i8*]* [[PTRS]], i32 0, i32 1 +// CHECK: [[PTR1_PTR_ADDR:%.+]] = bitcast i8** [[PTR1]] to float** +// CHECK: store float* [[PTR]], float** [[PTR1_PTR_ADDR]], +// CHECK: [[BPTR2:%.+]] = getelementptr inbounds [5 x i8*], [5 x i8*]* [[BPTRS]], i32 0, i32 2 +// CHECK: [[BPTR2_REF_ADDR:%.+]] = bitcast i8** [[BPTR2]] to float** +// CHECK: store float* [[REF]], float** [[BPTR2_REF_ADDR]], +// CHECK: [[PTR2:%.+]] =