[llvm] [offload] Support LIBOMPTARGET_DEVICE_ARCHITECTURES={amdgpu|nvptx} (PR #119070)

Michał Górny via llvm-commits llvm-commits at lists.llvm.org
Sat Dec 7 05:53:01 PST 2024


https://github.com/mgorny created https://github.com/llvm/llvm-project/pull/119070

Add two more special values for LIBOMPTARGET_DEVICE_ARCHITECTURES: `amdgpu` and `nvptx`, to support building for all AMDGPU and NVPTX targets respectively.  This can be used in place of `all` when offload is built with one of the GPU plugins only.

>From 60b4818e5b4cdd628a1ee8b1ae348e503fd1083f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny at gentoo.org>
Date: Sat, 7 Dec 2024 14:50:50 +0100
Subject: [PATCH] [offload] Support
 LIBOMPTARGET_DEVICE_ARCHITECTURES={amdgpu|nvptx}

Add two more special values for LIBOMPTARGET_DEVICE_ARCHITECTURES:
`amdgpu` and `nvptx`, to support building for all AMDGPU and NVPTX
targets respectively.  This can be used in place of `all` when offload
is built with one of the GPU plugins only.
---
 offload/DeviceRTL/CMakeLists.txt | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/offload/DeviceRTL/CMakeLists.txt b/offload/DeviceRTL/CMakeLists.txt
index 32a7510be980d8..1bf3eb9da38aa1 100644
--- a/offload/DeviceRTL/CMakeLists.txt
+++ b/offload/DeviceRTL/CMakeLists.txt
@@ -57,6 +57,10 @@ 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 "amdgpu")
+  set(LIBOMPTARGET_DEVICE_ARCHITECTURES ${all_amdgpu_architectures})
+elseif(LIBOMPTARGET_DEVICE_ARCHITECTURES STREQUAL "nvptx")
+  set(LIBOMPTARGET_DEVICE_ARCHITECTURES ${all_nvptx_architectures})
 elseif(LIBOMPTARGET_DEVICE_ARCHITECTURES STREQUAL "auto" OR
        LIBOMPTARGET_DEVICE_ARCHITECTURES STREQUAL "native")
   if(NOT LIBOMPTARGET_NVPTX_ARCH AND NOT LIBOMPTARGET_AMDGPU_ARCH)



More information about the llvm-commits mailing list