Skip to content

Commit edb8acd

Browse files
committed
[Libomptarget] Correctly default to Generic if exec_mode is not present
Currently, the runtime returns an error when the `exec_mode` global is not present. The expected behvaiour is that the region will default to Generic. This prevents global constructors from being called because they do not contain execution mode globals. Reviewed By: jdoerfert Differential Revision: https://reviews.llvm.org/D108255
1 parent 1ffbe8c commit edb8acd

File tree

2 files changed

+22
-4
lines changed

2 files changed

+22
-4
lines changed

openmp/libomptarget/plugins/cuda/src/rtl.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -829,10 +829,9 @@ class DeviceRTLTy {
829829
return nullptr;
830830
}
831831
} else {
832-
REPORT("Loading global exec_mode '%s' - symbol missing, using default "
833-
"value GENERIC (1)\n",
834-
ExecModeName);
835-
CUDA_ERR_STRING(Err);
832+
DP("Loading global exec_mode '%s' - symbol missing, using default "
833+
"value GENERIC (1)\n",
834+
ExecModeName);
836835
}
837836

838837
KernelsList.emplace_back(Func, ExecModeVal);
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// RUN: %libomptarget-compilexx-generic && %libomptarget-run-generic | %fcheck-generic
2+
3+
#include <cmath>
4+
#include <cstdio>
5+
6+
const double Host = log(2.0) / log(2.0);
7+
#pragma omp declare target
8+
const double Device = log(2.0) / log(2.0);
9+
#pragma omp end declare target
10+
11+
int main() {
12+
double X;
13+
#pragma omp target map(from : X)
14+
{ X = Device; }
15+
16+
// CHECK: PASS
17+
if (X == Host)
18+
printf("PASS\n");
19+
}

0 commit comments

Comments
 (0)