[libc-commits] [libc] [libc] Change the GPU loaders to LLVM executables (PR #101442)
Joseph Huber via libc-commits
libc-commits at lists.llvm.org
Wed Jul 31 19:01:25 PDT 2024
https://github.com/jhuber6 created https://github.com/llvm/llvm-project/pull/101442
Summary:
I am going to rework these tools to just me LLVM tools. This patch is
pretty much NFC to set up the CMake for that.
>From 22ed918b0a52027faff7f9bd89a9fb86c45c4bbb Mon Sep 17 00:00:00 2001
From: Joseph Huber <huberjn at outlook.com>
Date: Wed, 31 Jul 2024 20:59:41 -0500
Subject: [PATCH] [libc] Change the GPU loaders to LLVM executables
Summary:
I am going to rework these tools to just me LLVM tools. This patch is
pretty much NFC to set up the CMake for that.
---
libc/utils/gpu/loader/CMakeLists.txt | 2 ++
libc/utils/gpu/loader/amdgpu/CMakeLists.txt | 9 ++++++++-
.../amdgpu/{Loader.cpp => amdhsa-loader.cpp} | 0
libc/utils/gpu/loader/nvptx/CMakeLists.txt | 16 ++++++++--------
.../nvptx/{Loader.cpp => nvptx-loader.cpp} | 0
5 files changed, 18 insertions(+), 9 deletions(-)
rename libc/utils/gpu/loader/amdgpu/{Loader.cpp => amdhsa-loader.cpp} (100%)
rename libc/utils/gpu/loader/nvptx/{Loader.cpp => nvptx-loader.cpp} (100%)
diff --git a/libc/utils/gpu/loader/CMakeLists.txt b/libc/utils/gpu/loader/CMakeLists.txt
index b562cdc521c07..7b5f28075c8b1 100644
--- a/libc/utils/gpu/loader/CMakeLists.txt
+++ b/libc/utils/gpu/loader/CMakeLists.txt
@@ -4,6 +4,8 @@ target_include_directories(gpu_loader PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}
${LIBC_SOURCE_DIR}/include
${LIBC_SOURCE_DIR}
+ ${LLVM_MAIN_INCLUDE_DIR}
+ ${LLVM_BINARY_DIR}/include)
)
find_package(hsa-runtime64 QUIET 1.2.0 HINTS ${CMAKE_INSTALL_PREFIX} PATHS /opt/rocm)
diff --git a/libc/utils/gpu/loader/amdgpu/CMakeLists.txt b/libc/utils/gpu/loader/amdgpu/CMakeLists.txt
index 97a2de9f8379a..46c5631046ce2 100644
--- a/libc/utils/gpu/loader/amdgpu/CMakeLists.txt
+++ b/libc/utils/gpu/loader/amdgpu/CMakeLists.txt
@@ -1,4 +1,11 @@
-add_executable(amdhsa-loader Loader.cpp)
+set(LLVM_LINK_COMPONENTS
+ BinaryFormat
+ Object
+ Option
+ Support
+ )
+
+add_llvm_executable(amdhsa-loader amdhsa-loader.cpp)
target_link_libraries(amdhsa-loader
PRIVATE
diff --git a/libc/utils/gpu/loader/amdgpu/Loader.cpp b/libc/utils/gpu/loader/amdgpu/amdhsa-loader.cpp
similarity index 100%
rename from libc/utils/gpu/loader/amdgpu/Loader.cpp
rename to libc/utils/gpu/loader/amdgpu/amdhsa-loader.cpp
diff --git a/libc/utils/gpu/loader/nvptx/CMakeLists.txt b/libc/utils/gpu/loader/nvptx/CMakeLists.txt
index 948493959badf..21453b9ca0348 100644
--- a/libc/utils/gpu/loader/nvptx/CMakeLists.txt
+++ b/libc/utils/gpu/loader/nvptx/CMakeLists.txt
@@ -1,15 +1,15 @@
-add_executable(nvptx-loader Loader.cpp)
+set(LLVM_LINK_COMPONENTS
+ BinaryFormat
+ Object
+ Option
+ Support
+ )
+
+add_llvm_executable(nvptx-loader nvptx-loader.cpp)
-if(NOT LLVM_ENABLE_RTTI)
- target_compile_options(nvptx-loader PRIVATE -fno-rtti)
-endif()
-target_include_directories(nvptx-loader PRIVATE
- ${LLVM_MAIN_INCLUDE_DIR} ${LLVM_BINARY_DIR}/include)
target_link_libraries(nvptx-loader
PRIVATE
gpu_loader
llvmlibc_rpc_server
CUDA::cuda_driver
- LLVMObject
- LLVMSupport
)
diff --git a/libc/utils/gpu/loader/nvptx/Loader.cpp b/libc/utils/gpu/loader/nvptx/nvptx-loader.cpp
similarity index 100%
rename from libc/utils/gpu/loader/nvptx/Loader.cpp
rename to libc/utils/gpu/loader/nvptx/nvptx-loader.cpp
More information about the libc-commits
mailing list