[PATCH] D85934: Enable OpenMP offloading to VE and enable tests for offloading to VE

2020-08-25 Thread Manoel Roemmer via Phabricator via cfe-commits
manorom updated this revision to Diff 287660.
manorom edited the summary of this revision.
manorom added a comment.

- Move VE specific vars into test run line


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D85934/new/

https://reviews.llvm.org/D85934

Files:
  clang/lib/Frontend/CompilerInvocation.cpp
  openmp/libomptarget/CMakeLists.txt
  openmp/libomptarget/test/api/omp_get_num_devices.c
  openmp/libomptarget/test/api/omp_get_num_devices_with_empty_target.c
  openmp/libomptarget/test/env/omp_target_debug.c
  openmp/libomptarget/test/lit.cfg
  openmp/libomptarget/test/mapping/alloc_fail.c
  openmp/libomptarget/test/mapping/target_implicit_partial_map.c
  openmp/libomptarget/test/offloading/offloading_success.c

Index: openmp/libomptarget/test/offloading/offloading_success.c
===
--- openmp/libomptarget/test/offloading/offloading_success.c
+++ openmp/libomptarget/test/offloading/offloading_success.c
@@ -3,6 +3,7 @@
 // RUN: %libomptarget-compile-run-and-check-powerpc64le-ibm-linux-gnu
 // RUN: %libomptarget-compile-run-and-check-x86_64-pc-linux-gnu
 // RUN: %libomptarget-compile-run-and-check-nvptx64-nvidia-cuda
+// RUN: %libomptarget-compile-ve-unknown-linux-unknown | env VE_LD_LIBRARY_PATH=%host-rtl-dir %libomptarget-run-ve-unknown-linux-unknown | %fcheck-ve-unknown-linux-unknown
 
 #include 
 #include 
Index: openmp/libomptarget/test/mapping/target_implicit_partial_map.c
===
--- openmp/libomptarget/test/mapping/target_implicit_partial_map.c
+++ openmp/libomptarget/test/mapping/target_implicit_partial_map.c
@@ -13,6 +13,10 @@
 // RUN: %libomptarget-compile-x86_64-pc-linux-gnu
 // RUN: %libomptarget-run-x86_64-pc-linux-gnu 2>&1 \
 // RUN: | %fcheck-x86_64-pc-linux-gnu
+
+// RUN: %libomptarget-compile-ve-unknown-linux-unknown
+// RUN: env VE_LD_LIBRARY_PATH=%host-rtl-dir %libomptarget-run-ve-unknown-linux-unknown 2>&1 \
+// RUN: | %fcheck-ve-unknown-linux-unknown
 //
 // END.
 
Index: openmp/libomptarget/test/mapping/alloc_fail.c
===
--- openmp/libomptarget/test/mapping/alloc_fail.c
+++ openmp/libomptarget/test/mapping/alloc_fail.c
@@ -18,6 +18,10 @@
 // RUN: %libomptarget-run-fail-nvptx64-nvidia-cuda 2>&1 \
 // RUN: | %fcheck-nvptx64-nvidia-cuda
 
+// RUN: %libomptarget-compile-ve-unknown-linux-unknown
+// RUN: env VE_LD_LIBRARY_PATH=%host-rtl-dir %libomptarget-run-fail-ve-unknown-linux-unknown 2>&1 \
+// RUN: | %fcheck-ve-unknown-linux-unknown
+
 // CHECK: Libomptarget fatal error 1: failure of target construct while offloading is mandatory
 
 int main() {
Index: openmp/libomptarget/test/lit.cfg
===
--- openmp/libomptarget/test/lit.cfg
+++ openmp/libomptarget/test/lit.cfg
@@ -75,6 +75,11 @@
 append_dynamic_library_path('LIBRARY_PATH', \
 config.omp_host_rtl_directory, ":")
 
+# Target specific flags
+target_flags = {}
+target_flags['ve-unknown-linux-unknown'] = "-Xopenmp-target \"-L " + \
+config.omp_host_rtl_directory + "\""
+
 # substitutions
 # - for targets that exist in the system create the actual command.
 # - for valid targets that do not exist in the system, return false, so that the
@@ -116,9 +121,13 @@
 libomptarget_target, \
 "%not --crash %t-" + libomptarget_target))
 config.substitutions.append(("%clangxx-" + libomptarget_target, \
-"%clangxx %openmp_flags %flags -fopenmp-targets=" + libomptarget_target))
+"%clangxx %openmp_flags %flags-" + libomptarget_target + \
+" -fopenmp-targets=" + libomptarget_target))
 config.substitutions.append(("%clang-" + libomptarget_target, \
-"%clang %openmp_flags %flags -fopenmp-targets=" + libomptarget_target))
+"%clang %openmp_flags %flags-" + libomptarget_target + \
+" -fopenmp-targets=" + libomptarget_target))
+config.substitutions.append(("%flags-" + libomptarget_target, \
+"%flags " + target_flags.get(libomptarget_target, "")))
 config.substitutions.append(("%fcheck-" + libomptarget_target, \
 config.libomptarget_filecheck + " %s"))
 else:
