mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 06:49:52 +08:00
Context implementation (3/N)
Add object creators. Change-Id: Ic656a1bd3735bce1d995c407011ef7c26eab848e Signed-off: Jaime Arteaga <jaime.a.arteaga.molina@intel.com>
This commit is contained in:
@@ -52,6 +52,22 @@ struct Context : _ze_context_handle_t {
|
||||
virtual ze_result_t getMemAllocProperties(const void *ptr,
|
||||
ze_memory_allocation_properties_t *pMemAllocProperties,
|
||||
ze_device_handle_t *phDevice) = 0;
|
||||
virtual ze_result_t createModule(ze_device_handle_t hDevice,
|
||||
const ze_module_desc_t *desc,
|
||||
ze_module_handle_t *phModule,
|
||||
ze_module_build_log_handle_t *phBuildLog) = 0;
|
||||
virtual ze_result_t createSampler(ze_device_handle_t hDevice,
|
||||
const ze_sampler_desc_t *pDesc,
|
||||
ze_sampler_handle_t *phSampler) = 0;
|
||||
virtual ze_result_t createCommandQueue(ze_device_handle_t hDevice,
|
||||
const ze_command_queue_desc_t *desc,
|
||||
ze_command_queue_handle_t *commandQueue) = 0;
|
||||
virtual ze_result_t createCommandList(ze_device_handle_t hDevice,
|
||||
const ze_command_list_desc_t *desc,
|
||||
ze_command_list_handle_t *commandList) = 0;
|
||||
virtual ze_result_t createCommandListImmediate(ze_device_handle_t hDevice,
|
||||
const ze_command_queue_desc_t *desc,
|
||||
ze_command_list_handle_t *commandList) = 0;
|
||||
|
||||
static Context *fromHandle(ze_context_handle_t handle) { return static_cast<Context *>(handle); }
|
||||
inline ze_context_handle_t toHandle() { return this; }
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
|
||||
#include "level_zero/core/source/context/context_imp.h"
|
||||
|
||||
#include "level_zero/core/source/device/device.h"
|
||||
|
||||
namespace L0 {
|
||||
|
||||
ze_result_t ContextImp::destroy() {
|
||||
@@ -111,4 +113,35 @@ ze_result_t ContextImp::getMemAllocProperties(const void *ptr,
|
||||
phDevice);
|
||||
}
|
||||
|
||||
ze_result_t ContextImp::createModule(ze_device_handle_t hDevice,
|
||||
const ze_module_desc_t *desc,
|
||||
ze_module_handle_t *phModule,
|
||||
ze_module_build_log_handle_t *phBuildLog) {
|
||||
return L0::Device::fromHandle(hDevice)->createModule(desc, phModule, phBuildLog);
|
||||
}
|
||||
|
||||
ze_result_t ContextImp::createSampler(ze_device_handle_t hDevice,
|
||||
const ze_sampler_desc_t *pDesc,
|
||||
ze_sampler_handle_t *phSampler) {
|
||||
return L0::Device::fromHandle(hDevice)->createSampler(pDesc, phSampler);
|
||||
}
|
||||
|
||||
ze_result_t ContextImp::createCommandQueue(ze_device_handle_t hDevice,
|
||||
const ze_command_queue_desc_t *desc,
|
||||
ze_command_queue_handle_t *commandQueue) {
|
||||
return L0::Device::fromHandle(hDevice)->createCommandQueue(desc, commandQueue);
|
||||
}
|
||||
|
||||
ze_result_t ContextImp::createCommandList(ze_device_handle_t hDevice,
|
||||
const ze_command_list_desc_t *desc,
|
||||
ze_command_list_handle_t *commandList) {
|
||||
return L0::Device::fromHandle(hDevice)->createCommandList(desc, commandList);
|
||||
}
|
||||
|
||||
ze_result_t ContextImp::createCommandListImmediate(ze_device_handle_t hDevice,
|
||||
const ze_command_queue_desc_t *desc,
|
||||
ze_command_list_handle_t *commandList) {
|
||||
return L0::Device::fromHandle(hDevice)->createCommandListImmediate(desc, commandList);
|
||||
}
|
||||
|
||||
} // namespace L0
|
||||
|
||||
@@ -46,6 +46,22 @@ struct ContextImp : Context {
|
||||
ze_result_t getMemAllocProperties(const void *ptr,
|
||||
ze_memory_allocation_properties_t *pMemAllocProperties,
|
||||
ze_device_handle_t *phDevice) override;
|
||||
ze_result_t createModule(ze_device_handle_t hDevice,
|
||||
const ze_module_desc_t *desc,
|
||||
ze_module_handle_t *phModule,
|
||||
ze_module_build_log_handle_t *phBuildLog) override;
|
||||
ze_result_t createSampler(ze_device_handle_t hDevice,
|
||||
const ze_sampler_desc_t *pDesc,
|
||||
ze_sampler_handle_t *phSampler) override;
|
||||
ze_result_t createCommandQueue(ze_device_handle_t hDevice,
|
||||
const ze_command_queue_desc_t *desc,
|
||||
ze_command_queue_handle_t *commandQueue) override;
|
||||
ze_result_t createCommandList(ze_device_handle_t hDevice,
|
||||
const ze_command_list_desc_t *desc,
|
||||
ze_command_list_handle_t *commandList) override;
|
||||
ze_result_t createCommandListImmediate(ze_device_handle_t hDevice,
|
||||
const ze_command_queue_desc_t *desc,
|
||||
ze_command_list_handle_t *commandList) override;
|
||||
|
||||
protected:
|
||||
DriverHandle *driverHandle = nullptr;
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "level_zero/core/source/cmdlist/cmdlist.h"
|
||||
#include "level_zero/core/source/context/context.h"
|
||||
#include "level_zero/core/source/kernel/kernel.h"
|
||||
#include "level_zero/core/source/module/module_build_log.h"
|
||||
#include <level_zero/ze_api.h>
|
||||
|
||||
Reference in New Issue
Block a user