Skip to content

Commit d9450b7

Browse files
author
Raúl Peñacoba Veigas
committed
Introduce OMPSS2_RUNTIME env var to select the OmpSs-2 runtime. See more
The priority comparing it with clang cmake option and -fompss-2= option is as follows (more priority) -fompss-2= > OMPSS2_RUNTIME > CLANG_DEFAULT_OMPSS2_RUNTIME (less priority) Closes llvm#184
1 parent 8ecaac6 commit d9450b7

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

clang/lib/Driver/Driver.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -777,6 +777,11 @@ Driver::OpenMPRuntimeKind Driver::getOpenMPRuntime(const ArgList &Args) const {
777777
Driver::OmpSsRuntimeKind Driver::getOmpSsRuntime(const ArgList &Args) const {
778778
StringRef RuntimeName(CLANG_DEFAULT_OMPSS2_RUNTIME);
779779

780+
std::optional<std::string> OMPSS2Runtime =
781+
llvm::sys::Process::GetEnv("OMPSS2_RUNTIME");
782+
if (OMPSS2Runtime && !OMPSS2Runtime->empty())
783+
RuntimeName = OMPSS2Runtime.value();
784+
780785
const Arg *A = Args.getLastArg(options::OPT_fompss_EQ);
781786
if (A)
782787
RuntimeName = A->getValue();
@@ -790,6 +795,9 @@ Driver::OmpSsRuntimeKind Driver::getOmpSsRuntime(const ArgList &Args) const {
790795
if (A)
791796
Diag(diag::err_drv_unsupported_option_argument)
792797
<< A->getSpelling() << A->getValue();
798+
else if (OMPSS2Runtime && !OMPSS2Runtime->empty())
799+
Diag(diag::err_drv_unsupported_option_argument)
800+
<< "-fompss-2=" << OMPSS2Runtime.value();
793801
else
794802
// FIXME: We could use a nicer diagnostic here.
795803
Diag(diag::err_drv_unsupported_opt) << "-fompss-2";

clang/test/OmpSs/Driver/runtime.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,25 @@
1616
// CHECK2: clang: error: unsupported argument 'libasdf' to option '-fompss-2='
1717
// CHECK3: clang: error: unsupported argument 'libasdf' to option '-fompss-2='
1818
// CHECK3: clang: error: unsupported argument 'libasdf' to option '-fompss-2='
19+
20+
// OMPSS2_RUNTIME priority check
21+
22+
// CompileJob
23+
// RUN: OMPSS2_RUNTIME=libkaka %clang -fompss-2 %s -c -### 2>&1 | FileCheck %s --check-prefix=CHECK4
24+
// RUN: OMPSS2_RUNTIME=libkaka %clang -fompss-2=libasdf %s -c -### 2>&1 | FileCheck %s --check-prefix=CHECK5
25+
// LinkJob
26+
// RUN: touch %t.o
27+
// RUN: OMPSS2_RUNTIME=libkaka %clang -fompss-2 %t.o -### 2>&1 | FileCheck %s --check-prefix=CHECK6
28+
// RUN: OMPSS2_RUNTIME=libkaka %clang -fompss-2=libasdf %t.o -### 2>&1 | FileCheck %s --check-prefix=CHECK7
29+
// CompileAndLinkJob
30+
// RUN: OMPSS2_RUNTIME=libkaka %clang -fompss-2 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK8
31+
// RUN: OMPSS2_RUNTIME=libkaka %clang -fompss-2=libasdf %s -### 2>&1 | FileCheck %s --check-prefix=CHECK9
32+
33+
// CHECK4: clang: error: unsupported argument 'libkaka' to option '-fompss-2='
34+
// CHECK5: clang: error: unsupported argument 'libasdf' to option '-fompss-2='
35+
// CHECK6: clang: error: unsupported argument 'libkaka' to option '-fompss-2='
36+
// CHECK7: clang: error: unsupported argument 'libasdf' to option '-fompss-2='
37+
// CHECK8: clang: error: unsupported argument 'libkaka' to option '-fompss-2='
38+
// CHECK8: clang: error: unsupported argument 'libkaka' to option '-fompss-2='
39+
// CHECK9: clang: error: unsupported argument 'libasdf' to option '-fompss-2='
40+
// CHECK9: clang: error: unsupported argument 'libasdf' to option '-fompss-2='

0 commit comments

Comments
 (0)