@@ -157,4 +166,5 @@
 config.substitutions.append(("%clang", config.test_c_compiler))
 config.substitutions.append(("%openmp_flags", config.test_openmp_flags))
 config.substitutions.append(("%flags", config.test_flags))
+config.substitutions.append(("%host-rtl-dir", config.omp_host_rtl_directory))
 config.substitutions.append(("%not", config.libomptarget_not))
Index: openmp/libomptarget/test/env/omp_target_debug.c
===
--- openmp/libomptarget/test/env/omp_target_debug.c
+++ openmp/libomptarget/test/env/omp_target_debug.c
@@ -8,6 +8,8 @@
 // RUN: %libomptarget-compile-x86_64-pc-linux-gnu && 

[PATCH] D85934: Enable OpenMP offloading to VE and enable tests for offloading to VE

2020-08-16 Thread Joachim Protze via Phabricator via cfe-commits
protze.joachim added inline comments.



Comment at: openmp/libomptarget/test/lit.cfg:67
 append_dynamic_library_path('DYLD_LIBRARY_PATH', \
 config.omp_host_rtl_directory, ";")
 config.test_flags += " -Wl,-rpath," + config.library_dir

Unrelated to this patch, but why are different separators used for Darwin?



Comment at: openmp/libomptarget/test/lit.cfg:78-83
+if 've-unknown-linux-unknown' in config.libomptarget_system_targets and \
+config.omp_host_rtl_directory:
+config.test_flags = config.test_flags + " -Xopenmp-target \"-L" +\
+config.omp_host_rtl_directory + "\""
+append_dynamic_library_path('VE_LD_LIBRARY_PATH',
+config.omp_host_rtl_directory, ":")

I think, this should only be set for the specific device RUN-lines. I suggest 
to include the flags and export of the environment variable in the definition 
of `%libomptarget-compile-ve-unknown-linux-unknown`.



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D85934/new/

https://reviews.llvm.org/D85934

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D85934: Enable OpenMP offloading to VE and enable tests for offloading to VE

2020-08-13 Thread Manoel Roemmer via Phabricator via cfe-commits
manorom created this revision.
manorom added a reviewer: simoll.
Herald added subscribers: openmp-commits, cfe-commits, guansong, yaxunl, mgorny.
Herald added projects: clang, OpenMP.
manorom requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added a subscriber: sstefan1.

OpenMP offloading to VE requires a cross-compiled OpenMP runtime and 
compiler-rt.

The compiler-rt files need to be placed in the build directory to run the 
tests, but the OpenMP runtime can be placed elsewhere with the CMake variable 
LIBOMPTARGET_OPENMP_HOST_RTL_FOLDER pointing to it.
The patch uses this CMake variable to set the library search path and the 
runtime VE_LD_LIBRARY_PATH environment variable for VE tests.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D85934

Files:
  clang/lib/Frontend/CompilerInvocation.cpp
  openmp/libomptarget/CMakeLists.txt
  openmp/libomptarget/test/api/omp_get_num_devices.c
  openmp/libomptarget/test/api/omp_get_num_devices_with_empty_target.c
  openmp/libomptarget/test/env/omp_target_debug.c
  openmp/libomptarget/test/lit.cfg
  openmp/libomptarget/test/mapping/alloc_fail.c
  openmp/libomptarget/test/mapping/target_implicit_partial_map.c
  openmp/libomptarget/test/offloading/offloading_success.c

Index: openmp/libomptarget/test/offloading/offloading_success.c
===
--- openmp/libomptarget/test/offloading/offloading_success.c
+++ openmp/libomptarget/test/offloading/offloading_success.c
@@ -3,6 +3,7 @@
 // RUN: %libomptarget-compile-run-and-check-powerpc64le-ibm-linux-gnu
 // RUN: %libomptarget-compile-run-and-check-x86_64-pc-linux-gnu
 // RUN: %libomptarget-compile-run-and-check-nvptx64-nvidia-cuda
