In a nutshell, this moves our libomptarget code to populate the offload subproject. With this commit, users need to enable the new LLVM/Offload subproject as a runtime in their cmake configuration. No further changes are expected for downstream code. Tests and other components still depend on OpenMP and have also not been renamed. The results below are for a build in which OpenMP and Offload are enabled runtimes. In addition to the pure `git mv`, we needed to adjust some CMake files. Nothing is intended to change semantics. ``` ninja check-offload ``` Works with the X86 and AMDGPU offload tests ``` ninja check-openmp ``` Still works but doesn't build offload tests anymore. ``` ls install/lib ``` Shows all expected libraries, incl. - `libomptarget.devicertl.a` - `libomptarget-nvptx-sm_90.bc` - `libomptarget.rtl.amdgpu.so` -> `libomptarget.rtl.amdgpu.so.18git` - `libomptarget.so` -> `libomptarget.so.18git` Fixes: https://github.com/llvm/llvm-project/issues/75124 --------- Co-authored-by: Saiyedul Islam <Saiyedul.Islam@amd.com>
42 lines
1.1 KiB
C
42 lines
1.1 KiB
C
// RUN: %libomptarget-compile-generic
|
|
// RUN: env LIBOMPTARGET_INFO=63 %libomptarget-run-generic 2>&1 | \
|
|
// RUN: %fcheck-generic
|
|
//
|
|
// UNSUPPORTED: x86_64-pc-linux-gnu
|
|
// UNSUPPORTED: x86_64-pc-linux-gnu-LTO
|
|
// UNSUPPORTED: aarch64-unknown-linux-gnu
|
|
// UNSUPPORTED: aarch64-unknown-linux-gnu-LTO
|
|
// UNSUPPORTED: s390x-ibm-linux-gnu
|
|
// UNSUPPORTED: s390x-ibm-linux-gnu-LTO
|
|
|
|
#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: "PluginInterface" device 0 info: Launching kernel __omp_offloading_{{.*}} with 64 blocks and 64 threads in SPMD 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;
|
|
}
|