-
Notifications
You must be signed in to change notification settings - Fork 11k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[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
- Loading branch information
Showing
2 changed files
with
22 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
openmp/libomptarget/test/offloading/global_constructor.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// RUN: %libomptarget-compilexx-generic && %libomptarget-run-generic | %fcheck-generic | ||
|
||
#include <cmath> | ||
#include <cstdio> | ||
|
||
const double Host = log(2.0) / log(2.0); | ||
#pragma omp declare target | ||
const double Device = log(2.0) / log(2.0); | ||
#pragma omp end declare target | ||
|
||
int main() { | ||
double X; | ||
#pragma omp target map(from : X) | ||
{ X = Device; } | ||
|
||
// CHECK: PASS | ||
if (X == Host) | ||
printf("PASS\n"); | ||
} |