Files
fineg74 1611a23a5b [OFFLOAD] Add spirv implementation for named barrier (#180393)
This change adds implementation for named barriers for SPIRV backend.
Since there is no built in API/intrinsics for named barrier in SPIRV,
the implementation loosely follows implementation for AMD
2026-03-27 20:14:09 +01:00

28 lines
591 B
C

// RUN: %libomptarget-compile-generic -O2 && %libomptarget-run-generic
// -O2 to run openmp-opt
// RUN: %libomptarget-compileopt-generic -O2 && %libomptarget-run-generic
// https://github.com/llvm/llvm-project/issues/182119
// UNSUPPORTED: intelgpu
int main(void) {
long int aa = 0;
int ng = 12;
int nxyz = 5;
const long exp = ng * nxyz;
#pragma omp target map(tofrom : aa)
for (int gid = 0; gid < nxyz; gid++) {
#pragma omp parallel for
for (unsigned int g = 0; g < ng; g++) {
#pragma omp atomic
aa += 1;
}
}
if (aa != exp) {
return 1;
}
return 0;
}