[libc-commits] [PATCH] D140422: [libc] Add check for locally installed GPUs
Joseph Huber via Phabricator via libc-commits
libc-commits at lists.llvm.org
Tue Dec 20 11:37:30 PST 2022
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGae20ff752621: [libc] Add check for locally installed GPUs (authored by jhuber6).
Changed prior to commit:
https://reviews.llvm.org/D140422?vs=484331&id=484339#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D140422/new/
https://reviews.llvm.org/D140422
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
@@ -28,3 +28,22 @@
message(FATAL_ERROR "LLVM_LIBC_FULL_BUILD must be enabled to build libc for "
"GPU.")
endif()
+
+# Identify any locally installed GPUs to use for testing.
+find_program(LIBC_AMDGPU_ARCH
+ NAMES amdgpu-arch
+ PATHS ${LLVM_BINARY_DIR}/bin /opt/rocm/llvm/bin/)
+if(LIBC_AMDGPU_ARCH)
+ execute_process(COMMAND ${LIBC_AMDGPU_ARCH}
+ OUTPUT_VARIABLE LIBC_AMDGPU_ARCH_OUTPUT
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ string(FIND "${LIBC_AMDGPU_ARCH_OUTPUT}" "\n" first_arch_string)
+ string(SUBSTRING "${LIBC_AMDGPU_ARCH_OUTPUT}" 0 ${first_arch_string}
+ arch_string)
+ if(arch_string)
+ set(LIBC_GPU_TARGET_ARCHITECTURE_IS_AMDGPU TRUE)
+ set(LIBC_GPU_TARGET_TRIPLE "amdgcn-amd-amdhsa")
+ set(LIBC_GPU_TARGET_ARCHITECTURE "${arch_string}")
+ endif()
+endif()
+# TODO: Check for Nvidia GPUs.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D140422.484339.patch
Type: text/x-patch
Size: 1133 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20221220/d925972a/attachment.bin>
More information about the libc-commits
mailing list