llvm-project/offload/test/api/omp_dynamic_shared_memory_amdgpu.c
Joseph Huber dcc27ea41e
[LinkerWrapper] Always pass -flto if the linker supports it (#102972)
Summary;
Now that we use the linker to do LTO / device linking, we need to inform
the `clang` invocation to use `-flto` so it forwards arguments like
`-On` correctly.
2024-08-13 11:23:55 -05:00

27 lines
671 B
C

// RUN: %libomptarget-compile-amdgcn-amd-amdhsa -O2 -mllvm \
// RUN: -openmp-opt-inline-device
// RUN: env LIBOMPTARGET_SHARED_MEMORY_SIZE=256 \
// RUN: %libomptarget-run-amdgcn-amd-amdhsa | %fcheck-amdgcn-amd-amdhsa
// REQUIRES: amdgcn-amd-amdhsa
#include <omp.h>
#include <stdio.h>
int main() {
int x;
#pragma omp target parallel map(from : x)
{
int *buf = llvm_omp_target_dynamic_shared_alloc() + 252;
#pragma omp barrier
if (omp_get_thread_num() == 0)
*buf = 1;
#pragma omp barrier
if (omp_get_thread_num() == 1)
x = *buf;
}
// CHECK: PASS
if (x == 1 && llvm_omp_target_dynamic_shared_alloc() == NULL)
printf("PASS\n");
}