level-zero v1.0 (2/N)

Change-Id: I1419231a721fab210e166d26a264cae04d661dcd
Signed-off-by: Jaime Arteaga <jaime.a.arteaga.molina@intel.com>
Signed-off-by: macabral <matias.a.cabral@intel.com>
Signed-off-by: davidoli <david.olien@intel.com>
Signed-off-by: Aravind Gopalakrishnan <Aravind.Gopalakrishnan@intel.com>
Signed-off-by: Spruit, Neil R <neil.r.spruit@intel.com>
Signed-off-by: Latif, Raiyan <raiyan.latif@intel.com>
Signed-off-by: Artur Harasimiuk <artur.harasimiuk@intel.com>
This commit is contained in:
Jaime Arteaga
2020-07-29 02:45:54 -07:00
committed by sys_ocldev
parent e8246a8179
commit 902fc2f6c4
255 changed files with 3200 additions and 12829 deletions

View File

@@ -9,9 +9,7 @@
#include "level_zero/core/source/driver/driver_handle.h"
#include <level_zero/ze_api.h>
#include "third_party/level_zero/ze_api_ext.h"
#include "third_party/level_zero/zet_api_ext.h"
#include <level_zero/zet_api.h>
struct _ze_context_handle_t {
virtual ~_ze_context_handle_t() = default;
@@ -25,17 +23,17 @@ struct Context : _ze_context_handle_t {
virtual ze_result_t destroy() = 0;
virtual ze_result_t getStatus() = 0;
virtual DriverHandle *getDriverHandle() = 0;
virtual ze_result_t allocHostMem(ze_host_mem_alloc_flag_t flags,
virtual ze_result_t allocHostMem(ze_host_mem_alloc_flags_t flags,
size_t size,
size_t alignment,
void **ptr) = 0;
virtual ze_result_t allocDeviceMem(ze_device_handle_t hDevice,
ze_device_mem_alloc_flag_t flags,
ze_device_mem_alloc_flags_t flags,
size_t size,
size_t alignment, void **ptr) = 0;
virtual ze_result_t allocSharedMem(ze_device_handle_t hDevice,
ze_device_mem_alloc_flag_t deviceFlags,
ze_host_mem_alloc_flag_t hostFlags,
ze_device_mem_alloc_flags_t deviceFlags,
ze_host_mem_alloc_flags_t hostFlags,
size_t size,
size_t alignment,
void **ptr) = 0;
@@ -98,6 +96,15 @@ struct Context : _ze_context_handle_t {
size_t size,
ze_memory_access_attribute_t *access,
size_t *outSize) = 0;
virtual ze_result_t openEventPoolIpcHandle(ze_ipc_event_pool_handle_t hIpc,
ze_event_pool_handle_t *phEventPool) = 0;
virtual ze_result_t createEventPool(const ze_event_pool_desc_t *desc,
uint32_t numDevices,
ze_device_handle_t *phDevices,
ze_event_pool_handle_t *phEventPool) = 0;
virtual ze_result_t createImage(ze_device_handle_t hDevice,
const ze_image_desc_t *desc,
ze_image_handle_t *phImage) = 0;
static Context *fromHandle(ze_context_handle_t handle) { return static_cast<Context *>(handle); }
inline ze_context_handle_t toHandle() { return this; }

View File

@@ -29,7 +29,7 @@ ContextImp::ContextImp(DriverHandle *driverHandle) {
this->driverHandle = driverHandle;
}
ze_result_t ContextImp::allocHostMem(ze_host_mem_alloc_flag_t flags,
ze_result_t ContextImp::allocHostMem(ze_host_mem_alloc_flags_t flags,
size_t size,
size_t alignment,
void **ptr) {
@@ -41,7 +41,7 @@ ze_result_t ContextImp::allocHostMem(ze_host_mem_alloc_flag_t flags,
}
ze_result_t ContextImp::allocDeviceMem(ze_device_handle_t hDevice,
ze_device_mem_alloc_flag_t flags,
ze_device_mem_alloc_flags_t flags,
size_t size,
size_t alignment, void **ptr) {
DEBUG_BREAK_IF(nullptr == this->driverHandle);
@@ -53,8 +53,8 @@ ze_result_t ContextImp::allocDeviceMem(ze_device_handle_t hDevice,
}
ze_result_t ContextImp::allocSharedMem(ze_device_handle_t hDevice,
ze_device_mem_alloc_flag_t deviceFlags,
ze_host_mem_alloc_flag_t hostFlags,
ze_device_mem_alloc_flags_t deviceFlags,
ze_host_mem_alloc_flags_t hostFlags,
size_t size,
size_t alignment,
void **ptr) {
@@ -100,7 +100,7 @@ ze_result_t ContextImp::openIpcMemHandle(ze_device_handle_t hDevice,
DEBUG_BREAK_IF(nullptr == this->driverHandle);
return this->driverHandle->openIpcMemHandle(hDevice,
handle,
ZE_IPC_MEMORY_FLAG_NONE,
ZE_IPC_MEMORY_FLAG_TBD,
ptr);
}
@@ -203,4 +203,24 @@ ze_result_t ContextImp::getVirtualMemAccessAttribute(const void *ptr,
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
ze_result_t ContextImp::openEventPoolIpcHandle(ze_ipc_event_pool_handle_t hIpc,
ze_event_pool_handle_t *phEventPool) {
DEBUG_BREAK_IF(nullptr == this->driverHandle);
return this->driverHandle->openEventPoolIpcHandle(hIpc, phEventPool);
}
ze_result_t ContextImp::createEventPool(const ze_event_pool_desc_t *desc,
uint32_t numDevices,
ze_device_handle_t *phDevices,
ze_event_pool_handle_t *phEventPool) {
DEBUG_BREAK_IF(nullptr == this->driverHandle);
return this->driverHandle->createEventPool(desc, numDevices, phDevices, phEventPool);
}
ze_result_t ContextImp::createImage(ze_device_handle_t hDevice,
const ze_image_desc_t *desc,
ze_image_handle_t *phImage) {
return L0::Device::fromHandle(hDevice)->createImage(desc, phImage);
}
} // namespace L0

View File

@@ -18,17 +18,17 @@ struct ContextImp : Context {
ze_result_t destroy() override;
ze_result_t getStatus() override;
DriverHandle *getDriverHandle() override;
ze_result_t allocHostMem(ze_host_mem_alloc_flag_t flags,
ze_result_t allocHostMem(ze_host_mem_alloc_flags_t flags,
size_t size,
size_t alignment,
void **ptr) override;
ze_result_t allocDeviceMem(ze_device_handle_t hDevice,
ze_device_mem_alloc_flag_t flags,
ze_device_mem_alloc_flags_t flags,
size_t size,
size_t alignment, void **ptr) override;
ze_result_t allocSharedMem(ze_device_handle_t hDevice,
ze_device_mem_alloc_flag_t deviceFlags,
ze_host_mem_alloc_flag_t hostFlags,
ze_device_mem_alloc_flags_t deviceFlags,
ze_host_mem_alloc_flags_t hostFlags,
size_t size,
size_t alignment,
void **ptr) override;
@@ -91,6 +91,15 @@ struct ContextImp : Context {
size_t size,
ze_memory_access_attribute_t *access,
size_t *outSize) override;
ze_result_t openEventPoolIpcHandle(ze_ipc_event_pool_handle_t hIpc,
ze_event_pool_handle_t *phEventPool) override;
ze_result_t createEventPool(const ze_event_pool_desc_t *desc,
uint32_t numDevices,
ze_device_handle_t *phDevices,
ze_event_pool_handle_t *phEventPool) override;
ze_result_t createImage(ze_device_handle_t hDevice,
const ze_image_desc_t *desc,
ze_image_handle_t *phImage) override;
protected:
DriverHandle *driverHandle = nullptr;