CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
88 lines
3.0 KiB
C++
88 lines
3.0 KiB
C++
//===--- 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.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef OPENMP_LIBOMPTARGET_PLUGINS_NEXTGEN_LEVEL_ZERO_L0PLUGIN_H
|
|
#define OPENMP_LIBOMPTARGET_PLUGINS_NEXTGEN_LEVEL_ZERO_L0PLUGIN_H
|
|
|
|
#include "L0Defs.h"
|
|
#include "L0Device.h"
|
|
#include "L0Memory.h"
|
|
#include "L0Options.h"
|
|
#include "L0Program.h"
|
|
|
|
namespace llvm::omp::target::plugin {
|
|
|
|
/// Class implementing the LevelZero specific functionalities of the plugin.
|
|
class LevelZeroPluginTy final : public GenericPluginTy {
|
|
private:
|
|
struct DeviceInfoTy {
|
|
L0DeviceIdTy Id;
|
|
L0ContextTy *Driver;
|
|
bool isRoot() const { return Id.SubId < 0 && Id.CCSId < 0; }
|
|
};
|
|
llvm::SmallVector<DeviceInfoTy> DetectedDevices;
|
|
|
|
/// Context (and Driver) specific data.
|
|
std::list<L0ContextTy> ContextList;
|
|
|
|
// Table containing per-thread information for each Context using TLS.
|
|
L0ContextTLSTableTy ContextTLSTable;
|
|
|
|
/// L0 plugin options.
|
|
L0OptionsTy Options;
|
|
|
|
/// Find L0 devices and initialize device properties.
|
|
/// Returns number of devices reported to omptarget.
|
|
Expected<int32_t> findDevices();
|
|
|
|
public:
|
|
LevelZeroPluginTy() : GenericPluginTy(getTripleArch()) {}
|
|
virtual ~LevelZeroPluginTy() = default;
|
|
|
|
L0ContextTLSTy &getContextTLS(ze_context_handle_t Context) {
|
|
return ContextTLSTable.get(Context);
|
|
}
|
|
|
|
const L0OptionsTy &getOptions() { return Options; }
|
|
|
|
const L0DeviceTy &getDeviceFromId(int32_t DeviceId) const {
|
|
return static_cast<const L0DeviceTy &>(getDevice(DeviceId));
|
|
}
|
|
L0DeviceTy &getDeviceFromId(int32_t DeviceId) {
|
|
return static_cast<L0DeviceTy &>(getDevice(DeviceId));
|
|
}
|
|
|
|
// Plugin interface.
|
|
Expected<int32_t> initImpl() override;
|
|
Error deinitImpl() override;
|
|
GenericDeviceTy *createDevice(GenericPluginTy &Plugin, int32_t DeviceId,
|
|
int32_t NumDevices) override;
|
|
GenericGlobalHandlerTy *createGlobalHandler() override;
|
|
|
|
uint16_t getMagicElfBits() const override { return ELF::EM_INTELGT; }
|
|
Triple::ArchType getTripleArch() const override { return Triple::spirv64; }
|
|
const char *getName() const override { return GETNAME(TARGET_NAME); }
|
|
|
|
Expected<bool> isELFCompatible(uint32_t DeviceId,
|
|
StringRef Image) const override;
|
|
|
|
Error flushQueueImpl(omp_interop_val_t *Interop) override;
|
|
Error syncBarrierImpl(omp_interop_val_t *Interop) override;
|
|
Error asyncBarrierImpl(omp_interop_val_t *Interop) override;
|
|
|
|
Expected<bool> isImageCompatible(StringRef Image) const override;
|
|
};
|
|
|
|
} // namespace llvm::omp::target::plugin
|
|
|
|
#endif // OPENMP_LIBOMPTARGET_PLUGINS_NEXTGEN_LEVEL_ZERO_L0PLUGIN_H
|