Skip to content

Commit 0d5b7dd

Browse files
authored
[OpenMP] Add a test for D158802 (#70678)
In D158802 we honored user's `thread_limit` value even with the optimization introduced in D152014. This patch adds a simple test.
1 parent 9e390a1 commit 0d5b7dd

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// clang-format off
2+
// RUN: %libomptarget-compilexx-generic
3+
// RUN: env LIBOMPTARGET_INFO=16 \
4+
// RUN: %libomptarget-run-generic 2>&1 | %fcheck-generic
5+
6+
// UNSUPPORTED: aarch64-unknown-linux-gnu
7+
// UNSUPPORTED: aarch64-unknown-linux-gnu-LTO
8+
// UNSUPPORTED: x86_64-pc-linux-gnu
9+
// UNSUPPORTED: x86_64-pc-linux-gnu-LTO
10+
11+
int main(int argc, char *argv[]) {
12+
constexpr const int block_size = 256;
13+
constexpr const int grid_size = 4;
14+
constexpr const int count = block_size * grid_size;
15+
16+
int *data = new int[count];
17+
18+
#pragma omp target teams distribute parallel for thread_limit(block_size) map(from: data[0:count])
19+
for (int i = 0; i < count; ++i)
20+
data[i] = i;
21+
22+
for (int i = 0; i < count; ++i)
23+
if (data[i] != i)
24+
return 1;
25+
26+
delete[] data;
27+
28+
return 0;
29+
}
30+
31+
// CHECK: Launching kernel {{.*}} with 4 blocks and 256 threads in SPMD mode

0 commit comments

Comments
 (0)