[llvm] [offload] Add Windows offload support (PR #187006)

Weronika Lewandowska via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 17 01:11:40 PDT 2026


https://github.com/wlemkows updated https://github.com/llvm/llvm-project/pull/187006

>From 16a27358d02d5f8e84234f0665cf66e08b285f0f Mon Sep 17 00:00:00 2001
From: Weronika Lewandowska <weronika.lewandowska at intel.com>
Date: Thu, 15 Jan 2026 14:32:02 +0100
Subject: [PATCH] Add Windows offload support

---
 offload/CMakeLists.txt                        | 62 +++++++++++++++----
 offload/include/Shared/Utils.h                | 17 ++---
 offload/include/omptarget.h                   |  2 +-
 offload/liboffload/CMakeLists.txt             | 17 ++++-
 offload/liboffload/src/OffloadImpl.cpp        |  2 +-
 offload/plugins-nextgen/CMakeLists.txt        | 10 +++
 offload/plugins-nextgen/common/CMakeLists.txt | 10 ++-
 .../common/include/ErrorReporting.h           | 13 ++++
 .../common/include/GlobalHandler.h            |  3 +-
 .../common/src/GlobalHandler.cpp              | 13 ++++
 .../common/src/RPC_Windows.cpp                | 57 +++++++++++++++++
 .../plugins-nextgen/common/src/Utils/ELF.cpp  |  9 ++-
 .../level_zero/include/L0Device.h             |  5 +-
 offload/tools/CMakeLists.txt                  |  6 +-
 .../deviceinfo/llvm-offload-device-info.cpp   |  3 +
 15 files changed, 201 insertions(+), 28 deletions(-)
 create mode 100644 offload/plugins-nextgen/common/src/RPC_Windows.cpp

diff --git a/offload/CMakeLists.txt b/offload/CMakeLists.txt
index 472fee8e64156..7b15bd11d47db 100644
--- a/offload/CMakeLists.txt
+++ b/offload/CMakeLists.txt
@@ -9,8 +9,8 @@ set(OFFLOAD_MIN_CUDA_VERSION 11.8.0)
 set(OFFLOAD_MIN_CUDA_VERSION_CODE 11080)
 
 # Check that the library can actually be built.
-if(APPLE OR WIN32 OR WASM)
-  message(WARNING "libomptarget cannot be built on Windows and MacOS X!")
+if(APPLE OR WASM)
+  message(WARNING "libomptarget cannot be built on MacOS X and WASM!")
   return()
 elseif("${LLVM_DEFAULT_TARGET_TRIPLE}" MATCHES "^(amdgcn|nvptx|spirv)" OR
        "${CMAKE_CXX_COMPILER_TARGET}" MATCHES "^(amdgcn|nvptx|spirv)")
@@ -43,6 +43,11 @@ endif()
 
 set(LLVM_COMMON_CMAKE_UTILS ${CMAKE_CURRENT_SOURCE_DIR}/../cmake)
 
+# These are needed for RtlGetLastNtStatus and delay-load helpers
+if(WIN32)
+  add_link_options(/DEFAULTLIB:ntdll.lib /DEFAULTLIB:delayimp.lib)
+endif()
+
 option(OFFLOAD_INCLUDE_TESTS "Generate and build offload tests." ${LLVM_INCLUDE_TESTS})
 
 # Add path for custom modules
@@ -123,16 +128,30 @@ if(DEFINED LIBOMPTARGET_BUILD_CUDA_PLUGIN OR
 endif()
 
 set(LIBOMPTARGET_ALL_PLUGIN_TARGETS amdgpu cuda)
-set(LIBOMPTARGET_PLUGINS_TO_BUILD "all" CACHE STRING
-    "Semicolon-separated list of plugins to use: cuda, amdgpu, level_zero, or \"all\".")
+# On Windows, build only the Level Zero plugin for now.
+if(WIN32)
+  set(LIBOMPTARGET_PLUGINS_TO_BUILD "level_zero" CACHE STRING
+      "Semicolon-separated list of plugins to use: level_zero.")
+  message(STATUS "Building liboffload on Windows with the level_zero plugin")
+else()
+  set(LIBOMPTARGET_PLUGINS_TO_BUILD "all" CACHE STRING
+      "Semicolon-separated list of plugins to use: cuda, amdgpu or \"all\".")
 
-if(LIBOMPTARGET_PLUGINS_TO_BUILD STREQUAL "all")
-  set(LIBOMPTARGET_PLUGINS_TO_BUILD ${LIBOMPTARGET_ALL_PLUGIN_TARGETS})
+  if(LIBOMPTARGET_PLUGINS_TO_BUILD STREQUAL "all")
+    set(LIBOMPTARGET_PLUGINS_TO_BUILD ${LIBOMPTARGET_ALL_PLUGIN_TARGETS})
+  endif()
 endif()
 
 list(APPEND LIBOMPTARGET_PLUGINS_TO_BUILD "host")
 list(REMOVE_DUPLICATES LIBOMPTARGET_PLUGINS_TO_BUILD)
 
+if(WIN32)
+  if("host" IN_LIST LIBOMPTARGET_PLUGINS_TO_BUILD)
+    message(STATUS "Not building host plugin: it is not supported on Windows")
+    list(REMOVE_ITEM LIBOMPTARGET_PLUGINS_TO_BUILD "host")
+  endif()
+endif()
+
 if(NOT (CMAKE_SYSTEM_PROCESSOR MATCHES "(x86_64)|(ppc64le)|(aarch64)$"
         AND CMAKE_SYSTEM_NAME MATCHES "Linux"))
   if("amdgpu" IN_LIST LIBOMPTARGET_PLUGINS_TO_BUILD)
@@ -165,7 +184,7 @@ foreach(plugin IN LISTS LIBOMPTARGET_PLUGINS_TO_BUILD)
   set(LIBOMPTARGET_ENUM_PLUGIN_TARGETS
       "${LIBOMPTARGET_ENUM_PLUGIN_TARGETS}PLUGIN_TARGET(${plugin})\n")
 endforeach()
-string(STRIP ${LIBOMPTARGET_ENUM_PLUGIN_TARGETS} LIBOMPTARGET_ENUM_PLUGIN_TARGETS)
+string(STRIP "${LIBOMPTARGET_ENUM_PLUGIN_TARGETS}" LIBOMPTARGET_ENUM_PLUGIN_TARGETS)
 configure_file(
   ${CMAKE_CURRENT_SOURCE_DIR}/include/Shared/Targets.def.in
   ${CMAKE_CURRENT_BINARY_DIR}/include/Shared/Targets.def
@@ -213,10 +232,20 @@ if(LIBOMPTARGET_ENABLE_DEBUG)
 endif()
 
 # No exceptions and no RTTI, except if requested.
-set(offload_compile_flags -fno-exceptions)
+if(MSVC)
+  set(offload_compile_flags /EHs-c-)
+else()
+  set(offload_compile_flags -fno-exceptions)
+endif()
+
 if(NOT LLVM_ENABLE_RTTI)
-  set(offload_compile_flags ${offload_compile_flags} -fno-rtti)
+  if(MSVC)
+    list(APPEND offload_compile_flags /GR-)
+  else()
+    list(APPEND offload_compile_flags -fno-rtti)
+  endif()
 endif()
+
 if(OFFLOAD_HAVE_WERROR_CTOR)
   list(APPEND offload_compile_flags -Werror=global-constructors)
 endif()
@@ -296,8 +325,19 @@ add_subdirectory(plugins-nextgen)
 add_subdirectory(tools)
 add_subdirectory(docs)
 
-# Build target agnostic offloading library.
-add_subdirectory(libomptarget)
+# Allow disabling libomptarget (e.g., on Windows) while still building
+# liboffload and plugins.
+if (WIN32)
+  set(LIBOMPTARGET_ENABLE_LIBOMPTARGET_DEFAULT OFF)
+else()
+  set(LIBOMPTARGET_ENABLE_LIBOMPTARGET_DEFAULT ON)
+endif()
+option(LIBOMPTARGET_ENABLE_LIBOMPTARGET
+       "Build the libomptarget runtime library"
+       ${LIBOMPTARGET_ENABLE_LIBOMPTARGET_DEFAULT})
+if(LIBOMPTARGET_PLUGINS_TO_BUILD AND LIBOMPTARGET_ENABLE_LIBOMPTARGET)
+  add_subdirectory(libomptarget)
+endif()
 
 add_subdirectory(liboffload)
 
diff --git a/offload/include/Shared/Utils.h b/offload/include/Shared/Utils.h
index fa0212e2c2175..11e252173843f 100644
--- a/offload/include/Shared/Utils.h
+++ b/offload/include/Shared/Utils.h
@@ -15,6 +15,7 @@
 #define OMPTARGET_SHARED_UTILS_H
 
 #include <stdint.h>
+#include "llvm/ADT/bit.h"
 
 namespace utils {
 
@@ -42,26 +43,26 @@ template <typename Ty> inline Ty roundUp(Ty V, Ty Boundary) {
 
 /// Return the first bit set in \p V.
 inline uint32_t ffs(uint32_t V) {
-  static_assert(sizeof(int) == sizeof(uint32_t), "type size mismatch");
-  return __builtin_ffs(V);
+  if (V == 0)
+    return 0;
+  return llvm::countr_zero(V) + 1;
 }
 
 /// Return the first bit set in \p V.
 inline uint32_t ffs(uint64_t V) {
-  static_assert(sizeof(long) == sizeof(uint64_t), "type size mismatch");
-  return __builtin_ffsl(V);
+  if (V == 0)
+    return 0;
+  return llvm::countr_zero(V) + 1;
 }
 
 /// Return the number of bits set in \p V.
 inline uint32_t popc(uint32_t V) {
-  static_assert(sizeof(int) == sizeof(uint32_t), "type size mismatch");
-  return __builtin_popcount(V);
+  return llvm::popcount(V);
 }
 
 /// Return the number of bits set in \p V.
 inline uint32_t popc(uint64_t V) {
-  static_assert(sizeof(long) == sizeof(uint64_t), "type size mismatch");
-  return __builtin_popcountl(V);
+  return llvm::popcount(V);
 }
 
 } // namespace utils
diff --git a/offload/include/omptarget.h b/offload/include/omptarget.h
index c2233c5bfe2aa..830421d88f1c4 100644
--- a/offload/include/omptarget.h
+++ b/offload/include/omptarget.h
@@ -46,7 +46,7 @@ enum __tgt_target_return_t : int {
 };
 
 /// Data attributes for each data reference used in an OpenMP target region.
-enum tgt_map_type {
+enum tgt_map_type : uint64_t {
   // No flags
   OMP_TGT_MAPTYPE_NONE = 0x000,
   // copy data from host to device
diff --git a/offload/liboffload/CMakeLists.txt b/offload/liboffload/CMakeLists.txt
index 62480dad1cac8..eee8dd3793185 100644
--- a/offload/liboffload/CMakeLists.txt
+++ b/offload/liboffload/CMakeLists.txt
@@ -12,8 +12,11 @@ add_llvm_library(
   DEPENDS
   OffloadAPI
   PluginErrcodes
+  PluginCommon
   )
 
+target_link_libraries(LLVMOffload PRIVATE PluginCommon)
+
 foreach(plugin IN LISTS LIBOMPTARGET_PLUGINS_TO_BUILD)
     target_link_libraries(LLVMOffload PRIVATE omptarget.rtl.${plugin})
 endforeach()
@@ -27,6 +30,7 @@ target_include_directories(LLVMOffload PUBLIC
                             ${CMAKE_CURRENT_BINARY_DIR}/../include
                             ${CMAKE_CURRENT_SOURCE_DIR}/include
                             ${CMAKE_CURRENT_SOURCE_DIR}/../include
+                            PRIVATE
                             ${CMAKE_CURRENT_SOURCE_DIR}/../plugins-nextgen/common/include
                             ${CMAKE_CURRENT_BINARY_DIR}/../plugins-nextgen/common/include
                             )
@@ -43,7 +47,18 @@ set_target_properties(LLVMOffload PROPERTIES
                       POSITION_INDEPENDENT_CODE ON
                       INSTALL_RPATH "$ORIGIN"
                       BUILD_RPATH "$ORIGIN:${CMAKE_CURRENT_BINARY_DIR}/..")
-install(TARGETS LLVMOffload LIBRARY COMPONENT LLVMOffload DESTINATION "${OFFLOAD_INSTALL_LIBDIR}")
+install(TARGETS LLVMOffload
+        COMPONENT LLVMOffload
+        RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
+        LIBRARY DESTINATION "${OFFLOAD_INSTALL_LIBDIR}"
+        ARCHIVE DESTINATION "${OFFLOAD_INSTALL_LIBDIR}")
+
+if(MSVC)
+  install(FILES "$<TARGET_PDB_FILE:LLVMOffload>"
+          CONFIGURATIONS Debug RelWithDebInfo
+          DESTINATION "${CMAKE_INSTALL_BINDIR}"
+          OPTIONAL)
+endif()
 
 install(FILES ${CMAKE_CURRENT_BINARY_DIR}/API/OffloadAPI.h DESTINATION ${CMAKE_INSTALL_PREFIX}/include/offload)
 install(FILES ${CMAKE_CURRENT_BINARY_DIR}/API/OffloadPrint.hpp DESTINATION ${CMAKE_INSTALL_PREFIX}/include/offload)
diff --git a/offload/liboffload/src/OffloadImpl.cpp b/offload/liboffload/src/OffloadImpl.cpp
index 77933e6291f4a..6382e3a1ecfa1 100644
--- a/offload/liboffload/src/OffloadImpl.cpp
+++ b/offload/liboffload/src/OffloadImpl.cpp
@@ -258,7 +258,7 @@ template <typename HandleT> Error olDestroy(HandleT Handle) {
   return Error::success();
 }
 
-constexpr ol_platform_backend_t pluginNameToBackend(StringRef Name) {
+ol_platform_backend_t pluginNameToBackend(StringRef Name) {
   if (Name == "amdgpu") {
     return OL_PLATFORM_BACKEND_AMDGPU;
   } else if (Name == "cuda") {
diff --git a/offload/plugins-nextgen/CMakeLists.txt b/offload/plugins-nextgen/CMakeLists.txt
index 5165ed173f19f..33827b30283a0 100644
--- a/offload/plugins-nextgen/CMakeLists.txt
+++ b/offload/plugins-nextgen/CMakeLists.txt
@@ -2,6 +2,16 @@
 set(common_dir ${CMAKE_CURRENT_SOURCE_DIR}/common)
 set(common_bin_dir ${CMAKE_CURRENT_BINARY_DIR}/common)
 add_subdirectory(common)
+
+# Only build specific plugins if any are requested
+if(NOT LIBOMPTARGET_PLUGINS_TO_BUILD)
+  message(STATUS "Skipping plugin implementations (no plugins enabled)")
+  # Set empty lists for parent scope
+  set(LIBOMPTARGET_SYSTEM_TARGETS "" PARENT_SCOPE)
+  set(LIBOMPTARGET_TESTED_PLUGINS "" PARENT_SCOPE)
+  return()
+endif()
+
 function(add_target_library target_name lib_name)
   add_llvm_library(${target_name} STATIC
     LINK_COMPONENTS
diff --git a/offload/plugins-nextgen/common/CMakeLists.txt b/offload/plugins-nextgen/common/CMakeLists.txt
index cd150d1bf9298..389ced89e9aa2 100644
--- a/offload/plugins-nextgen/common/CMakeLists.txt
+++ b/offload/plugins-nextgen/common/CMakeLists.txt
@@ -9,12 +9,20 @@ add_public_tablegen_target(PluginErrcodes)
 
 # NOTE: Don't try to build `PluginInterface` using `add_llvm_library` because we
 # don't want to export `PluginInterface` while `add_llvm_library` requires that.
+
+# Use platform-specific RPC implementation
+if(WIN32)
+  set(RPC_SOURCE src/RPC_Windows.cpp)
+else()
+  set(RPC_SOURCE src/RPC.cpp)
+endif()
+
 add_library(PluginCommon OBJECT
   src/PluginInterface.cpp
   src/GlobalHandler.cpp
   src/JIT.cpp
   src/RecordReplay.cpp
-  src/RPC.cpp
+  ${RPC_SOURCE}
   src/OffloadError.cpp
   src/Utils/ELF.cpp
 )
diff --git a/offload/plugins-nextgen/common/include/ErrorReporting.h b/offload/plugins-nextgen/common/include/ErrorReporting.h
index 68d82cbea0f3c..4e5e20933efba 100644
--- a/offload/plugins-nextgen/common/include/ErrorReporting.h
+++ b/offload/plugins-nextgen/common/include/ErrorReporting.h
@@ -28,7 +28,16 @@
 #include <functional>
 #include <optional>
 #include <string>
+
+#ifndef _WIN32
 #include <unistd.h>
+#endif
+
+// Fallback definitions for file descriptor constants on platforms that don't
+// have unistd.h (e.g., Windows)
+#ifndef STDERR_FILENO
+#define STDERR_FILENO 2
+#endif
 
 namespace llvm {
 namespace omp {
@@ -73,9 +82,11 @@ class ErrorReporter {
     llvm_unreachable("Unknown target alloc kind");
   }
 
+#ifdef __clang__
 #pragma clang diagnostic push
 #pragma clang diagnostic ignored "-Wgcc-compat"
 #pragma clang diagnostic ignored "-Wformat-security"
+#endif
   /// Print \p Format, instantiated with \p Args to stderr.
   /// TODO: Allow redirection into a file stream.
   template <typename... ArgsTy>
@@ -110,7 +121,9 @@ class ErrorReporter {
     print(BoldRed, Format, Args...);
     print("\n");
   }
+#ifdef __clang__
 #pragma clang diagnostic pop
+#endif
 
   static void reportError(const char *Str) { reportError("%s", Str); }
   static void print(const char *Str) { print("%s", Str); }
diff --git a/offload/plugins-nextgen/common/include/GlobalHandler.h b/offload/plugins-nextgen/common/include/GlobalHandler.h
index fc8d6fe384754..5c1786afb9e89 100644
--- a/offload/plugins-nextgen/common/include/GlobalHandler.h
+++ b/offload/plugins-nextgen/common/include/GlobalHandler.h
@@ -18,6 +18,7 @@
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/Object/ELFObjectFile.h"
 #include "llvm/ProfileData/InstrProf.h"
+#include "llvm/Support/Compiler.h"
 
 #include "Shared/Debug.h"
 #include "Shared/Utils.h"
@@ -72,7 +73,7 @@ struct __llvm_profile_gpu_sections {
 };
 
 extern "C" {
-extern int __attribute__((weak)) __llvm_write_custom_profile(
+extern int LLVM_ATTRIBUTE_WEAK __llvm_write_custom_profile(
     const char *Target, const __llvm_profile_data *DataBegin,
     const __llvm_profile_data *DataEnd, const char *CountersBegin,
     const char *CountersEnd, const char *NamesBegin, const char *NamesEnd,
diff --git a/offload/plugins-nextgen/common/src/GlobalHandler.cpp b/offload/plugins-nextgen/common/src/GlobalHandler.cpp
index 9216834b1e15e..796ac2b33829a 100644
--- a/offload/plugins-nextgen/common/src/GlobalHandler.cpp
+++ b/offload/plugins-nextgen/common/src/GlobalHandler.cpp
@@ -30,6 +30,19 @@ using namespace plugin;
 using namespace error;
 using namespace llvm::offload::debug;
 
+// Windows/MSVC doesn't support weak symbols properly, so provide a stub
+// implementation that will be used if compiler-rt is not linked.
+#ifdef _WIN32
+extern "C" int __llvm_write_custom_profile(
+    const char *Target, const __llvm_profile_data *DataBegin,
+    const __llvm_profile_data *DataEnd, const char *CountersBegin,
+    const char *CountersEnd, const char *NamesBegin, const char *NamesEnd,
+    const uint64_t *VersionOverride) {
+  // Return error code indicating profiling is not available
+  return -1;
+}
+#endif
+
 Expected<std::unique_ptr<ObjectFile>>
 GenericGlobalHandlerTy::getELFObjectFile(DeviceImageTy &Image) {
   assert(utils::elf::isELF(Image.getMemoryBuffer().getBuffer()) &&
diff --git a/offload/plugins-nextgen/common/src/RPC_Windows.cpp b/offload/plugins-nextgen/common/src/RPC_Windows.cpp
new file mode 100644
index 0000000000000..20b9897fb7e82
--- /dev/null
+++ b/offload/plugins-nextgen/common/src/RPC_Windows.cpp
@@ -0,0 +1,57 @@
+//===- RPC_Windows.cpp - Windows stub implementation of RPC ----------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// This file provides Windows stub implementations for the RPC interface.
+// Remote Procedure Calls are not supported on Windows, so all RPC functions
+// are no-ops that return success.
+//
+//===----------------------------------------------------------------------===//
+
+#include "RPC.h"
+#include "PluginInterface.h"
+
+using namespace llvm;
+using namespace omp;
+using namespace target;
+
+// Windows stub: RPC not supported
+RPCServerTy::RPCServerTy(plugin::GenericPluginTy &Plugin) {}
+
+Error RPCServerTy::shutDown(plugin::GenericPluginTy &Plugin) {
+  return Error::success();
+}
+
+Error RPCServerTy::startThread() {
+  return Error::success();
+}
+
+Expected<bool> RPCServerTy::isDeviceUsingRPC(
+    plugin::GenericDeviceTy &Device,
+    plugin::GenericGlobalHandlerTy &Handler,
+    plugin::DeviceImageTy &Image) {
+  return false;
+}
+
+Error RPCServerTy::initDevice(
+    plugin::GenericDeviceTy &Device,
+    plugin::GenericGlobalHandlerTy &Handler,
+    plugin::DeviceImageTy &Image) {
+  return Error::success();
+}
+
+Error RPCServerTy::deinitDevice(plugin::GenericDeviceTy &Device) {
+  return Error::success();
+}
+
+void RPCServerTy::registerCallback(RPCServerCallbackTy Callback) {}
+
+void RPCServerTy::ServerThread::shutDown() {}
+
+void RPCServerTy::ServerThread::startThread() {}
+
+void RPCServerTy::ServerThread::run() {}
diff --git a/offload/plugins-nextgen/common/src/Utils/ELF.cpp b/offload/plugins-nextgen/common/src/Utils/ELF.cpp
index 9762a5d738db8..6ddf8f1a3d270 100644
--- a/offload/plugins-nextgen/common/src/Utils/ELF.cpp
+++ b/offload/plugins-nextgen/common/src/Utils/ELF.cpp
@@ -50,7 +50,14 @@ uint16_t utils::elf::getTargetMachine() {
 #elif defined(__loongarch__)
   return EM_LOONGARCH;
 #else
-#warning "Unknown ELF compilation target architecture"
+// #warning directive is available starting in C23 and C++23.
+#define UNKNOWN_ARCH_MSG "Unknown ELF compilation target architecture"
+#ifdef _MSC_VER
+#pragma message(UNKNOWN_ARCH_MSG)
+#else
+#warning UNKNOWN_ARCH_MSG
+#endif
+#undef UNKNOWN_ARCH_MSG
   return EM_NONE;
 #endif
 }
diff --git a/offload/plugins-nextgen/level_zero/include/L0Device.h b/offload/plugins-nextgen/level_zero/include/L0Device.h
index 8c83d14f8d1b0..d11d6c7ff1cda 100644
--- a/offload/plugins-nextgen/level_zero/include/L0Device.h
+++ b/offload/plugins-nextgen/level_zero/include/L0Device.h
@@ -22,6 +22,7 @@
 #include "L0Program.h"
 #include "PluginInterface.h"
 #include "TLS.h"
+#include <limits>
 
 namespace llvm::omp::target::plugin {
 
@@ -206,8 +207,8 @@ class L0DeviceTy final : public GenericDeviceTy {
   std::string zeId;
 
   /// Command queue group ordinals for each device.
-  static constexpr uint32_t MaxOrdinal =
-      std::numeric_limits<decltype(MaxOrdinal)>::max();
+  static constexpr uint32_t MaxOrdinal = std::numeric_limits<uint32_t>::max();
+
   std::pair<uint32_t, uint32_t> ComputeOrdinal{MaxOrdinal, 0};
   /// Command queue group ordinals for copying.
   std::pair<uint32_t, uint32_t> CopyOrdinal{MaxOrdinal, 0};
diff --git a/offload/tools/CMakeLists.txt b/offload/tools/CMakeLists.txt
index 7010ba93a4322..ec539f0b57587 100644
--- a/offload/tools/CMakeLists.txt
+++ b/offload/tools/CMakeLists.txt
@@ -11,4 +11,8 @@ macro(add_offload_tool_symlink name)
 endmacro()
 
 add_subdirectory(deviceinfo)
-add_subdirectory(kernelreplay)
+
+# kernelreplay requires libomptarget which is not available on Windows
+if(NOT WIN32)
+  add_subdirectory(kernelreplay)
+endif()
diff --git a/offload/tools/deviceinfo/llvm-offload-device-info.cpp b/offload/tools/deviceinfo/llvm-offload-device-info.cpp
index 1fc27f90d17ea..936d082695b47 100644
--- a/offload/tools/deviceinfo/llvm-offload-device-info.cpp
+++ b/offload/tools/deviceinfo/llvm-offload-device-info.cpp
@@ -43,6 +43,9 @@ void doWrite<ol_platform_backend_t>(std::ostream &S,
   case OL_PLATFORM_BACKEND_AMDGPU:
     S << "AMDGPU";
     break;
+  case OL_PLATFORM_BACKEND_LEVEL_ZERO:
+    S << "LEVEL_ZERO";
+    break;
   case OL_PLATFORM_BACKEND_HOST:
     S << "HOST";
     break;



More information about the llvm-commits mailing list