+// RUN: %libomptarget-compile-run-and-check-ve-unknown-linux-unknown
 
 #include 
 #include 
Index: openmp/libomptarget/test/mapping/target_implicit_partial_map.c
===
--- openmp/libomptarget/test/mapping/target_implicit_partial_map.c
+++ openmp/libomptarget/test/mapping/target_implicit_partial_map.c
@@ -13,6 +13,10 @@
 // RUN: %libomptarget-compile-x86_64-pc-linux-gnu
 // RUN: %libomptarget-run-x86_64-pc-linux-gnu 2>&1 \
 // RUN: | %fcheck-x86_64-pc-linux-gnu
+
+// RUN: %libomptarget-compile-ve-unknown-linux-unknown
+// RUN: %libomptarget-run-ve-unknown-linux-unknown 2>&1 \
+// RUN: | %fcheck-ve-unknown-linux-unknown
 //
 // END.
 
Index: openmp/libomptarget/test/mapping/alloc_fail.c
===
--- openmp/libomptarget/test/mapping/alloc_fail.c
+++ openmp/libomptarget/test/mapping/alloc_fail.c
@@ -18,6 +18,10 @@
 // RUN: %libomptarget-run-fail-nvptx64-nvidia-cuda 2>&1 \
 // RUN: | %fcheck-nvptx64-nvidia-cuda
 
+// RUN: %libomptarget-compile-ve-unknown-linux-unknown
+// RUN: %libomptarget-run-fail-ve-unknown-linux-unknown 2>&1 \
+// RUN: | %fcheck-ve-unknown-linux-unknown
+
 // CHECK: Libomptarget fatal error 1: failure of target construct while offloading is mandatory
 
 int main() {
Index: openmp/libomptarget/test/lit.cfg
===
--- openmp/libomptarget/test/lit.cfg
+++ openmp/libomptarget/test/lit.cfg
@@ -75,6 +75,13 @@
 append_dynamic_library_path('LIBRARY_PATH', \
 config.omp_host_rtl_directory, ":")
 
+if 've-unknown-linux-unknown' in config.libomptarget_system_targets and \
+config.omp_host_rtl_directory:
+config.test_flags = config.test_flags + " -Xopenmp-target \"-L" +\
+config.omp_host_rtl_directory + "\""
+append_dynamic_library_path('VE_LD_LIBRARY_PATH',
+config.omp_host_rtl_directory, ":")
+
 # substitutions
 # - for targets that exist in the system create the actual command.
 # - for valid targets that do not exist in the system, return false, so that the
Index: openmp/libomptarget/test/env/omp_target_debug.c
===
--- openmp/libomptarget/test/env/omp_target_debug.c
+++ openmp/libomptarget/test/env/omp_target_debug.c
@@ -8,6 +8,8 @@
 // RUN: %libomptarget-compile-x86_64-pc-linux-gnu && env LIBOMPTARGET_DEBUG=0 %libomptarget-run-x86_64-pc-linux-gnu 2>&1 | %fcheck-x86_64-pc-linux-gnu -allow-empty -check-prefix=NDEBUG
 // RUN: %libomptarget-compile-nvptx64-nvidia-cuda && env LIBOMPTARGET_DEBUG=1 %libomptarget-run-nvptx64-nvidia-cuda 2>&1 | %fcheck-nvptx64-nvidia-cuda -allow-empty -check-prefix=DEBUG
 // RUN: %libomptarget-compile-nvptx64-nvidia-cuda && env LIBOMPTARGET_DEBUG=0 %libomptarget-run-nvptx64-nvidia-cuda 2>&1 | %fcheck-nvptx64-nvidia-cuda -allow-empty -check-prefix=NDEBUG
+// RUN: %libomptarget-compile-ve-unknown-linux-unknown && env LIBOMPTARGET_DEBUG=1 %libomptarget-run-ve-unknown-linux-unknown 2>&1 | %fcheck-ve-unknown-linux-unknown -allow-empty -check-prefix=DEBUG
+// RUN: %libomptarget-compile-ve-unknown-linux-unknown && env LIBOMPTARGET_DEBUG=0 %libomptarget-run-ve-unknown-linux-unknown