2020-03-06 18:09:57 +08:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2019-2020 Intel Corporation
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2020-03-19 13:21:57 +08:00
|
|
|
#include "level_zero/core/source/cmdlist/cmdlist.h"
|
|
|
|
#include "level_zero/core/source/kernel/kernel.h"
|
|
|
|
#include "level_zero/core/source/module/module_build_log.h"
|
2020-03-06 18:09:57 +08:00
|
|
|
#include <level_zero/ze_api.h>
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
struct _ze_module_handle_t {};
|
|
|
|
|
|
|
|
namespace L0 {
|
|
|
|
struct Device;
|
|
|
|
|
|
|
|
struct Module : _ze_module_handle_t {
|
2020-05-28 23:51:00 +08:00
|
|
|
static Module *create(Device *device, const ze_module_desc_t *desc,
|
2020-03-06 18:09:57 +08:00
|
|
|
ModuleBuildLog *moduleBuildLog);
|
|
|
|
|
|
|
|
virtual ~Module() = default;
|
|
|
|
|
|
|
|
virtual Device *getDevice() const = 0;
|
|
|
|
|
|
|
|
virtual ze_result_t createKernel(const ze_kernel_desc_t *desc,
|
|
|
|
ze_kernel_handle_t *phFunction) = 0;
|
|
|
|
virtual ze_result_t destroy() = 0;
|
|
|
|
virtual ze_result_t getNativeBinary(size_t *pSize, uint8_t *pModuleNativeBinary) = 0;
|
|
|
|
virtual ze_result_t getFunctionPointer(const char *pKernelName, void **pfnFunction) = 0;
|
|
|
|
virtual ze_result_t getGlobalPointer(const char *pGlobalName, void **pPtr) = 0;
|
|
|
|
virtual ze_result_t getDebugInfo(size_t *pDebugDataSize, uint8_t *pDebugData) = 0;
|
|
|
|
virtual ze_result_t getKernelNames(uint32_t *pCount, const char **pNames) = 0;
|
|
|
|
|
|
|
|
virtual const KernelImmutableData *getKernelImmutableData(const char *functionName) const = 0;
|
|
|
|
virtual const std::vector<std::unique_ptr<KernelImmutableData>> &getKernelImmutableDataVector() const = 0;
|
|
|
|
virtual uint32_t getMaxGroupSize() const = 0;
|
2020-03-16 20:34:33 +08:00
|
|
|
virtual bool isDebugEnabled() const = 0;
|
2020-03-06 18:09:57 +08:00
|
|
|
|
|
|
|
Module() = default;
|
|
|
|
Module(const Module &) = delete;
|
|
|
|
Module(Module &&) = delete;
|
|
|
|
Module &operator=(const Module &) = delete;
|
|
|
|
Module &operator=(Module &&) = delete;
|
|
|
|
|
|
|
|
static Module *fromHandle(ze_module_handle_t handle) { return static_cast<Module *>(handle); }
|
|
|
|
|
|
|
|
inline ze_module_handle_t toHandle() { return this; }
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace L0
|