[llvm] [Offload] Fix stray libomptarget message helper calls (PR #106837)

WÁNG Xuěruì via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 31 01:44:45 PDT 2024


https://github.com/xen0n created https://github.com/llvm/llvm-project/pull/106837

In #92581 the `LibomptargetUitls.cmake` helpers have been removed, but only uses of `libomptarget_say` were migrated. Migrate the remaining few warning and error messages so the `check-offload` target would not fail due to missing `libomptarget_warning_say`.

While at it, update the `check-offload` unavailability message to say `check-offload` instead of `check-libomptarget`.

Fixes #92581

>From e4540dcf0e081b259a0420c06c1088572954bf12 Mon Sep 17 00:00:00 2001
From: WANG Xuerui <git at xen0n.name>
Date: Sat, 31 Aug 2024 16:40:29 +0800
Subject: [PATCH] [Offload] Fix stray libomptarget message helper calls

In #92581 the `LibomptargetUitls.cmake` helpers have been removed, but
only uses of `libomptarget_say` were migrated. Migrate the remaining
few warning and error messages so the `check-offload` target would not
fail due to missing `libomptarget_warning_say`.

While at it, update the `check-offload` unavailability message to say
`check-offload` instead of `check-libomptarget`.

Fixes #92581
---
 offload/DeviceRTL/CMakeLists.txt | 6 +++---
 offload/test/CMakeLists.txt      | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/offload/DeviceRTL/CMakeLists.txt b/offload/DeviceRTL/CMakeLists.txt
index f30afd9674a072..ad465f0ccbd614 100644
--- a/offload/DeviceRTL/CMakeLists.txt
+++ b/offload/DeviceRTL/CMakeLists.txt
@@ -60,10 +60,10 @@ if(LIBOMPTARGET_DEVICE_ARCHITECTURES STREQUAL "all")
 elseif(LIBOMPTARGET_DEVICE_ARCHITECTURES STREQUAL "auto" OR
        LIBOMPTARGET_DEVICE_ARCHITECTURES STREQUAL "native")
   if(NOT LIBOMPTARGET_NVPTX_ARCH AND NOT LIBOMPTARGET_AMDGPU_ARCH)
-    libomptarget_error_say(
+    message(FATAL_ERROR
       "Could not find 'amdgpu-arch' and 'nvptx-arch' tools required for 'auto'")
   elseif(NOT LIBOMPTARGET_FOUND_NVIDIA_GPU AND NOT LIBOMPTARGET_FOUND_AMDGPU_GPU)
-    libomptarget_error_say("No AMD or NVIDIA GPU found on the system when using 'auto'")
+    message(FATAL_ERROR "No AMD or NVIDIA GPU found on the system when using 'auto'")
   endif()
   set(LIBOMPTARGET_DEVICE_ARCHITECTURES
       "${LIBOMPTARGET_NVPTX_DETECTED_ARCH_LIST};${LIBOMPTARGET_AMDGPU_DETECTED_ARCH_LIST}")
@@ -291,7 +291,7 @@ foreach(gpu_arch ${LIBOMPTARGET_DEVICE_ARCHITECTURES})
   elseif("${gpu_arch}" IN_LIST all_nvptx_architectures)
     compileDeviceRTLLibrary(${gpu_arch} nvptx nvptx64-nvidia-cuda --cuda-feature=+ptx63)
   else()
-    libomptarget_error_say("Unknown GPU architecture '${gpu_arch}'")
+    message(FATAL_ERROR "Unknown GPU architecture '${gpu_arch}'")
   endif()
 endforeach()
 
diff --git a/offload/test/CMakeLists.txt b/offload/test/CMakeLists.txt
index 495d1ef62226e7..5a6f637b57fa7b 100644
--- a/offload/test/CMakeLists.txt
+++ b/offload/test/CMakeLists.txt
@@ -2,7 +2,7 @@
 if(NOT CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR
    CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.0.0)
   message(STATUS "Can only test with Clang compiler in version 6.0.0 or later.")
-  libomptarget_warning_say("The check-libomptarget target will not be available!")
+  message(WARNING "The check-offload target will not be available!")
   return()
 endif()
 



More information about the llvm-commits mailing list