[libc-commits] [PATCH] D143400: [libc] Add `LIBC_GPU_TEST_ARCHITECTURE` option to set architecture

Joseph Huber via Phabricator via libc-commits libc-commits at lists.llvm.org
Mon Feb 6 09:02:24 PST 2023


This revision was automatically updated to reflect the committed changes.
Closed by commit rGf8563a254541: [libc] Add `LIBC_GPU_TEST_ARCHITECTURE` option to set architecture (authored by jhuber6).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D143400/new/

https://reviews.llvm.org/D143400

Files:
  libc/cmake/modules/prepare_libc_gpu_build.cmake


Index: libc/cmake/modules/prepare_libc_gpu_build.cmake
===================================================================
--- libc/cmake/modules/prepare_libc_gpu_build.cmake
+++ libc/cmake/modules/prepare_libc_gpu_build.cmake
@@ -42,6 +42,25 @@
                       "build")
 endif()
 
+set(LIBC_GPU_TEST_ARCHITECTURE "" CACHE STRING "Architecture for the GPU tests")
+if(LIBC_GPU_TEST_ARCHITECTURE)
+  message(STATUS "Using user-specified GPU architecture for testing "
+                 "'${LIBC_GPU_TARGET_ARCHITECTURE}'")
+  if("${LIBC_GPU_TARGET_ARCHITECTURE}" IN_LIST all_amdgpu_architectures)
+    set(LIBC_GPU_TARGET_ARCHITECTURE_IS_AMDGPU TRUE)
+    set(LIBC_GPU_TARGET_TRIPLE "amdgcn-amd-amdhsa")
+    set(LIBC_GPU_TARGET_ARCHITECTURE "${LIBC_GPU_TEST_ARCHITECTURE}")
+  elseif("${LIBC_GPU_TARGET_ARCHITECTURE}" IN_LIST all_nvptx_architectures)
+    set(LIBC_GPU_TARGET_ARCHITECTURE_IS_NVPTX TRUE)
+    set(LIBC_GPU_TARGET_TRIPLE "nvptx64-nvidia-cuda")
+    set(LIBC_GPU_TARGET_ARCHITECTURE "${LIBC_GPU_TEST_ARCHITECTURE}")
+  else()
+    message(FATAL_ERROR 
+            "Unknown GPU architecture '${LIBC_GPU_TARGET_ARCHITECTURE}'")
+  endif()
+  return()
+endif()
+
 # Identify any locally installed AMD GPUs on the system to use for testing.
 find_program(LIBC_AMDGPU_ARCH
              NAMES amdgpu-arch


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D143400.495156.patch
Type: text/x-patch
Size: 1322 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20230206/95af9844/attachment-0001.bin>


More information about the libc-commits mailing list