[clang] [OpenMP] Fix test after updating library search paths (PR #83573)

2024-03-01 Thread Joseph Huber via cfe-commits

https://github.com/jhuber6 closed 
https://github.com/llvm/llvm-project/pull/83573
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [OpenMP] Fix test after updating library search paths (PR #83573)

2024-03-01 Thread Björn Pettersson via cfe-commits

https://github.com/bjope approved this pull request.


https://github.com/llvm/llvm-project/pull/83573
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [OpenMP] Fix test after updating library search paths (PR #83573)

2024-03-01 Thread Björn Pettersson via cfe-commits


@@ -101,17 +101,6 @@
 
 /// ###
 
-/// Check that the warning is thrown when the libomptarget bitcode library is 
not found.
-/// Libomptarget requires sm_52 or newer so an sm_52 bitcode library should 
never exist.
-// RUN:   not %clang -### -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda 
\
-// RUN:   -Xopenmp-target -march=sm_52 
--cuda-path=%S/Inputs/CUDA_102/usr/local/cuda \
-// RUN:   -fopenmp-relocatable-target -save-temps %s 2>&1 \
-// RUN:   | FileCheck -check-prefix=CHK-BCLIB-WARN %s
-
-// CHK-BCLIB-WARN: no library 'libomptarget-nvptx-sm_52.bc' found in the 
default clang lib directory or in LIBRARY_PATH; use 
'--libomptarget-nvptx-bc-path' to specify nvptx bitcode library

bjope wrote:

Ok. Just wanted to raise the concern. Anyway this patch would help, to avoid 
failures in our downstream buildbots (and I wouldn't need to workaround those 
problems downstream).
So LGTM!

https://github.com/llvm/llvm-project/pull/83573
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [OpenMP] Fix test after updating library search paths (PR #83573)

2024-03-01 Thread Joseph Huber via cfe-commits


@@ -101,17 +101,6 @@
 
 /// ###
 
-/// Check that the warning is thrown when the libomptarget bitcode library is 
not found.
-/// Libomptarget requires sm_52 or newer so an sm_52 bitcode library should 
never exist.
-// RUN:   not %clang -### -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda 
\
-// RUN:   -Xopenmp-target -march=sm_52 
--cuda-path=%S/Inputs/CUDA_102/usr/local/cuda \
-// RUN:   -fopenmp-relocatable-target -save-temps %s 2>&1 \
-// RUN:   | FileCheck -check-prefix=CHK-BCLIB-WARN %s
-
-// CHK-BCLIB-WARN: no library 'libomptarget-nvptx-sm_52.bc' found in the 
default clang lib directory or in LIBRARY_PATH; use 
'--libomptarget-nvptx-bc-path' to specify nvptx bitcode library

jhuber6 wrote:

I'm not overly concerned, we could change it to be a `no_such_file` error 
instead. Realistically this was just a mess because whoever set it up initially 
didn't put it into a place that's guaranteed to be looked at first, so instead 
they just forced it to only look in once place.

https://github.com/llvm/llvm-project/pull/83573
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [OpenMP] Fix test after updating library search paths (PR #83573)

2024-03-01 Thread Björn Pettersson via cfe-commits


@@ -101,17 +101,6 @@
 
 /// ###
 
-/// Check that the warning is thrown when the libomptarget bitcode library is 
not found.
-/// Libomptarget requires sm_52 or newer so an sm_52 bitcode library should 
never exist.
-// RUN:   not %clang -### -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda 
\
-// RUN:   -Xopenmp-target -march=sm_52 
--cuda-path=%S/Inputs/CUDA_102/usr/local/cuda \
-// RUN:   -fopenmp-relocatable-target -save-temps %s 2>&1 \
-// RUN:   | FileCheck -check-prefix=CHK-BCLIB-WARN %s
-
-// CHK-BCLIB-WARN: no library 'libomptarget-nvptx-sm_52.bc' found in the 
default clang lib directory or in LIBRARY_PATH; use 
'--libomptarget-nvptx-bc-path' to specify nvptx bitcode library

bjope wrote:

When removing this test you suddenly lose code coverage for the 
err_drv_omp_offload_target_missingbcruntime diagnostic. That seems a bit 
unfortunate.

https://github.com/llvm/llvm-project/pull/83573
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [OpenMP] Fix test after updating library search paths (PR #83573)

2024-03-01 Thread via cfe-commits

llvmbot wrote:




@llvm/pr-subscribers-clang

Author: Joseph Huber (jhuber6)


Changes

Summary:
We still use this bitcode library in one case, the NVPTX non-LTO build.
The patch updated the search paths to treat it the same as other
libraries, which unintentionally prioritized system paths over
LIBRARY_PATH which is generally not correct. Also we had a test that
relied on system state so remove that.


---
Full diff: https://github.com/llvm/llvm-project/pull/83573.diff


2 Files Affected:

- (modified) clang/lib/Driver/ToolChains/CommonArgs.cpp (+4-4) 
- (modified) clang/test/Driver/openmp-offload-gpu.c (-11) 


``diff
diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp 
b/clang/lib/Driver/ToolChains/CommonArgs.cpp
index 382c8b3612a0af..7f0f78b41e79ed 100644
--- a/clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -2767,10 +2767,6 @@ void tools::addOpenMPDeviceRTL(const Driver &D,
const ToolChain &HostTC) {
   SmallVector LibraryPaths;
 
-  // Check all of the standard library search paths used by the compiler.
-  for (const auto &LibPath : HostTC.getFilePaths())
-LibraryPaths.emplace_back(LibPath);
-
   // Add user defined library paths from LIBRARY_PATH.
   std::optional LibPath =
   llvm::sys::Process::GetEnv("LIBRARY_PATH");
@@ -2782,6 +2778,10 @@ void tools::addOpenMPDeviceRTL(const Driver &D,
   LibraryPaths.emplace_back(Path.trim());
   }
 
+  // Check all of the standard library search paths used by the compiler.
+  for (const auto &LibPath : HostTC.getFilePaths())
+LibraryPaths.emplace_back(LibPath);
+
   OptSpecifier LibomptargetBCPathOpt =
   Triple.isAMDGCN() ? options::OPT_libomptarget_amdgpu_bc_path_EQ
 : options::OPT_libomptarget_nvptx_bc_path_EQ;
diff --git a/clang/test/Driver/openmp-offload-gpu.c 
b/clang/test/Driver/openmp-offload-gpu.c
index 5da74a35d87ad9..f7b06c9ec59580 100644
--- a/clang/test/Driver/openmp-offload-gpu.c
+++ b/clang/test/Driver/openmp-offload-gpu.c
@@ -101,17 +101,6 @@
 
 /// ###
 
-/// Check that the warning is thrown when the libomptarget bitcode library is 
not found.
-/// Libomptarget requires sm_52 or newer so an sm_52 bitcode library should 
never exist.
-// RUN:   not %clang -### -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda 
\
-// RUN:   -Xopenmp-target -march=sm_52 
--cuda-path=%S/Inputs/CUDA_102/usr/local/cuda \
-// RUN:   -fopenmp-relocatable-target -save-temps %s 2>&1 \
-// RUN:   | FileCheck -check-prefix=CHK-BCLIB-WARN %s
-
-// CHK-BCLIB-WARN: no library 'libomptarget-nvptx-sm_52.bc' found in the 
default clang lib directory or in LIBRARY_PATH; use 
'--libomptarget-nvptx-bc-path' to specify nvptx bitcode library
-
-/// ###
-
 /// Check that the error is thrown when the libomptarget bitcode library does 
not exist.
 // RUN:   not %clang -### -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda 
\
 // RUN:   -Xopenmp-target -march=sm_52 
--cuda-path=%S/Inputs/CUDA_102/usr/local/cuda \

``




https://github.com/llvm/llvm-project/pull/83573
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [OpenMP] Fix test after updating library search paths (PR #83573)

2024-03-01 Thread Joseph Huber via cfe-commits

https://github.com/jhuber6 created 
https://github.com/llvm/llvm-project/pull/83573

Summary:
We still use this bitcode library in one case, the NVPTX non-LTO build.
The patch updated the search paths to treat it the same as other
libraries, which unintentionally prioritized system paths over
LIBRARY_PATH which is generally not correct. Also we had a test that
relied on system state so remove that.


>From 210bee4de5022ed7f4f7357c921ec291677ea7f3 Mon Sep 17 00:00:00 2001
From: Joseph Huber 
Date: Fri, 1 Mar 2024 08:11:37 -0600
Subject: [PATCH] [OpenMP] Fix test after updating library search paths

Summary:
We still use this bitcode library in one case, the NVPTX non-LTO build.
The patch updated the search paths to treat it the same as other
libraries, which unintentionally prioritized system paths over
LIBRARY_PATH which is generally not correct. Also we had a test that
relied on system state so remove that.
---
 clang/lib/Driver/ToolChains/CommonArgs.cpp |  8 
 clang/test/Driver/openmp-offload-gpu.c | 11 ---
 2 files changed, 4 insertions(+), 15 deletions(-)

diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp 
b/clang/lib/Driver/ToolChains/CommonArgs.cpp
index 382c8b3612a0af..7f0f78b41e79ed 100644
--- a/clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -2767,10 +2767,6 @@ void tools::addOpenMPDeviceRTL(const Driver &D,
const ToolChain &HostTC) {
   SmallVector LibraryPaths;
 
-  // Check all of the standard library search paths used by the compiler.
-  for (const auto &LibPath : HostTC.getFilePaths())
-LibraryPaths.emplace_back(LibPath);
-
   // Add user defined library paths from LIBRARY_PATH.
   std::optional LibPath =
   llvm::sys::Process::GetEnv("LIBRARY_PATH");
@@ -2782,6 +2778,10 @@ void tools::addOpenMPDeviceRTL(const Driver &D,
   LibraryPaths.emplace_back(Path.trim());
   }
 
+  // Check all of the standard library search paths used by the compiler.
+  for (const auto &LibPath : HostTC.getFilePaths())
+LibraryPaths.emplace_back(LibPath);
+
   OptSpecifier LibomptargetBCPathOpt =
   Triple.isAMDGCN() ? options::OPT_libomptarget_amdgpu_bc_path_EQ
 : options::OPT_libomptarget_nvptx_bc_path_EQ;
diff --git a/clang/test/Driver/openmp-offload-gpu.c 
b/clang/test/Driver/openmp-offload-gpu.c
index 5da74a35d87ad9..f7b06c9ec59580 100644
--- a/clang/test/Driver/openmp-offload-gpu.c
+++ b/clang/test/Driver/openmp-offload-gpu.c
@@ -101,17 +101,6 @@
 
 /// ###
 
-/// Check that the warning is thrown when the libomptarget bitcode library is 
not found.
-/// Libomptarget requires sm_52 or newer so an sm_52 bitcode library should 
never exist.
-// RUN:   not %clang -### -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda 
\
-// RUN:   -Xopenmp-target -march=sm_52 
--cuda-path=%S/Inputs/CUDA_102/usr/local/cuda \
-// RUN:   -fopenmp-relocatable-target -save-temps %s 2>&1 \
-// RUN:   | FileCheck -check-prefix=CHK-BCLIB-WARN %s
-
-// CHK-BCLIB-WARN: no library 'libomptarget-nvptx-sm_52.bc' found in the 
default clang lib directory or in LIBRARY_PATH; use 
'--libomptarget-nvptx-bc-path' to specify nvptx bitcode library
-
-/// ###
-
 /// Check that the error is thrown when the libomptarget bitcode library does 
not exist.
 // RUN:   not %clang -### -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda 
\
 // RUN:   -Xopenmp-target -march=sm_52 
--cuda-path=%S/Inputs/CUDA_102/usr/local/cuda \

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