Files
llvm-project/offload/test/offloading/target_critical_region.cpp
Alex Duran 5e7e097888 [offload] Enable Intel GPU tests and mark CUDA tests unsupported (#194790)
- Remove UNSUPPORTED: intelgpu from 12 passing tests:
  * mapping/data_member_ref.cpp
  * offloading/bug50022.cpp, info.c
* offloading/target_critical_region.cpp, target_depend_nowait.cpp,
target_nowait_target.cpp
  * offloading/strided_update/* (6 tests)
  * unified_shared_memory/close_member.c

- Change CUDA tests from XFAIL to UNSUPPORTED for Intel GPU:
  * offloading/CUDA/basic_launch.cu
  * offloading/CUDA/basic_launch_blocks_and_threads.cu
  * offloading/CUDA/basic_launch_multi_arg.cu
  * offloading/CUDA/launch_tu.cu

- Add Intel GPU configuration section to lit.cfg to disable USM tests by
default
2026-04-29 15:14:20 +02:00

37 lines
800 B
C++

// RUN: %libomptarget-compilexx-run-and-check-generic
// REQUIRES: gpu
// UNSUPPORTED: nvptx64-nvidia-cuda
// UNSUPPORTED: nvptx64-nvidia-cuda-LTO
// UNSUPPORTED: amdgcn-amd-amdhsa
#include <omp.h>
#include <stdio.h>
#define N 1000000
int A[N];
int main() {
for (int i = 0; i < N; i++)
A[i] = 1;
int sum[1];
sum[0] = 0;
#pragma omp target teams distribute parallel for num_teams(256) \
schedule(static, 1) map(to \
: A[:N]) map(tofrom \
: sum[:1])
{
for (int i = 0; i < N; i++) {
#pragma omp critical
{ sum[0] += A[i]; }
}
}
// CHECK: SUM = 1000000
printf("SUM = %d\n", sum[0]);
return 0;
}