[Openmp-commits] [openmp] 909344c - [OpenMP] Remove duplicates from the list if using 'auto'

Joseph Huber via Openmp-commits openmp-commits at lists.llvm.org
Fri Apr 14 13:14:27 PDT 2023


Author: Joseph Huber
Date: 2023-04-14T15:14:08-05:00
New Revision: 909344c7ac4d77823127c3470c5270f7882fdfd4

URL: https://github.com/llvm/llvm-project/commit/909344c7ac4d77823127c3470c5270f7882fdfd4
DIFF: https://github.com/llvm/llvm-project/commit/909344c7ac4d77823127c3470c5270f7882fdfd4.diff

LOG: [OpenMP] Remove duplicates from the list if using 'auto'

Summary:
We can detect the user's GPUs via the `auto` option. But if the user has
multiple GPUs installed or set the list incorrectly, we need to remove
the duplicates.

Added: 
    

Modified: 
    openmp/libomptarget/DeviceRTL/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/openmp/libomptarget/DeviceRTL/CMakeLists.txt b/openmp/libomptarget/DeviceRTL/CMakeLists.txt
index 53da2661011e..f123105fc21b 100644
--- a/openmp/libomptarget/DeviceRTL/CMakeLists.txt
+++ b/openmp/libomptarget/DeviceRTL/CMakeLists.txt
@@ -70,7 +70,8 @@ set(LIBOMPTARGET_DEVICE_ARCHITECTURES "all" CACHE STRING
 
 if(LIBOMPTARGET_DEVICE_ARCHITECTURES STREQUAL "all")
   set(LIBOMPTARGET_DEVICE_ARCHITECTURES ${all_gpu_architectures})
-elseif(LIBOMPTARGET_DEVICE_ARCHITECTURES STREQUAL "auto")
+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(
       "Could not find 'amdgpu-arch' and 'nvptx-arch' tools required for 'auto'")
@@ -80,6 +81,7 @@ elseif(LIBOMPTARGET_DEVICE_ARCHITECTURES STREQUAL "auto")
   set(LIBOMPTARGET_DEVICE_ARCHITECTURES
       "${LIBOMPTARGET_NVPTX_DETECTED_ARCH_LIST};${LIBOMPTARGET_AMDGPU_DETECTED_ARCH_LIST}")
 endif()
+list(REMOVE_DUPLICATES LIBOMPTARGET_DEVICE_ARCHITECTURES)
 
 set(include_files
   ${include_directory}/Configuration.h


        


More information about the Openmp-commits mailing list