[SLP]Propagate AssumptionCache where possible
[llvm-project.git] / offload / test / offloading / ompx_bare.c
blob6a6ada9617cf5bcf7503412f99278313317ef766
1 // RUN: %libomptarget-compile-generic
2 // RUN: env LIBOMPTARGET_INFO=63 %libomptarget-run-generic 2>&1 | \
3 // RUN: %fcheck-generic
4 //
5 // REQUIRES: gpu
7 #include <assert.h>
8 #include <ompx.h>
9 #include <stdio.h>
10 #include <stdlib.h>
12 int main(int argc, char *argv[]) {
13 const int num_blocks = 64;
14 const int block_size = 64;
15 const int N = num_blocks * block_size;
16 int *data = (int *)malloc(N * sizeof(int));
18 // CHECK: "PluginInterface" device 0 info: Launching kernel __omp_offloading_{{.*}} with [64,1,1] blocks and [64,1,1] threads in SPMD mode
20 #pragma omp target teams ompx_bare num_teams(num_blocks) thread_limit(block_size) map(from: data[0:N])
22 int bid = ompx_block_id_x();
23 int bdim = ompx_block_dim_x();
24 int tid = ompx_thread_id_x();
25 int idx = bid * bdim + tid;
26 data[idx] = idx;
29 for (int i = 0; i < N; ++i)
30 assert(data[i] == i);
32 // CHECK: PASS
33 printf("PASS\n");
35 return 0;