[llvm] [runtimes] Add explicit offload arch tool dependencies (PR #206076)

Robert Imschweiler via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 26 08:04:39 PDT 2026


https://github.com/ro-i updated https://github.com/llvm/llvm-project/pull/206076

>From 240b5782ac22e73aec5c631d25c88a9ecacb545d Mon Sep 17 00:00:00 2001
From: Robert Imschweiler <robert.imschweiler at amd.com>
Date: Fri, 26 Jun 2026 09:01:30 -0500
Subject: [PATCH 1/2] [runtimes] Add explicit offload arch tool dependencies

Needed for the offload unittests which detect the target arch at
configure time if not forced by OFFLOAD_TESTS_FORCE_AMDGPU_ARCH. Bug had
been masked by the dependency on flang, which we recently removed in
https://github.com/llvm/llvm-project/pull/198205.

Claude assisted with this patch.
---
 llvm/runtimes/CMakeLists.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/runtimes/CMakeLists.txt b/llvm/runtimes/CMakeLists.txt
index 501ea55a327c7..e6f396295d0d1 100644
--- a/llvm/runtimes/CMakeLists.txt
+++ b/llvm/runtimes/CMakeLists.txt
@@ -623,7 +623,7 @@ if(build_runtimes)
     endforeach()
   endif()
   if("openmp" IN_LIST LLVM_ENABLE_RUNTIMES OR "offload" IN_LIST LLVM_ENABLE_RUNTIMES)
-    foreach(dep opt llvm-link llvm-extract clang llvm-offload-binary clang-nvlink-wrapper)
+    foreach(dep opt llvm-link llvm-extract clang llvm-offload-binary clang-nvlink-wrapper amdgpu-arch nvptx-arch)
       if(TARGET ${dep})
         list(APPEND extra_deps ${dep})
       endif()

>From 9ff22371c9e2ec5b7c69ffb8ea9cc4aee5338fc9 Mon Sep 17 00:00:00 2001
From: Robert Imschweiler <robert.imschweiler at amd.com>
Date: Fri, 26 Jun 2026 10:04:19 -0500
Subject: [PATCH 2/2] scope to tests

---
 llvm/runtimes/CMakeLists.txt | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/llvm/runtimes/CMakeLists.txt b/llvm/runtimes/CMakeLists.txt
index e6f396295d0d1..0fb0efc06b8d2 100644
--- a/llvm/runtimes/CMakeLists.txt
+++ b/llvm/runtimes/CMakeLists.txt
@@ -623,11 +623,20 @@ if(build_runtimes)
     endforeach()
   endif()
   if("openmp" IN_LIST LLVM_ENABLE_RUNTIMES OR "offload" IN_LIST LLVM_ENABLE_RUNTIMES)
-    foreach(dep opt llvm-link llvm-extract clang llvm-offload-binary clang-nvlink-wrapper amdgpu-arch nvptx-arch)
+    foreach(dep opt llvm-link llvm-extract clang llvm-offload-binary clang-nvlink-wrapper)
       if(TARGET ${dep})
         list(APPEND extra_deps ${dep})
       endif()
     endforeach()
+    # The offload unittests detect the GPU arch at configure time via
+    # -mcpu=native, which runs amdgpu-arch / nvptx-arch.
+    if(LLVM_INCLUDE_TESTS)
+      foreach(dep amdgpu-arch nvptx-arch)
+        if(TARGET ${dep})
+          list(APPEND extra_deps ${dep})
+        endif()
+      endforeach()
+    endif()
   endif()
   if(LLVM_LIBC_GPU_BUILD)
     set(_gpu_loader "${LLVM_TOOLS_BINARY_DIR}/llvm-gpu-loader${CMAKE_EXECUTABLE_SUFFIX}")



More information about the llvm-commits mailing list