mirror of
https://github.com/clang-retro/llvm.git
synced 2026-11-28 13:19:18 -08:00
Move all computation related to strict threads and strict groups to libomptarget as it's specific to OpenMP. This also removes all refrences to ExecutionModes from the Plugin Interface. With this, the data from the OpenMP kernel environment being used is ReductionDataSize used to create the KLE, and maxNumThreads used by RecordReplay. They're are purposely left for a future PR. Assisted by Claude.
39 lines
956 B
C
39 lines
956 B
C
// RUN: %libomptarget-compile-generic
|
|
// RUN: env LIBOMPTARGET_INFO=63 %libomptarget-run-generic 2>&1 | \
|
|
// RUN: %fcheck-generic
|
|
//
|
|
// REQUIRES: gpu
|
|
|
|
#include <assert.h>
|
|
#include <ompx.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
|
|
int main(int argc, char *argv[]) {
|
|
const int num_blocks = 64;
|
|
const int block_size = 64;
|
|
const int N = num_blocks * block_size;
|
|
int *data = (int *)malloc(N * sizeof(int));
|
|
|
|
// CHECK: omptarget device 0 info: Launching kernel
|
|
// CHECK-SAME: __omp_offloading_{{.*}} with [64,1,1] blocks and [64,1,1]
|
|
// CHECK-SAME: threads in BARE mode
|
|
|
|
#pragma omp target teams ompx_bare num_teams(num_blocks) thread_limit(block_size) map(from: data[0:N])
|
|
{
|
|
int bid = ompx_block_id_x();
|
|
int bdim = ompx_block_dim_x();
|
|
int tid = ompx_thread_id_x();
|
|
int idx = bid * bdim + tid;
|
|
data[idx] = idx;
|
|
}
|
|
|
|
for (int i = 0; i < N; ++i)
|
|
assert(data[i] == i);
|
|
|
|
// CHECK: PASS
|
|
printf("PASS\n");
|
|
|
|
return 0;
|
|
}
|