1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
|
/*
* Copyright (C) 2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include "shared/source/utilities/arrayref.h"
#include "level_zero/core/source/mutable_cmdlist/mcl_types.h"
#include "level_zero/core/source/mutable_cmdlist/usage.h"
#include "level_zero/experimental/source/mutable_cmdlist/label_handle.h"
#include <string>
namespace L0::MCL {
struct InterfaceLabelDescriptor {
const char *name = nullptr;
uint32_t alignment = 0;
};
struct Label : public LabelHandle {
Label() = delete;
Label(ze_command_list_handle_t hCmdList, const InterfaceLabelDescriptor *desc);
static Label *create(ze_command_list_handle_t hCmdList, const InterfaceLabelDescriptor *desc);
static Label *fromHandle(LabelHandle *handle) { return static_cast<Label *>(handle); }
inline LabelHandle *toHandle() { return this; }
ze_result_t setLabel(ze_command_list_handle_t hCmdList);
inline bool isSet() const { return gpuAddress != undefined<GpuAddress>; };
inline GpuAddress getAddress() const { return gpuAddress; }
std::string getName() const { return name; }
inline void addUsage(CommandBufferOffset offset) { labelUsages.push_back(offset); }
inline ArrayRef<const CommandBufferOffset> getUsages() const { return {labelUsages.begin(), labelUsages.size()}; }
protected:
ze_command_list_handle_t hCmdList;
std::string name;
GpuAddress alignment;
GpuAddress gpuAddress = undefined<GpuAddress>;
StackVec<CommandBufferOffset, 8> labelUsages;
};
} // namespace L0::MCL
|