[clang] [clang][tools] Add LevelZero support to offload-arch (PR #160570)

Alex Duran via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 24 13:56:55 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()
----------------
adurang wrote:

It's not the number of functions, it's the associated data types.

About the value, if you think of a local installation yes there's no difference. If it's something to be packaged and distributed, you can still compile it without requiring all libraries to be present at target machines.

In any case, I made the changes.

https://github.com/llvm/llvm-project/pull/160570


More information about the cfe-commits mailing list