Files
clang-p2996/offload/test/offloading/small_trip_count_thread_limit.cpp
Ethan Luis McDonough 8823448807 [Offload] Refactor offload test requirements (#95196)
Many tests in the `offload` project have requirements defined by which
targets are not supported rather than which platforms are supported.
This patch aims to streamline the requirement definitions by adding four
new feature tags: `host`, `gpu`, `amdgpu`, and `nvidiagpu`.
2024-06-29 00:56:18 -05:00

29 lines
705 B
C++

// clang-format off
// RUN: %libomptarget-compilexx-generic
// RUN: env LIBOMPTARGET_INFO=16 \
// RUN: %libomptarget-run-generic 2>&1 | %fcheck-generic
// REQUIRES: gpu
int main(int argc, char *argv[]) {
constexpr const int block_size = 256;
constexpr const int grid_size = 4;
constexpr const int count = block_size * grid_size;
int *data = new int[count];
#pragma omp target teams distribute parallel for thread_limit(block_size) map(from: data[0:count])
for (int i = 0; i < count; ++i)
data[i] = i;
for (int i = 0; i < count; ++i)
if (data[i] != i)
return 1;
delete[] data;
return 0;
}
// CHECK: Launching kernel {{.*}} with 4 blocks and 256 threads in SPMD mode