-
Notifications
You must be signed in to change notification settings - Fork 13.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[LLVM] Make the GPU loader utilities an LLVM tool #132096
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
set(LLVM_LINK_COMPONENTS | ||
BinaryFormat | ||
Object | ||
Option | ||
Support | ||
FrontendOffloading | ||
) | ||
|
||
add_llvm_tool(llvm-gpu-loader | ||
llvm-gpu-loader.cpp | ||
|
||
# TODO: We intentionally split this currently due to statically linking the | ||
# GPU runtimes. Dynamically load the dependencies, possibly using the | ||
# LLVM offloading API when it is complete. | ||
PARTIAL_SOURCES_INTENDED | ||
|
||
DEPENDS | ||
intrinsics_gen | ||
) | ||
|
||
# Locate the RPC server handling interface. | ||
include(FindLibcCommonUtils) | ||
target_link_libraries(llvm-gpu-loader PUBLIC llvm-libc-common-utilities) | ||
|
||
# Check for HSA support for targeting AMD GPUs. | ||
find_package(hsa-runtime64 QUIET 1.2.0 HINTS ${CMAKE_INSTALL_PREFIX} PATHS /opt/rocm) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Silent automagic dependency on hsa-runtime64 (and CUDA runtime below) deep down the source tree is a horrible idea. I've filed bug #132890 specifically about it. |
||
if(hsa-runtime64_FOUND) | ||
target_sources(llvm-gpu-loader PRIVATE amdhsa.cpp) | ||
target_compile_definitions(llvm-gpu-loader PRIVATE AMDHSA_SUPPORT) | ||
target_link_libraries(llvm-gpu-loader PRIVATE hsa-runtime64::hsa-runtime64) | ||
|
||
# Compatibility with the old amdhsa-loader name. | ||
add_llvm_tool_symlink(amdhsa-loader llvm-gpu-loader) | ||
endif() | ||
|
||
# Check for CUDA support for targeting NVIDIA GPUs. | ||
find_package(CUDAToolkit 11.2 QUIET) | ||
if(CUDAToolkit_FOUND) | ||
target_sources(llvm-gpu-loader PRIVATE nvptx.cpp) | ||
target_compile_definitions(llvm-gpu-loader PRIVATE NVPTX_SUPPORT) | ||
target_link_libraries(llvm-gpu-loader PRIVATE CUDA::cuda_driver) | ||
|
||
# Compatibility with the old nvptx-loader name. | ||
add_llvm_tool_symlink(nvptx-loader llvm-gpu-loader) | ||
endif() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not a correct use of
PARTIAL_SOURCES_INTENDED
. It is intended to be used only when you are building multiple targets within a single file. Here, you should just include all sources and use#ifdef
.