diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -3177,6 +3177,7 @@ TT.getArch() == llvm::Triple::nvptx || TT.getArch() == llvm::Triple::nvptx64 || TT.getArch() == llvm::Triple::amdgcn || + TT.getArch() == llvm::Triple::ve || TT.getArch() == llvm::Triple::x86 || TT.getArch() == llvm::Triple::x86_64)) Diags.Report(diag::err_drv_invalid_omp_target) << A->getValue(i); diff --git a/openmp/libomptarget/CMakeLists.txt b/openmp/libomptarget/CMakeLists.txt --- a/openmp/libomptarget/CMakeLists.txt +++ b/openmp/libomptarget/CMakeLists.txt @@ -35,6 +35,7 @@ set (LIBOMPTARGET_ALL_TARGETS "${LIBOMPTARGET_ALL_TARGETS} powerpc64-ibm-linux-gnu") set (LIBOMPTARGET_ALL_TARGETS "${LIBOMPTARGET_ALL_TARGETS} x86_64-pc-linux-gnu") set (LIBOMPTARGET_ALL_TARGETS "${LIBOMPTARGET_ALL_TARGETS} nvptx64-nvidia-cuda") +set (LIBOMPTARGET_ALL_TARGETS "${LIBOMPTARGET_ALL_TARGETS} ve-unknown-linux-unknown") # Once the plugins for the different targets are validated, they will be added to # the list of supported targets in the current system. diff --git a/openmp/libomptarget/test/api/omp_get_num_devices.c b/openmp/libomptarget/test/api/omp_get_num_devices.c --- a/openmp/libomptarget/test/api/omp_get_num_devices.c +++ b/openmp/libomptarget/test/api/omp_get_num_devices.c @@ -2,6 +2,7 @@ // RUN: %libomptarget-compile-run-and-check-powerpc64-ibm-linux-gnu // RUN: %libomptarget-compile-run-and-check-powerpc64le-ibm-linux-gnu // RUN: %libomptarget-compile-run-and-check-x86_64-pc-linux-gnu +// 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 diff --git a/openmp/libomptarget/test/api/omp_get_num_devices_with_empty_target.c b/openmp/libomptarget/test/api/omp_get_num_devices_with_empty_target.c --- a/openmp/libomptarget/test/api/omp_get_num_devices_with_empty_target.c +++ b/openmp/libomptarget/test/api/omp_get_num_devices_with_empty_target.c @@ -2,6 +2,7 @@ // RUN: %libomptarget-compile-run-and-check-powerpc64-ibm-linux-gnu // RUN: %libomptarget-compile-run-and-check-powerpc64le-ibm-linux-gnu // RUN: %libomptarget-compile-run-and-check-x86_64-pc-linux-gnu +// RUN: env VE_LD_LIBRARY_PATH=%host-rtl-dir %libomptarget-compile-run-and-check-ve-unknown-linux-unknown #include #include diff --git a/openmp/libomptarget/test/env/omp_target_debug.c b/openmp/libomptarget/test/env/omp_target_debug.c --- a/openmp/libomptarget/test/env/omp_target_debug.c +++ b/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 VE_LD_LIBRARY_PATH=%host-rtl-dir 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 VE_LD_LIBRARY_PATH=%host-rtl-dir LIBOMPTARGET_DEBUG=0 %libomptarget-run-ve-unknown-linux-unknown 2>&1 | %fcheck-ve-unknown-linux-unknown -allow-empty -check-prefix=NDEBUG // REQUIRES: libomptarget-debug int main(void) { diff --git a/openmp/libomptarget/test/lit.cfg b/openmp/libomptarget/test/lit.cfg --- a/openmp/libomptarget/test/lit.cfg +++ b/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)) diff --git a/openmp/libomptarget/test/mapping/alloc_fail.c b/openmp/libomptarget/test/mapping/alloc_fail.c --- a/openmp/libomptarget/test/mapping/alloc_fail.c +++ b/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() { diff --git a/openmp/libomptarget/test/mapping/target_implicit_partial_map.c b/openmp/libomptarget/test/mapping/target_implicit_partial_map.c --- a/openmp/libomptarget/test/mapping/target_implicit_partial_map.c +++ b/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. diff --git a/openmp/libomptarget/test/offloading/offloading_success.c b/openmp/libomptarget/test/offloading/offloading_success.c --- a/openmp/libomptarget/test/offloading/offloading_success.c +++ b/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