[llvm] [OFFLOAD] Add plugin with support for Intel oneAPI Level Zero (PR #158900)

Alexey Sachkov via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 16 04:35:52 PDT 2025


================
@@ -0,0 +1,136 @@
+//===--- Level Zero Target RTL Implementation -----------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+//
+// Plugin interface for SPIR-V/Xe machine
+//
+//===----------------------------------------------------------------------===//
+
+#pragma once
+
+#include "AsyncQueue.h"
+#include "L0Defs.h"
+#include "L0Device.h"
+#include "L0Memory.h"
+#include "L0Options.h"
+#include "L0Program.h"
+#include "TLS.h"
+
+namespace llvm::omp::target::plugin {
+
+/// Class implementing the LevelZero specific functionalities of the plugin.
+class LevelZeroPluginTy final : public GenericPluginTy {
+private:
+  /// Number of devices available including subdevices
+  uint32_t NumDevices = 0;
+
+  /// Context (and Driver) specific data
+  std::list<L0ContextTy> ContextList;
+
+  /// L0 device used by each OpenMP device
+  using DeviceContainerTy = llvm::SmallVector<L0DeviceTy *>;
+  DeviceContainerTy L0Devices;
+
+  // Table containing per-thread information using TLS
+  L0ThreadTblTy ThreadTLSTable;
+  // Table containing per-thread information for each device using TLS
+  L0DeviceTLSTableTy DeviceTLSTable;
+  // Table containing per-thread information for each Context using TLS
+  L0ContextTLSTableTy ContextTLSTable;
+
+  /// L0 plugin global options
+  static L0OptionsTy Options;
+
+  /// Global mutex
----------------
AlexeySachkov wrote:

```suggestion
```

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


More information about the llvm-commits mailing list