Debian Codegraph @

clang/test/OpenMP/target_num_teams_num_threads_attributes.cpp

raw
1 // RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple x86_64-unknown-unknown -fopenmp-targets=amdgcn-amd-amdhsa -emit-llvm-bc %s -o %t-ppc-host.bc
2 // RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple amdgcn-amd-amdhsa -fopenmp-targets=amdgcn-amd-amdhsa -emit-llvm %s -fopenmp-is-target-device -fopenmp-host-ir-file-path %t-ppc-host.bc -o - | FileCheck %s
3 // RUN: %clang_cc1 -target-cpu gfx900 -fopenmp -x c++ -std=c++11 -triple amdgcn-amd-amdhsa -fopenmp-targets=amdgcn-amd-amdhsa -emit-llvm %s -fopenmp-is-target-device -fopenmp-host-ir-file-path %t-ppc-host.bc -o - | FileCheck %s
4 // RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple x86_64-unknown-unknown -fopenmp-targets=nvptx64 -emit-llvm-bc %s -o %t-ppc-host.bc
5 // RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple nvptx64 -fopenmp-targets=nvptx64 -emit-llvm %s -fopenmp-is-target-device -fopenmp-host-ir-file-path %t-ppc-host.bc -o - | FileCheck %s
6 // RUN: %clang_cc1 -target-cpu sm_80 -fopenmp -x c++ -std=c++11 -triple nvptx64 -fopenmp-targets=nvptx64 -emit-llvm %s -fopenmp-is-target-device -fopenmp-host-ir-file-path %t-ppc-host.bc -o - | FileCheck %s
7
8 // expected-no-diagnostics
9
10
11 #ifndef HEADER
12 #define HEADER
13
14
15 void default_val_num_teams() {
16 #pragma omp target simd
17 for (int i = 0; i < 22; i++)
18 int a_var;
19 }
20
21 void foo1() {
22 #pragma omp target teams num_teams(22)
23 { int a_var; }
24 }
25
26 void foo2() {
27 #pragma omp target teams distribute num_teams(22)
28 for (int i = 0; i < 22; i++)
29 int a_var;
30 }
31
32 void foo3() {
33 #pragma omp target teams distribute parallel for num_teams(22)
34 for (int i = 0; i < 22; i++)
35 int a_var;
36 }
37
38 void bar1() {
39 #pragma omp target teams num_teams(22)
40 { int a_var; }
41 }
42
43 void bar2() {
44 #pragma omp target teams distribute num_teams(33)
45 for (int i = 0; i < 22; i++)
46 int a_var;
47 }
48
49 void bar3() {
50 #pragma omp target teams distribute parallel for num_teams(44)
51 for (int i = 0; i < 22; i++)
52 int a_var;
53 }
54
55 void const_int() {
56 const int NT = 22;
57 #pragma omp target teams num_teams(NT)
58 { int a_var; }
59 }
60
61 void thread_limit() {
62 #pragma omp target teams thread_limit(22)
63 { int a_var; }
64 }
65
66 void num_threads() {
67 #pragma omp target teams distribute parallel for thread_limit(22) num_threads(11)
68 for (int i = 0; i < 22; i++)
69 int a_var;
70 }
71
72 void threads_and_teams() {
73 #pragma omp target teams distribute parallel for thread_limit(22) num_teams(33)
74 for (int i = 0; i < 22; i++)
75 int a_var;
76 }
77
78 #endif
79
80
81 // CHECK: "omp_target_num_teams"="1"
82 // CHECK: "omp_target_num_teams"="22"
83 // CHECK: "omp_target_num_teams"="33"
84 // CHECK: "omp_target_num_teams"="44"
85
86 // CHECK: "omp_target_thread_limit"="22"
87
88 // CHECK: "omp_target_thread_limit"="11"
89
90 // CHECK: "omp_target_num_teams"="33"
91 // CHECK-SAME: "omp_target_thread_limit"="22"