1// clang-format off
2// RUN: %libomptarget-compile-generic
3// RUN: env LIBOMPTARGET_INFO=16 \
4// RUN: %libomptarget-run-generic 2>&1 | %fcheck-generic --check-prefix=DEFAULT
5
6// UNSUPPORTED: nvptx64-nvidia-cuda
7// UNSUPPORTED: nvptx64-nvidia-cuda-LTO
8// UNSUPPORTED: aarch64-unknown-linux-gnu
9// UNSUPPORTED: aarch64-unknown-linux-gnu-LTO
10// UNSUPPORTED: x86_64-pc-linux-gnu
11// UNSUPPORTED: x86_64-pc-linux-gnu-LTO
12// UNSUPPORTED: s390x-ibm-linux-gnu
13// UNSUPPORTED: s390x-ibm-linux-gnu-LTO
14
15int main() {
16 int n = 1 << 20;
17 int th = 12;
18 int te = n / th;
19// DEFAULT: 12 (MaxFlatWorkGroupSize:
20#pragma omp target
21#pragma omp teams loop num_teams(te), thread_limit(th)
22 for (int i = 0; i < n; i++) {
23 }
24
25// DEFAULT: 13 (MaxFlatWorkGroupSize:
26 #pragma omp target
27 #pragma omp teams distribute parallel for simd num_teams(te), thread_limit(th+1) simdlen(64)
28 for(int i = 0; i < n; i++) {
29 }
30 return 0;
31}
32

source code of offload/test/offloading/thread_limit.c