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

Nick Sarnie via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 25 10:10:01 PDT 2025


================
@@ -0,0 +1,180 @@
+//===- LevelZeroArch.cpp - list installed Level Zero devices ---*- C++ -*--===//
+//
+// 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 implements a tool for detecting Level Zero devices installed in the
+// system
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/Support/CommandLine.h"
+#include "llvm/Support/DynamicLibrary.h"
+#include "llvm/Support/Error.h"
+#include <cstdio>
+
+#define ZE_MAX_DEVICE_NAME 256
+#define ZE_MAX_DEVICE_UUID_SIZE 16
+
+using ze_driver_handle_t = void *;
+using ze_device_handle_t = void *;
+
+enum ze_result_t {
+  ZE_RESULT_SUCCESS = 0,
+  ZE_RESULT_ERROR_UNKNOWN = 0x7ffffffe
+};
+
+enum ze_structure_type_t {
+  ZE_STRUCTURE_TYPE_INIT_DRIVER_TYPE_DESC = 0x00020021,
+  ZE_STRUCTURE_TYPE_DEVICE_PROPERTIES = 0x3,
+  ZE_STRUCTURE_TYPE_FORCE_UINT32 = 0x7fffffff
+};
+
+enum ze_init_driver_type_flags_t { ZE_INIT_DRIVER_TYPE_FLAG_GPU = 1 };
+
+typedef uint32_t ze_device_type_t;
----------------
sarnex wrote:

looks like we have 4 remaining `typedef`s

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


More information about the cfe-commits mailing list