[clang] [clang][tools] Add LevelZero support to offload-arch (PR #160570)
Joseph Huber via cfe-commits
cfe-commits at lists.llvm.org
Wed Sep 24 11:00:52 PDT 2025
================
@@ -1,8 +1,16 @@
set(LLVM_LINK_COMPONENTS Support)
-add_clang_tool(offload-arch OffloadArch.cpp NVPTXArch.cpp AMDGPUArchByKFD.cpp AMDGPUArchByHIP.cpp)
+add_clang_tool(offload-arch OffloadArch.cpp NVPTXArch.cpp AMDGPUArchByKFD.cpp
+ AMDGPUArchByHIP.cpp LevelZeroArch.cpp)
+
+find_path(OFFLOAD_ARCH_LEVEL_ZERO_INCLUDE_DIR NAMES level_zero/ze_api.h)
+if (OFFLOAD_ARCH_LEVEL_ZERO_INCLUDE_DIR)
+ target_include_directories(offload-arch PRIVATE ${OFFLOAD_ARCH_LEVEL_ZERO_INCLUDE_DIR})
+ target_compile_definitions(offload-arch PRIVATE HAVE_LEVEL_ZERO_HEADERS)
+endif()
----------------
jhuber6 wrote:
If we still need things in the user's install then there's no point dynamically linking at all. I previously removed direct linking since it make this tool unreliable when it's supposed to be a part of the offloading toolchain. I'm surprised this is apparently extremely difficult for L0 since for KFD it's just walking a directory and CUDA / HIP it's like two function calls.
https://github.com/llvm/llvm-project/pull/160570
More information about the cfe-commits
mailing list