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,6 +9,6 @@
namespace L0 {
void DeviceImp::processAdditionalKernelProperties(NEO::HwHelper &hwHelper, ze_device_kernel_properties_t *pKernelProperties) {
void DeviceImp::processAdditionalKernelProperties(NEO::HwHelper &hwHelper, ze_device_module_properties_t *pKernelProperties) {
}
} // namespace L0

View File

@@ -139,7 +139,7 @@ std::unique_ptr<BuiltinFunctionsLibImpl::BuiltinData> BuiltinFunctionsLibImpl::l
ze_result_t res;
std::unique_ptr<Module> module;
ze_module_handle_t moduleHandle;
ze_module_desc_t moduleDesc = {ZE_MODULE_DESC_VERSION_CURRENT};
ze_module_desc_t moduleDesc = {};
moduleDesc.format = ZE_MODULE_FORMAT_NATIVE;
moduleDesc.pInputModule = reinterpret_cast<uint8_t *>(&builtInCode.resource[0]);
moduleDesc.inputSize = builtInCode.resource.size();
@@ -150,7 +150,7 @@ std::unique_ptr<BuiltinFunctionsLibImpl::BuiltinData> BuiltinFunctionsLibImpl::l
std::unique_ptr<Kernel> kernel;
ze_kernel_handle_t kernelHandle;
ze_kernel_desc_t kernelDesc = {ZE_KERNEL_DESC_VERSION_CURRENT};
ze_kernel_desc_t kernelDesc = {};
kernelDesc.pKernelName = builtInName;
res = module->createKernel(&kernelDesc, &kernelHandle);
DEBUG_BREAK_IF(res != ZE_RESULT_SUCCESS);

View File

@@ -16,8 +16,6 @@
#include <level_zero/ze_api.h>
#include <level_zero/zet_api.h>
#include "third_party/level_zero/zet_api_ext.h"
#include <vector>
struct _ze_command_list_handle_t {};
@@ -112,8 +110,6 @@ struct CommandList : _ze_command_list_handle_t {
virtual ze_result_t appendMetricMemoryBarrier() = 0;
virtual ze_result_t appendMetricStreamerMarker(zet_metric_streamer_handle_t hMetricStreamer,
uint32_t value) = 0;
virtual ze_result_t appendMetricTracerMarker(zet_metric_tracer_handle_t hMetricTracer,
uint32_t value) = 0;
virtual ze_result_t appendMetricQueryBegin(zet_metric_query_handle_t hMetricQuery) = 0;
virtual ze_result_t appendMetricQueryEnd(zet_metric_query_handle_t hMetricQuery, ze_event_handle_t hSignalEvent,
uint32_t numWaitEvents, ze_event_handle_t *phWaitEvents) = 0;

View File

@@ -61,7 +61,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::executeCommandListImmediate(bo
this->close();
ze_command_list_handle_t immediateHandle = this->toHandle();
this->cmdQImmediate->executeCommandLists(1, &immediateHandle, nullptr, performMigration);
this->cmdQImmediate->synchronize(std::numeric_limits<uint32_t>::max());
this->cmdQImmediate->synchronize(std::numeric_limits<uint64_t>::max());
this->reset();
return ZE_RESULT_SUCCESS;
@@ -1301,7 +1301,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendSignalEvent(ze_event_han
NEO::EncodeMiFlushDW<GfxFamily>::programMiFlushDw(*commandContainer.getCommandStream(), event->getGpuAddress(), Event::STATE_SIGNALED, false, true);
} else {
NEO::PipeControlArgs args;
args.dcFlushEnable = (event->signalScope == ZE_EVENT_SCOPE_FLAG_NONE) ? false : true;
args.dcFlushEnable = (!event->signalScope) ? false : true;
NEO::MemorySynchronizationCommands<GfxFamily>::addPipeControlAndProgramPostSyncOperation(
*commandContainer.getCommandStream(), POST_SYNC_OPERATION::POST_SYNC_OPERATION_WRITE_IMMEDIATE_DATA,
event->getGpuAddress(), Event::STATE_SIGNALED,
@@ -1336,7 +1336,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendWaitOnEvents(uint32_t nu
eventStateClear,
COMPARE_OPERATION::COMPARE_OPERATION_SAD_NOT_EQUAL_SDD);
bool dcFlushEnable = (event->waitScope == ZE_EVENT_SCOPE_FLAG_NONE) ? false : true;
bool dcFlushEnable = (!event->waitScope) ? false : true;
if (dcFlushEnable) {
if (isCopyOnlyCmdList) {
NEO::EncodeMiFlushDW<GfxFamily>::programMiFlushDw(*commandContainer.getCommandStream(), 0, 0, false, false);
@@ -1389,7 +1389,7 @@ void CommandListCoreFamily<gfxCoreFamily>::appendEventForProfiling(ze_event_hand
NEO::EncodeStoreMMIO<GfxFamily>::encode(*commandContainer.getCommandStream(),
GP_THREAD_TIME_REG_ADDRESS_OFFSET_LOW, contextEndAddr);
args.dcFlushEnable = (event->signalScope == ZE_EVENT_SCOPE_FLAG_NONE) ? false : true;
args.dcFlushEnable = (!event->signalScope) ? false : true;
if (args.dcFlushEnable) {
NEO::MemorySynchronizationCommands<GfxFamily>::addPipeControl(*commandContainer.getCommandStream(), args);
}

View File

@@ -40,14 +40,6 @@ ze_result_t CommandListImp::appendMetricStreamerMarker(zet_metric_streamer_handl
return MetricQuery::appendStreamerMarker(*this, hMetricStreamer, value);
}
ze_result_t CommandListImp::appendMetricTracerMarker(zet_metric_tracer_handle_t hMetricTracer,
uint32_t value) {
zet_metric_streamer_handle_t hMetricStreamer = reinterpret_cast<zet_metric_streamer_handle_t>(hMetricTracer);
return MetricQuery::appendStreamerMarker(*this, hMetricStreamer, value);
}
ze_result_t CommandListImp::appendMetricQueryBegin(zet_metric_query_handle_t hMetricQuery) {
return MetricQuery::fromHandle(hMetricQuery)->appendBegin(*this);
}

View File

@@ -20,8 +20,6 @@ struct CommandListImp : CommandList {
ze_result_t appendMetricMemoryBarrier() override;
ze_result_t appendMetricStreamerMarker(zet_metric_streamer_handle_t hMetricStreamer,
uint32_t value) override;
ze_result_t appendMetricTracerMarker(zet_metric_tracer_handle_t hMetricTracer,
uint32_t value) override;
ze_result_t appendMetricQueryBegin(zet_metric_query_handle_t hMetricQuery) override;
ze_result_t appendMetricQueryEnd(zet_metric_query_handle_t hMetricQuery, ze_event_handle_t hSignalEvent,
uint32_t numWaitEvents, ze_event_handle_t *phWaitEvents) override;

View File

@@ -60,15 +60,15 @@ void CommandQueueImp::submitBatchBuffer(size_t offset, NEO::ResidencyContainer &
buffers.setCurrentFlushStamp(csr->obtainCurrentFlushStamp());
}
ze_result_t CommandQueueImp::synchronize(uint32_t timeout) {
ze_result_t CommandQueueImp::synchronize(uint64_t timeout) {
return synchronizeByPollingForTaskCount(timeout);
}
ze_result_t CommandQueueImp::synchronizeByPollingForTaskCount(uint32_t timeout) {
ze_result_t CommandQueueImp::synchronizeByPollingForTaskCount(uint64_t timeout) {
UNRECOVERABLE_IF(csr == nullptr);
auto taskCountToWait = this->taskCount;
bool enableTimeout = (timeout != std::numeric_limits<uint32_t>::max());
bool enableTimeout = (timeout != std::numeric_limits<uint64_t>::max());
csr->waitForCompletionWithTimeout(enableTimeout, timeout, this->taskCount);
if (*csr->getTagAddress() < taskCountToWait) {

View File

@@ -8,8 +8,7 @@
#pragma once
#include "level_zero/core/source/device/device.h"
#include <level_zero/ze_common.h>
#include <level_zero/ze_fence.h>
#include <level_zero/ze_api.h>
#include <atomic>
@@ -39,7 +38,7 @@ struct CommandQueue : _ze_command_queue_handle_t {
virtual ze_result_t executeCommands(uint32_t numCommands,
void *phCommands,
ze_fence_handle_t hFence) = 0;
virtual ze_result_t synchronize(uint32_t timeout) = 0;
virtual ze_result_t synchronize(uint64_t timeout) = 0;
static CommandQueue *create(uint32_t productFamily, Device *device, NEO::CommandStreamReceiver *csr,
const ze_command_queue_desc_t *desc, bool isCopyOnly);

View File

@@ -339,7 +339,7 @@ ze_result_t CommandQueueHw<gfxCoreFamily>::executeCommandLists(
csr->makeSurfacePackNonResident(residencyContainer);
if (getSynchronousMode() == ZE_COMMAND_QUEUE_MODE_SYNCHRONOUS) {
this->synchronize(std::numeric_limits<uint32_t>::max());
this->synchronize(std::numeric_limits<uint64_t>::max());
}
return ZE_RESULT_SUCCESS;

View File

@@ -66,7 +66,7 @@ struct CommandQueueImp : public CommandQueue {
ze_result_t destroy() override;
ze_result_t synchronize(uint32_t timeout) override;
ze_result_t synchronize(uint64_t timeout) override;
void initialize(bool copyOnly);
@@ -83,7 +83,7 @@ struct CommandQueueImp : public CommandQueue {
protected:
void submitBatchBuffer(size_t offset, NEO::ResidencyContainer &residencyContainer, void *endingCmdPtr);
ze_result_t synchronizeByPollingForTaskCount(uint32_t timeout);
ze_result_t synchronizeByPollingForTaskCount(uint64_t timeout);
void printFunctionsPrintfOutput();

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;

View File

@@ -19,8 +19,6 @@
#include <level_zero/ze_api.h>
#include <level_zero/zet_api.h>
#include "third_party/level_zero/ze_api_ext.h"
struct _ze_device_handle_t {};
namespace NEO {
class Device;
@@ -59,15 +57,15 @@ struct Device : _ze_device_handle_t {
virtual ze_result_t getComputeProperties(ze_device_compute_properties_t *pComputeProperties) = 0;
virtual ze_result_t getP2PProperties(ze_device_handle_t hPeerDevice,
ze_device_p2p_properties_t *pP2PProperties) = 0;
virtual ze_result_t getKernelProperties(ze_device_kernel_properties_t *pKernelProperties) = 0;
virtual ze_result_t getKernelProperties(ze_device_module_properties_t *pKernelProperties) = 0;
virtual ze_result_t getMemoryProperties(uint32_t *pCount, ze_device_memory_properties_t *pMemProperties) = 0;
virtual ze_result_t getMemoryAccessProperties(ze_device_memory_access_properties_t *pMemAccessProperties) = 0;
virtual ze_result_t getProperties(ze_device_properties_t *pDeviceProperties) = 0;
virtual ze_result_t getSubDevices(uint32_t *pCount, ze_device_handle_t *phSubdevices) = 0;
virtual ze_result_t makeImageResident(ze_image_handle_t hImage) = 0;
virtual ze_result_t makeMemoryResident(void *ptr, size_t size) = 0;
virtual ze_result_t setIntermediateCacheConfig(ze_cache_config_t cacheConfig) = 0;
virtual ze_result_t setLastLevelCacheConfig(ze_cache_config_t cacheConfig) = 0;
virtual ze_result_t setIntermediateCacheConfig(ze_cache_config_flags_t cacheConfig) = 0;
virtual ze_result_t setLastLevelCacheConfig(ze_cache_config_flags_t cacheConfig) = 0;
virtual ze_result_t getCacheProperties(ze_device_cache_properties_t *pCacheProperties) = 0;
virtual ze_result_t imageGetProperties(const ze_image_desc_t *desc, ze_image_properties_t *pImageProperties) = 0;
virtual ze_result_t getDeviceImageProperties(ze_device_image_properties_t *pDeviceImageProperties) = 0;

View File

@@ -86,9 +86,8 @@ ze_result_t DeviceImp::createCommandList(const ze_command_list_desc_t *desc,
ze_command_list_handle_t *commandList) {
auto productFamily = neoDevice->getHardwareInfo().platform.eProductFamily;
bool useBliter = false;
auto ret = isCreatedCommandListCopyOnly(desc, &useBliter, ZE_COMMAND_LIST_FLAG_COPY_ONLY);
if (ret != ZE_RESULT_SUCCESS) {
return ret;
if (desc->commandQueueGroupOrdinal == static_cast<uint32_t>(NEO::EngineGroupType::Copy)) {
useBliter = true;
}
*commandList = CommandList::create(productFamily, this, useBliter);
@@ -100,11 +99,9 @@ ze_result_t DeviceImp::createCommandListImmediate(const ze_command_queue_desc_t
auto productFamily = neoDevice->getHardwareInfo().platform.eProductFamily;
bool useBliter = false;
auto ret = isCreatedCommandListCopyOnly(desc, &useBliter, ZE_COMMAND_QUEUE_FLAG_COPY_ONLY);
if (ret != ZE_RESULT_SUCCESS) {
return ret;
if (desc->ordinal == static_cast<uint32_t>(NEO::EngineGroupType::Copy)) {
useBliter = true;
}
*phCommandList = CommandList::createImmediate(productFamily, this, desc, false, useBliter);
return ZE_RESULT_SUCCESS;
@@ -116,27 +113,26 @@ ze_result_t DeviceImp::createCommandQueue(const ze_command_queue_desc_t *desc,
NEO::CommandStreamReceiver *csr = nullptr;
bool useBliter = false;
auto ret = isCreatedCommandListCopyOnly(desc, &useBliter, ZE_COMMAND_QUEUE_FLAG_COPY_ONLY);
if (ret != ZE_RESULT_SUCCESS) {
return ret;
}
if (useBliter) {
if (desc->ordinal == static_cast<uint32_t>(NEO::EngineGroupType::Copy)) {
auto &selectorCopyEngine = this->neoDevice->getDeviceById(0)->getSelectorCopyEngine();
csr = this->neoDevice->getDeviceById(0)->getEngine(NEO::EngineHelpers::getBcsEngineType(neoDevice->getHardwareInfo(), selectorCopyEngine), false).commandStreamReceiver;
useBliter = true;
} else {
const auto &hardwareInfo = this->neoDevice->getHardwareInfo();
auto &hwHelper = NEO::HwHelper::get(hardwareInfo.platform.eRenderCoreFamily);
if (desc->ordinal >= NEO::HwHelper::getEnginesCount(this->getNEODevice()->getHardwareInfo())) {
if (desc->ordinal >= static_cast<uint32_t>(NEO::EngineGroupType::MaxEngineGroups)) {
return ZE_RESULT_ERROR_INVALID_ARGUMENT;
}
uint32_t engineIndex = hwHelper.getComputeEngineIndexByOrdinal(hardwareInfo, desc->ordinal);
if (this->getNEODevice()->getNumAvailableDevices() > 1) {
csr = this->neoDevice->getDeviceById(0)->getEngine(engineIndex).commandStreamReceiver;
if (desc->index >= this->neoDevice->getDeviceById(0)->getEngineGroups()[desc->ordinal].size()) {
return ZE_RESULT_ERROR_INVALID_ARGUMENT;
}
csr = this->neoDevice->getDeviceById(0)->getEngineGroups()[desc->ordinal][desc->index].commandStreamReceiver;
} else {
csr = this->neoDevice->getEngine(engineIndex).commandStreamReceiver;
if (desc->index >= this->neoDevice->getEngineGroups()[desc->ordinal].size()) {
return ZE_RESULT_ERROR_INVALID_ARGUMENT;
}
csr = this->neoDevice->getEngineGroups()[desc->ordinal][desc->index].commandStreamReceiver;
}
UNRECOVERABLE_IF(csr == nullptr);
@@ -266,9 +262,7 @@ ze_result_t DeviceImp::getComputeProperties(ze_device_compute_properties_t *pCom
ze_result_t DeviceImp::getP2PProperties(ze_device_handle_t hPeerDevice,
ze_device_p2p_properties_t *pP2PProperties) {
pP2PProperties->accessSupported = true;
pP2PProperties->atomicsSupported = false;
pP2PProperties->flags = 0;
return ZE_RESULT_SUCCESS;
}
@@ -297,28 +291,26 @@ ze_result_t DeviceImp::getMemoryProperties(uint32_t *pCount, ze_device_memory_pr
ze_result_t DeviceImp::getMemoryAccessProperties(ze_device_memory_access_properties_t *pMemAccessProperties) {
pMemAccessProperties->hostAllocCapabilities =
static_cast<ze_memory_access_capabilities_t>(ZE_MEMORY_ACCESS | ZE_MEMORY_ATOMIC_ACCESS);
ZE_MEMORY_ACCESS_CAP_FLAG_RW | ZE_MEMORY_ACCESS_CAP_FLAG_ATOMIC;
pMemAccessProperties->deviceAllocCapabilities =
static_cast<ze_memory_access_capabilities_t>(ZE_MEMORY_ACCESS | ZE_MEMORY_ATOMIC_ACCESS);
ZE_MEMORY_ACCESS_CAP_FLAG_RW | ZE_MEMORY_ACCESS_CAP_FLAG_ATOMIC;
pMemAccessProperties->sharedSingleDeviceAllocCapabilities =
static_cast<ze_memory_access_capabilities_t>(ZE_MEMORY_ACCESS | ZE_MEMORY_ATOMIC_ACCESS);
pMemAccessProperties->sharedCrossDeviceAllocCapabilities =
ze_memory_access_capabilities_t{};
pMemAccessProperties->sharedSystemAllocCapabilities =
ze_memory_access_capabilities_t{};
ZE_MEMORY_ACCESS_CAP_FLAG_RW | ZE_MEMORY_ACCESS_CAP_FLAG_ATOMIC;
pMemAccessProperties->sharedCrossDeviceAllocCapabilities = 0;
pMemAccessProperties->sharedSystemAllocCapabilities = 0;
return ZE_RESULT_SUCCESS;
}
static constexpr ze_fp_capabilities_t defaultFpFlags = static_cast<ze_fp_capabilities_t>(ZE_FP_CAPS_ROUND_TO_NEAREST |
ZE_FP_CAPS_ROUND_TO_ZERO |
ZE_FP_CAPS_ROUND_TO_INF |
ZE_FP_CAPS_INF_NAN |
ZE_FP_CAPS_DENORM |
ZE_FP_CAPS_FMA);
static constexpr ze_device_fp_flags_t defaultFpFlags = static_cast<ze_device_fp_flags_t>(ZE_DEVICE_FP_FLAG_ROUND_TO_NEAREST |
ZE_DEVICE_FP_FLAG_ROUND_TO_ZERO |
ZE_DEVICE_FP_FLAG_ROUND_TO_INF |
ZE_DEVICE_FP_FLAG_INF_NAN |
ZE_DEVICE_FP_FLAG_DENORM |
ZE_DEVICE_FP_FLAG_FMA);
ze_result_t DeviceImp::getKernelProperties(ze_device_kernel_properties_t *pKernelProperties) {
memset(pKernelProperties, 0, sizeof(ze_device_kernel_properties_t));
ze_result_t DeviceImp::getKernelProperties(ze_device_module_properties_t *pKernelProperties) {
memset(pKernelProperties, 0, sizeof(ze_device_module_properties_t));
const auto &hardwareInfo = this->neoDevice->getHardwareInfo();
const auto &deviceInfo = this->neoDevice->getDeviceInfo();
auto &hwHelper = NEO::HwHelper::get(hardwareInfo.platform.eRenderCoreFamily);
@@ -336,18 +328,23 @@ ze_result_t DeviceImp::getKernelProperties(ze_device_kernel_properties_t *pKerne
return ZE_RESULT_ERROR_UNKNOWN;
}
pKernelProperties->fp16Supported = true;
pKernelProperties->int64AtomicsSupported = hardwareInfo.capabilityTable.ftrSupportsInteger64BitAtomics;
pKernelProperties->halfFpCapabilities = defaultFpFlags;
pKernelProperties->flags = ZE_DEVICE_MODULE_FLAG_FP16;
if (hardwareInfo.capabilityTable.ftrSupportsInteger64BitAtomics) {
pKernelProperties->flags |= ZE_DEVICE_MODULE_FLAG_INT64_ATOMICS;
}
pKernelProperties->fp16flags = defaultFpFlags;
pKernelProperties->fp32flags = defaultFpFlags;
if (NEO::DebugManager.flags.OverrideDefaultFP64Settings.get() == 1) {
pKernelProperties->fp64Supported = true;
pKernelProperties->singleFpCapabilities = ZE_FP_CAPS_ROUNDED_DIVIDE_SQRT;
pKernelProperties->doubleFpCapabilities = defaultFpFlags;
pKernelProperties->fp64flags = defaultFpFlags | ZE_DEVICE_FP_FLAG_ROUNDED_DIVIDE_SQRT;
} else {
pKernelProperties->fp64Supported = hardwareInfo.capabilityTable.ftrSupportsFP64;
pKernelProperties->singleFpCapabilities = hardwareInfo.capabilityTable.ftrSupports64BitMath ? ZE_FP_CAPS_ROUNDED_DIVIDE_SQRT : ZE_FP_CAPS_NONE;
pKernelProperties->doubleFpCapabilities = hardwareInfo.capabilityTable.ftrSupportsFP64 ? defaultFpFlags : ZE_FP_CAPS_NONE;
pKernelProperties->fp64flags = 0;
if (hardwareInfo.capabilityTable.ftrSupportsFP64) {
pKernelProperties->fp64flags |= defaultFpFlags;
if (hardwareInfo.capabilityTable.ftrSupports64BitMath) {
pKernelProperties->fp64flags |= ZE_DEVICE_FP_FLAG_ROUNDED_DIVIDE_SQRT;
}
}
}
pKernelProperties->nativeKernelSupported.id[0] = 0;
@@ -372,6 +369,8 @@ ze_result_t DeviceImp::getProperties(ze_device_properties_t *pDeviceProperties)
pDeviceProperties->deviceId = hardwareInfo.platform.usDeviceID;
pDeviceProperties->flags = 0u;
uint32_t rootDeviceIndex = this->neoDevice->getRootDeviceIndex();
memset(pDeviceProperties->uuid.id, 0, ZE_MAX_DEVICE_UUID_SIZE);
@@ -379,23 +378,13 @@ ze_result_t DeviceImp::getProperties(ze_device_properties_t *pDeviceProperties)
memcpy_s(pDeviceProperties->uuid.id + sizeof(uint32_t), sizeof(uint32_t), &pDeviceProperties->deviceId, sizeof(pDeviceProperties->deviceId));
memcpy_s(pDeviceProperties->uuid.id + (2 * sizeof(uint32_t)), sizeof(uint32_t), &rootDeviceIndex, sizeof(rootDeviceIndex));
pDeviceProperties->isSubdevice = isSubdevice;
pDeviceProperties->subdeviceId = isSubdevice ? static_cast<NEO::SubDevice *>(neoDevice)->getSubDeviceIndex() : 0;
pDeviceProperties->coreClockRate = deviceInfo.maxClockFrequency;
pDeviceProperties->unifiedMemorySupported = true;
pDeviceProperties->eccMemorySupported = this->neoDevice->getDeviceInfo().errorCorrectionSupport;
pDeviceProperties->onDemandPageFaultsSupported = hardwareInfo.capabilityTable.supportsOnDemandPageFaults;
pDeviceProperties->maxCommandQueues = 1;
pDeviceProperties->numAsyncComputeEngines = NEO::HwHelper::getEnginesCount(hardwareInfo);
pDeviceProperties->numAsyncCopyEngines = NEO::HwHelper::getCopyEnginesCount(hardwareInfo);
if (hardwareInfo.capabilityTable.supportsOnDemandPageFaults) {
pDeviceProperties->flags |= ZE_DEVICE_PROPERTY_FLAG_ONDEMANDPAGING;
}
pDeviceProperties->maxCommandQueuePriority = 0;
@@ -459,29 +448,18 @@ ze_result_t DeviceImp::makeMemoryResident(void *ptr, size_t size) {
return changeMemoryOperationStatusToL0ResultType(success);
}
ze_result_t DeviceImp::setIntermediateCacheConfig(ze_cache_config_t cacheConfig) {
ze_result_t DeviceImp::setIntermediateCacheConfig(ze_cache_config_flags_t cacheConfig) {
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
ze_result_t DeviceImp::setLastLevelCacheConfig(ze_cache_config_t cacheConfig) {
ze_result_t DeviceImp::setLastLevelCacheConfig(ze_cache_config_flags_t cacheConfig) {
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
ze_result_t DeviceImp::getCacheProperties(ze_device_cache_properties_t *pCacheProperties) {
const auto &hardwareInfo = this->getHwInfo();
auto &hwHelper = NEO::HwHelper::get(hardwareInfo.platform.eRenderCoreFamily);
pCacheProperties->intermediateCacheControlSupported = false;
pCacheProperties->intermediateCacheSize = getIntermediateCacheSize(hardwareInfo);
pCacheProperties->intermediateCachelineSize = 0;
pCacheProperties->lastLevelCacheSizeControlSupported = hwHelper.isL3Configurable(hardwareInfo);
pCacheProperties->lastLevelCacheSize = static_cast<size_t>(hardwareInfo.gtSystemInfo.L3CacheSizeInKb * KB);
pCacheProperties->lastLevelCachelineSize = this->neoDevice->getDeviceInfo().globalMemCachelineSize;
pCacheProperties->cacheSize = getIntermediateCacheSize(hardwareInfo);
pCacheProperties->flags = 0;
return ZE_RESULT_SUCCESS;
}
@@ -491,9 +469,9 @@ ze_result_t DeviceImp::imageGetProperties(const ze_image_desc_t *desc,
const auto &deviceInfo = this->neoDevice->getDeviceInfo();
if (deviceInfo.imageSupport) {
pImageProperties->samplerFilterFlags = ZE_IMAGE_SAMPLER_FILTER_FLAGS_LINEAR;
pImageProperties->samplerFilterFlags = ZE_IMAGE_SAMPLER_FILTER_FLAG_LINEAR;
} else {
pImageProperties->samplerFilterFlags = ZE_IMAGE_SAMPLER_FILTER_FLAGS_NONE;
pImageProperties->samplerFilterFlags = 0;
}
return ZE_RESULT_SUCCESS;
@@ -502,7 +480,6 @@ ze_result_t DeviceImp::imageGetProperties(const ze_image_desc_t *desc,
ze_result_t DeviceImp::getDeviceImageProperties(ze_device_image_properties_t *pDeviceImageProperties) {
const auto &deviceInfo = this->neoDevice->getDeviceInfo();
pDeviceImageProperties->supported = deviceInfo.imageSupport;
pDeviceImageProperties->maxImageDims1D = static_cast<uint32_t>(deviceInfo.image2DMaxWidth);
pDeviceImageProperties->maxImageDims2D = static_cast<uint32_t>(deviceInfo.image2DMaxHeight);
pDeviceImageProperties->maxImageDims3D = static_cast<uint32_t>(deviceInfo.image3DMaxDepth);
@@ -567,47 +544,12 @@ ze_result_t DeviceImp::registerCLMemory(cl_context context, cl_mem mem, void **p
ze_result_t DeviceImp::registerCLProgram(cl_context context, cl_program program,
ze_module_handle_t *phModule) {
NEO::Program *neoProgram = static_cast<NEO::Program *>(program);
if (neoProgram->getIsSpirV()) {
size_t deviceBinarySize = 0;
if (0 != neoProgram->getInfo(CL_PROGRAM_BINARY_SIZES, sizeof(deviceBinarySize), &deviceBinarySize, nullptr)) {
return ZE_RESULT_ERROR_INVALID_ARGUMENT;
}
std::vector<uint8_t> deviceBinary;
deviceBinary.resize(deviceBinarySize);
auto deviceBinaryPtr = deviceBinary.data();
if (0 != neoProgram->getInfo(CL_PROGRAM_BINARIES, sizeof(void *), &deviceBinaryPtr, nullptr)) {
return ZE_RESULT_ERROR_INVALID_ARGUMENT;
}
ze_module_desc_t module_desc;
module_desc.version = ZE_MODULE_DESC_VERSION_CURRENT;
module_desc.format = ZE_MODULE_FORMAT_NATIVE;
module_desc.inputSize = deviceBinarySize;
module_desc.pInputModule = deviceBinary.data();
module_desc.pBuildFlags = nullptr;
return createModule(&module_desc, phModule, nullptr);
} else {
return ZE_RESULT_ERROR_INVALID_ARGUMENT;
}
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
ze_result_t DeviceImp::registerCLCommandQueue(cl_context context, cl_command_queue commandQueue,
ze_command_queue_handle_t *phCommandQueue) {
ze_command_queue_desc_t desc;
desc.version = ZE_COMMAND_QUEUE_DESC_VERSION_CURRENT;
desc.flags = ZE_COMMAND_QUEUE_FLAG_NONE;
desc.mode = ZE_COMMAND_QUEUE_MODE_DEFAULT;
desc.priority = ZE_COMMAND_QUEUE_PRIORITY_NORMAL;
auto productFamily = neoDevice->getHardwareInfo().platform.eProductFamily;
auto csr = neoDevice->getDefaultEngine().commandStreamReceiver;
*phCommandQueue = CommandQueue::create(productFamily, this, csr, &desc, false);
return ZE_RESULT_SUCCESS;
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
const NEO::HardwareInfo &DeviceImp::getHwInfo() const { return neoDevice->getHardwareInfo(); }
@@ -684,7 +626,6 @@ Device *Device::create(DriverHandle *driverHandle, NEO::Device *neoDevice, uint3
if (supportDualStorageSharedMemory) {
ze_command_queue_desc_t cmdQueueDesc;
cmdQueueDesc.version = ZE_COMMAND_QUEUE_DESC_VERSION_CURRENT;
cmdQueueDesc.ordinal = 0;
cmdQueueDesc.mode = ZE_COMMAND_QUEUE_MODE_SYNCHRONOUS;
device->pageFaultCommandList =

View File

@@ -34,15 +34,15 @@ struct DeviceImp : public Device {
ze_result_t getComputeProperties(ze_device_compute_properties_t *pComputeProperties) override;
ze_result_t getP2PProperties(ze_device_handle_t hPeerDevice,
ze_device_p2p_properties_t *pP2PProperties) override;
ze_result_t getKernelProperties(ze_device_kernel_properties_t *pKernelProperties) override;
ze_result_t getKernelProperties(ze_device_module_properties_t *pKernelProperties) override;
ze_result_t getMemoryProperties(uint32_t *pCount, ze_device_memory_properties_t *pMemProperties) override;
ze_result_t getMemoryAccessProperties(ze_device_memory_access_properties_t *pMemAccessProperties) override;
ze_result_t getProperties(ze_device_properties_t *pDeviceProperties) override;
ze_result_t getSubDevices(uint32_t *pCount, ze_device_handle_t *phSubdevices) override;
ze_result_t makeImageResident(ze_image_handle_t hImage) override;
ze_result_t makeMemoryResident(void *ptr, size_t size) override;
ze_result_t setIntermediateCacheConfig(ze_cache_config_t cacheConfig) override;
ze_result_t setLastLevelCacheConfig(ze_cache_config_t cacheConfig) override;
ze_result_t setIntermediateCacheConfig(ze_cache_config_flags_t cacheConfig) override;
ze_result_t setLastLevelCacheConfig(ze_cache_config_flags_t cacheConfig) override;
ze_result_t getCacheProperties(ze_device_cache_properties_t *pCacheProperties) override;
ze_result_t imageGetProperties(const ze_image_desc_t *desc, ze_image_properties_t *pImageProperties) override;
ze_result_t getDeviceImageProperties(ze_device_image_properties_t *pDeviceImageProperties) override;
@@ -73,7 +73,7 @@ struct DeviceImp : public Device {
const NEO::DeviceInfo &getDeviceInfo() const override;
NEO::Device *getNEODevice() override;
void activateMetricGroups() override;
void processAdditionalKernelProperties(NEO::HwHelper &hwHelper, ze_device_kernel_properties_t *pKernelProperties);
void processAdditionalKernelProperties(NEO::HwHelper &hwHelper, ze_device_module_properties_t *pKernelProperties);
NEO::GraphicsAllocation *getDebugSurface() const override { return debugSurface; }
void setDebugSurface(NEO::GraphicsAllocation *debugSurface) { this->debugSurface = debugSurface; };
~DeviceImp() override;

View File

@@ -78,7 +78,7 @@ void DriverImp::initialize(ze_result_t *result) {
ze_result_t DriverImp::initStatus(ZE_RESULT_ERROR_UNINITIALIZED);
ze_result_t DriverImp::driverInit(ze_init_flag_t flag) {
ze_result_t DriverImp::driverInit(ze_init_flags_t flags) {
std::call_once(initDriverOnce, [this]() {
ze_result_t result;
this->initialize(&result);
@@ -111,6 +111,6 @@ ze_result_t driverHandleGet(uint32_t *pCount, ze_driver_handle_t *phDriverHandle
static DriverImp driverImp;
Driver *Driver::driver = &driverImp;
ze_result_t init(ze_init_flag_t flag) { return Driver::get()->driverInit(flag); }
ze_result_t init(ze_init_flags_t flags) { return Driver::get()->driverInit(flags); }
} // namespace L0

View File

@@ -13,7 +13,7 @@
namespace L0 {
struct Driver {
virtual ze_result_t driverInit(_ze_init_flag_t) = 0;
virtual ze_result_t driverInit(ze_init_flags_t flags) = 0;
virtual void initialize(ze_result_t *result) = 0;
static Driver *get() { return driver; }
virtual ~Driver() = default;
@@ -22,7 +22,7 @@ struct Driver {
static Driver *driver;
};
ze_result_t init(_ze_init_flag_t);
ze_result_t init(ze_init_flags_t);
ze_result_t driverHandleGet(uint32_t *pCount, ze_driver_handle_t *phDrivers);
extern uint32_t driverCount;

View File

@@ -13,8 +13,6 @@
#include "level_zero/core/source/device/device.h"
#include <level_zero/ze_api.h>
#include "third_party/level_zero/ze_api_ext.h"
struct _ze_driver_handle_t {
virtual ~_ze_driver_handle_t() = default;
};
@@ -37,13 +35,13 @@ struct DriverHandle : _ze_driver_handle_t {
ze_memory_allocation_properties_t *pMemAllocProperties,
ze_device_handle_t *phDevice) = 0;
virtual ze_result_t allocHostMem(ze_host_mem_alloc_flag_t flags, size_t size, size_t alignment, void **ptr) = 0;
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, size_t size,
virtual ze_result_t allocDeviceMem(ze_device_handle_t hDevice, 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, size_t size, size_t alignment,
virtual ze_result_t allocSharedMem(ze_device_handle_t hDevice, ze_device_mem_alloc_flags_t deviceFlags,
ze_host_mem_alloc_flags_t hostFlags, size_t size, size_t alignment,
void **ptr) = 0;
virtual ze_result_t freeMem(const void *ptr) = 0;
virtual NEO::MemoryManager *getMemoryManager() = 0;

View File

@@ -69,8 +69,8 @@ ze_result_t DriverHandleImp::getProperties(ze_driver_properties_t *properties) {
}
ze_result_t DriverHandleImp::getIPCProperties(ze_driver_ipc_properties_t *pIPCProperties) {
pIPCProperties->eventsSupported = false;
pIPCProperties->memsSupported = true;
pIPCProperties->flags = ZE_IPC_PROPERTY_FLAG_MEMORY;
return ZE_RESULT_SUCCESS;
}

View File

@@ -10,6 +10,7 @@
#include "shared/source/os_interface/os_library.h"
#include "level_zero/core/source/driver/driver_handle.h"
#include "level_zero/core/source/event/event.h"
#include "level_zero/core/source/get_extension_function_lookup_map.h"
namespace L0 {
@@ -28,13 +29,13 @@ struct DriverHandleImp : public DriverHandle {
ze_memory_allocation_properties_t *pMemAllocProperties,
ze_device_handle_t *phDevice) override;
ze_result_t allocHostMem(ze_host_mem_alloc_flag_t flags, size_t size, size_t alignment, void **ptr) override;
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, size_t size,
ze_result_t allocDeviceMem(ze_device_handle_t hDevice, 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, size_t size, size_t alignment,
ze_result_t allocSharedMem(ze_device_handle_t hDevice, ze_device_mem_alloc_flags_t deviceFlags,
ze_host_mem_alloc_flags_t hostFlags, size_t size, size_t alignment,
void **ptr) override;
ze_result_t getMemAddressRange(const void *ptr, void **pBase, size_t *pSize) override;

View File

@@ -16,7 +16,7 @@ namespace L0 {
class DriverImp : public Driver {
public:
ze_result_t driverInit(_ze_init_flag_t) override;
ze_result_t driverInit(ze_init_flags_t flags) override;
void initialize(ze_result_t *result) override;

View File

@@ -36,7 +36,7 @@ struct EventImp : public Event {
ze_result_t hostSignal() override;
ze_result_t hostSynchronize(uint32_t timeout) override;
ze_result_t hostSynchronize(uint64_t timeout) override;
ze_result_t queryStatus() override {
uint64_t *hostAddr = static_cast<uint64_t *>(hostAddress);
@@ -62,8 +62,6 @@ struct EventImp : public Event {
ze_result_t reset() override;
ze_result_t getTimestamp(ze_event_timestamp_type_t timestampType, void *dstptr) override;
ze_result_t queryKernelTimestamp(ze_kernel_timestamp_result_t *dstptr) override;
Device *device;
@@ -76,8 +74,8 @@ struct EventImp : public Event {
};
struct EventPoolImp : public EventPool {
EventPoolImp(DriverHandle *driver, uint32_t numDevices, ze_device_handle_t *phDevices, uint32_t numEvents, ze_event_pool_flag_t flags) : numEvents(numEvents) {
if (flags & ZE_EVENT_POOL_FLAG_TIMESTAMP) {
EventPoolImp(DriverHandle *driver, uint32_t numDevices, ze_device_handle_t *phDevices, uint32_t numEvents, ze_event_pool_flags_t flags) : numEvents(numEvents) {
if (flags & ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP) {
isEventPoolUsedForTimestamp = true;
}
ze_device_handle_t hDevice;
@@ -205,7 +203,7 @@ ze_result_t EventImp::hostEventSetValueTimestamps(uint32_t eventVal) {
auto eventTsSetFunc = [&](auto tsAddr) {
auto tsptr = reinterpret_cast<void *>(tsAddr);
memcpy_s(tsptr, sizeof(uint32_t), static_cast<void *>(&eventVal), sizeof(uint32_t));
if (signalScopeFlag != ZE_EVENT_SCOPE_FLAG_NONE) {
if (!signalScopeFlag) {
NEO::CpuIntrinsics::clFlush(tsptr);
}
};
@@ -231,7 +229,7 @@ ze_result_t EventImp::hostEventSetValue(uint32_t eventVal) {
makeAllocationResident();
if (this->signalScope != ZE_EVENT_SCOPE_FLAG_NONE) {
if (!this->signalScope) {
NEO::CpuIntrinsics::clFlush(hostAddr);
}
@@ -242,9 +240,9 @@ ze_result_t EventImp::hostSignal() {
return hostEventSetValue(Event::STATE_SIGNALED);
}
ze_result_t EventImp::hostSynchronize(uint32_t timeout) {
ze_result_t EventImp::hostSynchronize(uint64_t timeout) {
std::chrono::high_resolution_clock::time_point time1, time2;
int64_t timeDiff = 0;
uint64_t timeDiff = 0;
ze_result_t ret = ZE_RESULT_NOT_READY;
if (this->csr->getType() == NEO::CommandStreamReceiverType::CSR_AUB) {
@@ -284,39 +282,6 @@ ze_result_t EventImp::reset() {
return hostEventSetValue(Event::STATE_INITIAL);
}
ze_result_t EventImp::getTimestamp(ze_event_timestamp_type_t timestampType, void *dstptr) {
auto baseAddr = reinterpret_cast<uint64_t>(hostAddress);
uint64_t tsAddr = 0u;
constexpr uint64_t tsMask = (1ull << 32) - 1;
uint64_t tsData = Event::STATE_INITIAL & tsMask;
if (!this->isTimestampEvent)
return ZE_RESULT_ERROR_INVALID_ARGUMENT;
// Ensure timestamps have been written
if (queryStatus() != ZE_RESULT_SUCCESS) {
memcpy_s(dstptr, sizeof(uint64_t), static_cast<void *>(&tsData), sizeof(uint64_t));
return ZE_RESULT_SUCCESS;
}
if (timestampType == ZE_EVENT_TIMESTAMP_CONTEXT_START) {
tsAddr = baseAddr + offsetof(KernelTimestampEvent, contextStart);
} else if (timestampType == ZE_EVENT_TIMESTAMP_GLOBAL_START) {
tsAddr = baseAddr + offsetof(KernelTimestampEvent, globalStart);
} else if (timestampType == ZE_EVENT_TIMESTAMP_CONTEXT_END) {
tsAddr = baseAddr + offsetof(KernelTimestampEvent, contextEnd);
} else {
tsAddr = baseAddr + offsetof(KernelTimestampEvent, globalEnd);
}
memcpy_s(static_cast<void *>(&tsData), sizeof(uint32_t), reinterpret_cast<void *>(tsAddr), sizeof(uint32_t));
tsData &= tsMask;
memcpy_s(dstptr, sizeof(uint64_t), static_cast<void *>(&tsData), sizeof(uint64_t));
return ZE_RESULT_SUCCESS;
}
ze_result_t EventImp::queryKernelTimestamp(ze_kernel_timestamp_result_t *dstptr) {
auto baseAddr = reinterpret_cast<uint64_t>(hostAddress);
constexpr uint64_t tsMask = (1ull << 32) - 1;

View File

@@ -10,7 +10,7 @@
#include "level_zero/core/source/cmdlist/cmdlist.h"
#include "level_zero/core/source/device/device.h"
#include "level_zero/core/source/driver/driver_handle.h"
#include <level_zero/ze_event.h>
#include <level_zero/ze_api.h>
struct _ze_event_handle_t {};
@@ -25,10 +25,9 @@ struct Event : _ze_event_handle_t {
virtual ~Event() = default;
virtual ze_result_t destroy();
virtual ze_result_t hostSignal() = 0;
virtual ze_result_t hostSynchronize(uint32_t timeout) = 0;
virtual ze_result_t hostSynchronize(uint64_t timeout) = 0;
virtual ze_result_t queryStatus() = 0;
virtual ze_result_t reset() = 0;
virtual ze_result_t getTimestamp(ze_event_timestamp_type_t timestampType, void *dstptr) = 0;
virtual ze_result_t queryKernelTimestamp(ze_kernel_timestamp_result_t *dstptr) = 0;
enum State : uint32_t {
@@ -51,8 +50,8 @@ struct Event : _ze_event_handle_t {
void *hostAddress = nullptr;
uint64_t gpuAddress;
ze_event_scope_flag_t signalScope; // Saving scope for use later
ze_event_scope_flag_t waitScope;
ze_event_scope_flags_t signalScope; // Saving scope for use later
ze_event_scope_flags_t waitScope;
bool isTimestampEvent = false;

View File

@@ -61,9 +61,9 @@ ze_result_t FenceImp::reset() {
return ZE_RESULT_SUCCESS;
}
ze_result_t FenceImp::hostSynchronize(uint32_t timeout) {
ze_result_t FenceImp::hostSynchronize(uint64_t timeout) {
std::chrono::high_resolution_clock::time_point time1, time2;
int64_t timeDiff = 0;
uint64_t timeDiff = 0;
ze_result_t ret = ZE_RESULT_NOT_READY;
if (cmdQueue->getCsr()->getType() == NEO::CommandStreamReceiverType::CSR_AUB) {
@@ -84,7 +84,7 @@ ze_result_t FenceImp::hostSynchronize(uint32_t timeout) {
std::this_thread::yield();
NEO::CpuIntrinsics::pause();
if (timeout == std::numeric_limits<uint32_t>::max()) {
if (timeout == std::numeric_limits<uint64_t>::max()) {
continue;
}

View File

@@ -11,7 +11,7 @@
#include "level_zero/core/source/cmdqueue/cmdqueue.h"
#include "level_zero/core/source/cmdqueue/cmdqueue_imp.h"
#include <level_zero/ze_fence.h>
#include <level_zero/ze_api.h>
#include <limits>
@@ -23,7 +23,7 @@ struct Fence : _ze_fence_handle_t {
static Fence *create(CommandQueueImp *cmdQueue, const ze_fence_desc_t *desc);
virtual ~Fence() = default;
virtual ze_result_t destroy() = 0;
virtual ze_result_t hostSynchronize(uint32_t timeout) = 0;
virtual ze_result_t hostSynchronize(uint64_t timeout) = 0;
virtual ze_result_t queryStatus() = 0;
virtual ze_result_t reset() = 0;
@@ -61,7 +61,7 @@ struct FenceImp : public Fence {
return ZE_RESULT_SUCCESS;
}
ze_result_t hostSynchronize(uint32_t timeout) override;
ze_result_t hostSynchronize(uint64_t timeout) override;
ze_result_t queryStatus() override;

View File

@@ -10,7 +10,7 @@
#include "shared/source/command_container/cmdcontainer.h"
#include "level_zero/core/source/device/device.h"
#include <level_zero/ze_image.h>
#include <level_zero/ze_api.h>
struct _ze_image_handle_t {};

View File

@@ -11,7 +11,7 @@
namespace L0 {
cl_channel_type getClChannelDataType(const ze_image_format_desc_t &imgDescription) {
cl_channel_type getClChannelDataType(const ze_image_format_t &imgDescription) {
switch (imgDescription.layout) {
case ZE_IMAGE_FORMAT_LAYOUT_8:
case ZE_IMAGE_FORMAT_LAYOUT_8_8:
@@ -88,7 +88,7 @@ cl_channel_type getClChannelDataType(const ze_image_format_desc_t &imgDescriptio
return CL_INVALID_VALUE;
}
cl_channel_order getClChannelOrder(const ze_image_format_desc_t &imgDescription) {
cl_channel_order getClChannelOrder(const ze_image_format_t &imgDescription) {
swizzles imgSwizzles{imgDescription.x, imgDescription.y, imgDescription.z, imgDescription.w};
if (imgSwizzles == swizzles{ZE_IMAGE_FORMAT_SWIZZLE_R, ZE_IMAGE_FORMAT_SWIZZLE_0, ZE_IMAGE_FORMAT_SWIZZLE_0, ZE_IMAGE_FORMAT_SWIZZLE_1})

View File

@@ -31,7 +31,7 @@ struct swizzles {
}
};
cl_channel_type getClChannelDataType(const ze_image_format_desc_t &imgDescription);
cl_channel_order getClChannelOrder(const ze_image_format_desc_t &imgDescription);
cl_channel_type getClChannelDataType(const ze_image_format_t &imgDescription);
cl_channel_order getClChannelOrder(const ze_image_format_t &imgDescription);
} // namespace L0

View File

@@ -176,6 +176,6 @@ constexpr FormatTypes layoutP416 = {{{GMM_FORMAT_INVALID, NEO::NUM_GFX3DSTATE_SU
{GMM_FORMAT_INVALID, NEO::NUM_GFX3DSTATE_SURFACEFORMATS, 0, 1, 1, 1}}};
constexpr std::array<FormatTypes, 30> formats = {layout8, layout16, layout32, layout88, layout8888, layout1616, layout16161616, layout3232, layout32323232, layout1010102, layout111110, layout565, layout5551, layout4444, layoutY8,
layoutNV12, layoutYUYV, layoutVYUY, layoutYVYU, layoutUYVY, layoutAYUV, layoutYUAV, layoutP010, layoutY410, layoutP012, layoutY16, layoutP016, layoutY216, layoutP216, layoutP416};
layoutNV12, layoutYUYV, layoutVYUY, layoutYVYU, layoutUYVY, layoutAYUV, layoutP010, layoutY410, layoutP012, layoutY16, layoutP016, layoutY216, layoutP216, layoutP416};
} // namespace ImageFormats
} // namespace L0

View File

@@ -14,8 +14,6 @@
#include <level_zero/ze_api.h>
#include "third_party/level_zero/ze_api_ext.h"
#include <memory>
#include <vector>
@@ -91,11 +89,11 @@ struct Kernel : _ze_kernel_handle_t, virtual NEO::DispatchKernelEncoderI {
~Kernel() override = default;
virtual ze_result_t destroy() = 0;
virtual ze_result_t setAttribute(ze_kernel_attribute_t attr, uint32_t size, const void *pValue) = 0;
virtual ze_result_t getAttribute(ze_kernel_attribute_t attr, uint32_t *pSize, void *pValue) = 0;
virtual ze_result_t setIntermediateCacheConfig(ze_cache_config_t cacheConfig) = 0;
virtual ze_result_t setIndirectAccess(ze_kernel_indirect_access_flags_t flags) = 0;
virtual ze_result_t getIndirectAccess(ze_kernel_indirect_access_flags_t *flags) = 0;
virtual ze_result_t getSourceAttributes(uint32_t *pSize, char **pString) = 0;
virtual ze_result_t setIntermediateCacheConfig(ze_cache_config_flags_t cacheConfig) = 0;
virtual ze_result_t getProperties(ze_kernel_properties_t *pKernelProperties) = 0;
virtual ze_result_t getPropertiesExt(ze_kernel_propertiesExt_t *pKernelProperties) = 0;
virtual ze_result_t setArgumentValue(uint32_t argIndex, size_t argSize, const void *pArgValue) = 0;
virtual void setGroupCount(uint32_t groupCountX, uint32_t groupCountY, uint32_t groupCountZ) = 0;

View File

@@ -55,6 +55,8 @@ inline SamplerPatchValues getAddrMode(ze_sampler_address_mode_t addressingMode)
return SamplerPatchValues::AddressNone;
case ZE_SAMPLER_ADDRESS_MODE_MIRROR:
return SamplerPatchValues::AddressMirroredRepeat;
default:
DEBUG_BREAK_IF(true);
}
return SamplerPatchValues::AddressNone;
}
@@ -356,53 +358,43 @@ ze_result_t KernelImp::suggestMaxCooperativeGroupCount(uint32_t *totalGroupCount
return ZE_RESULT_SUCCESS;
}
ze_result_t KernelImp::setAttribute(ze_kernel_attribute_t attr, uint32_t size, const void *pValue) {
if (size != sizeof(bool)) {
return ZE_RESULT_ERROR_INVALID_KERNEL_ATTRIBUTE_VALUE;
}
if (attr == ZE_KERNEL_ATTR_INDIRECT_DEVICE_ACCESS) {
this->unifiedMemoryControls.indirectDeviceAllocationsAllowed = *(static_cast<const bool *>(pValue));
} else if (attr == ZE_KERNEL_ATTR_INDIRECT_HOST_ACCESS) {
this->unifiedMemoryControls.indirectHostAllocationsAllowed = *(static_cast<const bool *>(pValue));
} else if (attr == ZE_KERNEL_ATTR_INDIRECT_SHARED_ACCESS) {
this->unifiedMemoryControls.indirectSharedAllocationsAllowed = *(static_cast<const bool *>(pValue));
} else {
return ZE_RESULT_ERROR_INVALID_ENUMERATION;
ze_result_t KernelImp::setIndirectAccess(ze_kernel_indirect_access_flags_t flags) {
if (flags & ZE_KERNEL_INDIRECT_ACCESS_FLAG_DEVICE) {
this->unifiedMemoryControls.indirectDeviceAllocationsAllowed = true;
} else if (flags & ZE_KERNEL_INDIRECT_ACCESS_FLAG_HOST) {
this->unifiedMemoryControls.indirectHostAllocationsAllowed = true;
} else if (flags & ZE_KERNEL_INDIRECT_ACCESS_FLAG_SHARED) {
this->unifiedMemoryControls.indirectSharedAllocationsAllowed = true;
}
return ZE_RESULT_SUCCESS;
}
ze_result_t KernelImp::getAttribute(ze_kernel_attribute_t attr, uint32_t *pSize, void *pValue) {
if (attr == ZE_KERNEL_ATTR_INDIRECT_DEVICE_ACCESS) {
memcpy_s(pValue, sizeof(bool), &this->unifiedMemoryControls.indirectDeviceAllocationsAllowed, sizeof(bool));
return ZE_RESULT_SUCCESS;
ze_result_t KernelImp::getIndirectAccess(ze_kernel_indirect_access_flags_t *flags) {
*flags = 0;
if (this->unifiedMemoryControls.indirectDeviceAllocationsAllowed) {
*flags |= ZE_KERNEL_INDIRECT_ACCESS_FLAG_DEVICE;
}
if (this->unifiedMemoryControls.indirectHostAllocationsAllowed) {
*flags |= ZE_KERNEL_INDIRECT_ACCESS_FLAG_DEVICE;
}
if (this->unifiedMemoryControls.indirectSharedAllocationsAllowed) {
*flags |= ZE_KERNEL_INDIRECT_ACCESS_FLAG_DEVICE;
}
if (attr == ZE_KERNEL_ATTR_INDIRECT_HOST_ACCESS) {
memcpy_s(pValue, sizeof(bool), &this->unifiedMemoryControls.indirectHostAllocationsAllowed, sizeof(bool));
return ZE_RESULT_SUCCESS;
}
return ZE_RESULT_SUCCESS;
}
if (attr == ZE_KERNEL_ATTR_INDIRECT_SHARED_ACCESS) {
memcpy_s(pValue, sizeof(bool), &this->unifiedMemoryControls.indirectSharedAllocationsAllowed, sizeof(bool));
return ZE_RESULT_SUCCESS;
ze_result_t KernelImp::getSourceAttributes(uint32_t *pSize, char **pString) {
auto &desc = kernelImmData->getDescriptor();
if (pString == nullptr) {
*pSize = (uint32_t)desc.kernelMetadata.kernelLanguageAttributes.length() + 1;
} else {
strncpy_s(*pString, desc.kernelMetadata.kernelLanguageAttributes.length() + 1,
desc.kernelMetadata.kernelLanguageAttributes.c_str(),
desc.kernelMetadata.kernelLanguageAttributes.length() + 1);
}
if (attr == ZE_KERNEL_ATTR_SOURCE_ATTRIBUTE) {
auto &desc = kernelImmData->getDescriptor();
if (pValue == nullptr) {
*pSize = (uint32_t)desc.kernelMetadata.kernelLanguageAttributes.length() + 1;
} else {
strncpy_s((char *)pValue, desc.kernelMetadata.kernelLanguageAttributes.length() + 1,
desc.kernelMetadata.kernelLanguageAttributes.c_str(),
desc.kernelMetadata.kernelLanguageAttributes.length() + 1);
}
return ZE_RESULT_SUCCESS;
}
return ZE_RESULT_ERROR_INVALID_ENUMERATION;
return ZE_RESULT_SUCCESS;
}
ze_result_t KernelImp::setArgImmediate(uint32_t argIndex, size_t argSize, const void *argVal) {
@@ -549,22 +541,6 @@ ze_result_t KernelImp::setArgSampler(uint32_t argIndex, size_t argSize, const vo
return ZE_RESULT_SUCCESS;
}
ze_result_t KernelImp::getProperties(ze_kernel_properties_t *pKernelProperties) {
size_t kernelNameSize = std::min(this->kernelImmData->getDescriptor().kernelMetadata.kernelName.size(),
(static_cast<size_t>(ZE_MAX_KERNEL_NAME) - 1));
strncpy_s(pKernelProperties->name, ZE_MAX_KERNEL_NAME,
this->kernelImmData->getDescriptor().kernelMetadata.kernelName.c_str(), kernelNameSize);
pKernelProperties->requiredGroupSizeX = this->groupSize[0];
pKernelProperties->requiredGroupSizeY = this->groupSize[1];
pKernelProperties->requiredGroupSizeZ = this->groupSize[2];
pKernelProperties->numKernelArgs =
static_cast<uint32_t>(this->kernelImmData->getDescriptor().payloadMappings.explicitArgs.size());
return ZE_RESULT_SUCCESS;
}
ze_result_t KernelImp::getKernelName(size_t *pSize, char *pName) {
size_t kernelNameSize = this->kernelImmData->getDescriptor().kernelMetadata.kernelName.size() + 1;
if (0 == *pSize || nullptr == pName) {
@@ -579,11 +555,7 @@ ze_result_t KernelImp::getKernelName(size_t *pSize, char *pName) {
return ZE_RESULT_SUCCESS;
}
ze_result_t KernelImp::getPropertiesExt(ze_kernel_propertiesExt_t *pKernelProperties) {
size_t kernelNameSize = std::min(this->kernelImmData->getDescriptor().kernelMetadata.kernelName.size(),
(static_cast<size_t>(ZE_MAX_KERNEL_NAME) - 1));
strncpy_s(pKernelProperties->name, ZE_MAX_KERNEL_NAME,
this->kernelImmData->getDescriptor().kernelMetadata.kernelName.c_str(), kernelNameSize);
ze_result_t KernelImp::getProperties(ze_kernel_properties_t *pKernelProperties) {
pKernelProperties->requiredGroupSizeX = this->groupSize[0];
pKernelProperties->requiredGroupSizeY = this->groupSize[1];

View File

@@ -28,15 +28,13 @@ struct KernelImp : Kernel {
return ZE_RESULT_SUCCESS;
}
ze_result_t setAttribute(ze_kernel_attribute_t attr, uint32_t size, const void *pValue) override;
ze_result_t getAttribute(ze_kernel_attribute_t attr, uint32_t *pSize, void *pValue) override;
ze_result_t setIndirectAccess(ze_kernel_indirect_access_flags_t flags) override;
ze_result_t getIndirectAccess(ze_kernel_indirect_access_flags_t *flags) override;
ze_result_t getSourceAttributes(uint32_t *pSize, char **pString) override;
ze_result_t getProperties(ze_kernel_properties_t *pKernelProperties) override;
ze_result_t getPropertiesExt(ze_kernel_propertiesExt_t *pKernelProperties) override;
ze_result_t setIntermediateCacheConfig(ze_cache_config_t cacheConfig) override {
ze_result_t setIntermediateCacheConfig(ze_cache_config_flags_t cacheConfig) override {
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}

View File

@@ -99,7 +99,7 @@ ze_result_t DriverHandleImp::getMemAddressRange(const void *ptr, void **pBase, s
return ZE_RESULT_ERROR_UNKNOWN;
}
ze_result_t DriverHandleImp::allocHostMem(ze_host_mem_alloc_flag_t flags, size_t size, size_t alignment,
ze_result_t DriverHandleImp::allocHostMem(ze_host_mem_alloc_flags_t flags, size_t size, size_t alignment,
void **ptr) {
if (size > this->devices[0]->getDeviceInfo().maxMemAllocSize) {
*ptr = nullptr;
@@ -120,7 +120,7 @@ ze_result_t DriverHandleImp::allocHostMem(ze_host_mem_alloc_flag_t flags, size_t
return ZE_RESULT_SUCCESS;
}
ze_result_t DriverHandleImp::allocDeviceMem(ze_device_handle_t hDevice, ze_device_mem_alloc_flag_t flags,
ze_result_t DriverHandleImp::allocDeviceMem(ze_device_handle_t hDevice, ze_device_mem_alloc_flags_t flags,
size_t size, size_t alignment, void **ptr) {
if (size > this->devices[0]->getNEODevice()->getHardwareCapabilities().maxMemAllocSize) {
*ptr = nullptr;
@@ -141,8 +141,8 @@ ze_result_t DriverHandleImp::allocDeviceMem(ze_device_handle_t hDevice, ze_devic
return ZE_RESULT_SUCCESS;
}
ze_result_t DriverHandleImp::allocSharedMem(ze_device_handle_t hDevice, ze_device_mem_alloc_flag_t deviceFlags,
ze_host_mem_alloc_flag_t hostFlags, size_t size, size_t alignment,
ze_result_t DriverHandleImp::allocSharedMem(ze_device_handle_t hDevice, ze_device_mem_alloc_flags_t deviceFlags,
ze_host_mem_alloc_flags_t hostFlags, size_t size, size_t alignment,
void **ptr) {
NEO::SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY);
ze_device_handle_t device;

View File

@@ -9,7 +9,7 @@
#include "shared/source/memory_manager/memory_operations_status.h"
#include <level_zero/ze_common.h>
#include <level_zero/ze_api.h>
static ze_result_t changeMemoryOperationStatusToL0ResultType(NEO::MemoryOperationsStatus status) {
switch (status) {

View File

@@ -83,7 +83,7 @@ bool ModuleTranslationUnit::buildFromSpirV(const char *input, uint32_t inputSize
for (uint32_t i = 0; i < pConstants->numConstants; i++) {
uint64_t specConstantValue = 0;
memcpy_s(&specConstantValue, sizeof(uint64_t),
reinterpret_cast<void *>(pConstants->pConstantValues[i]), sizeof(uint64_t));
const_cast<void *>(pConstants->pConstantValues[i]), sizeof(uint64_t));
uint32_t specConstantId = pConstants->pConstantIds[i];
specConstantsValues[specConstantId] = specConstantValue;
}

View File

@@ -8,7 +8,7 @@
#pragma once
#include "level_zero/core/source/device/device.h"
#include <level_zero/ze_sampler.h>
#include <level_zero/ze_api.h>
struct _ze_sampler_handle_t {};

View File

@@ -10,45 +10,45 @@
#include <cstring>
#include <iostream>
#include <limits>
#include <vector>
#define VALIDATECALL(myZeCall) \
do { \
if (myZeCall != ZE_RESULT_SUCCESS) { \
std::cout << "Error at " \
<< #myZeCall << ": " \
<< __FUNCTION__ << ": " \
<< __LINE__ << "\n"; \
std::terminate(); \
} \
} while (0);
int main(int argc, char *argv[]) {
// Initialize driver
ze_result_t res = zeInit(ZE_INIT_FLAG_NONE);
if (res) {
std::terminate();
}
VALIDATECALL(zeInit(ZE_INIT_FLAG_GPU_ONLY));
// Retrieve driver
uint32_t driverCount = 0;
res = zeDriverGet(&driverCount, nullptr);
if (res || driverCount == 0) {
std::terminate();
}
VALIDATECALL(zeDriverGet(&driverCount, nullptr));
ze_driver_handle_t driverHandle;
res = zeDriverGet(&driverCount, &driverHandle);
if (res) {
std::terminate();
}
VALIDATECALL(zeDriverGet(&driverCount, &driverHandle));
ze_context_desc_t contextDesc = {};
ze_context_handle_t context;
VALIDATECALL(zeContextCreate(driverHandle, &contextDesc, &context));
// Retrieve device
uint32_t deviceCount = 0;
res = zeDeviceGet(driverHandle, &deviceCount, nullptr);
if (res || deviceCount == 0) {
std::terminate();
}
VALIDATECALL(zeDeviceGet(driverHandle, &deviceCount, nullptr));
ze_device_handle_t device;
deviceCount = 1;
res = zeDeviceGet(driverHandle, &deviceCount, &device);
if (res) {
std::terminate();
}
VALIDATECALL(zeDeviceGet(driverHandle, &deviceCount, &device));
// Print some properties
ze_device_properties_t deviceProperties = {ZE_DEVICE_PROPERTIES_VERSION_CURRENT};
res = zeDeviceGetProperties(device, &deviceProperties);
if (res) {
std::terminate();
}
ze_device_properties_t deviceProperties = {};
VALIDATECALL(zeDeviceGetProperties(device, &deviceProperties));
std::cout << "Device : \n"
<< " * name : " << deviceProperties.name << "\n"
@@ -56,45 +56,48 @@ int main(int argc, char *argv[]) {
<< " * vendorId : " << deviceProperties.vendorId << "\n";
// Create command queue
ze_command_queue_handle_t cmdQueue;
ze_command_queue_desc_t cmdQueueDesc = {ZE_COMMAND_QUEUE_DESC_VERSION_CURRENT};
cmdQueueDesc.ordinal = 0;
cmdQueueDesc.mode = ZE_COMMAND_QUEUE_MODE_ASYNCHRONOUS;
res = zeCommandQueueCreate(device, &cmdQueueDesc, &cmdQueue);
if (res) {
uint32_t numQueueGroups = 0;
VALIDATECALL(zeDeviceGetCommandQueueGroupProperties(device, &numQueueGroups, nullptr));
if (numQueueGroups == 0) {
std::cout << "No queue groups found!\n";
std::terminate();
}
std::vector<ze_command_queue_group_properties_t> queueProperties(numQueueGroups);
VALIDATECALL(zeDeviceGetCommandQueueGroupProperties(device, &numQueueGroups,
queueProperties.data()));
ze_command_queue_handle_t cmdQueue;
ze_command_queue_desc_t cmdQueueDesc = {};
for (uint32_t i = 0; i < numQueueGroups; i++) {
if (queueProperties[i].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COMPUTE) {
cmdQueueDesc.ordinal = i;
}
}
cmdQueueDesc.index = 0;
cmdQueueDesc.mode = ZE_COMMAND_QUEUE_MODE_ASYNCHRONOUS;
VALIDATECALL(zeCommandQueueCreate(context, device, &cmdQueueDesc, &cmdQueue));
// Create command list
ze_command_list_handle_t cmdList;
ze_command_list_desc_t cmdListDesc = {ZE_COMMAND_LIST_DESC_VERSION_CURRENT};
res = zeCommandListCreate(device, &cmdListDesc, &cmdList);
if (res) {
std::terminate();
}
ze_command_list_desc_t cmdListDesc = {};
cmdListDesc.commandQueueGroupOrdinal = cmdQueueDesc.ordinal;
VALIDATECALL(zeCommandListCreate(context, device, &cmdListDesc, &cmdList));
// Create two shared buffers
constexpr size_t allocSize = 4096;
ze_device_mem_alloc_desc_t deviceDesc;
deviceDesc.flags = ZE_DEVICE_MEM_ALLOC_FLAG_DEFAULT;
deviceDesc.flags = ZE_DEVICE_MEM_ALLOC_FLAG_BIAS_UNCACHED;
deviceDesc.ordinal = 0;
deviceDesc.version = ZE_DEVICE_MEM_ALLOC_DESC_VERSION_CURRENT;
ze_host_mem_alloc_desc_t hostDesc;
hostDesc.flags = ZE_HOST_MEM_ALLOC_FLAG_DEFAULT;
hostDesc.version = ZE_HOST_MEM_ALLOC_DESC_VERSION_CURRENT;
hostDesc.flags = ZE_HOST_MEM_ALLOC_FLAG_BIAS_UNCACHED;
void *srcBuffer = nullptr;
res = zeDriverAllocSharedMem(driverHandle, &deviceDesc, &hostDesc, allocSize, 1, device, &srcBuffer);
if (res) {
std::terminate();
}
VALIDATECALL(zeMemAllocShared(context, &deviceDesc, &hostDesc, allocSize, 1, device, &srcBuffer));
void *dstBuffer = nullptr;
res = zeDriverAllocSharedMem(driverHandle, &deviceDesc, &hostDesc, allocSize, 1, device, &dstBuffer);
if (res) {
std::terminate();
}
VALIDATECALL(zeMemAllocShared(context, &deviceDesc, &hostDesc, allocSize, 1, device, &dstBuffer));
// Initialize memory
constexpr uint8_t val = 55;
@@ -102,26 +105,13 @@ int main(int argc, char *argv[]) {
memset(dstBuffer, 0, allocSize);
// Perform a GPU copy
res = zeCommandListAppendMemoryCopy(cmdList, dstBuffer, srcBuffer, allocSize, nullptr);
if (res) {
std::terminate();
}
VALIDATECALL(zeCommandListAppendMemoryCopy(cmdList, dstBuffer, srcBuffer, allocSize, nullptr, 0, nullptr));
// Close list and submit for execution
res = zeCommandListClose(cmdList);
if (res) {
std::terminate();
}
res = zeCommandQueueExecuteCommandLists(cmdQueue, 1, &cmdList, nullptr);
if (res) {
std::terminate();
}
VALIDATECALL(zeCommandListClose(cmdList));
VALIDATECALL(zeCommandQueueExecuteCommandLists(cmdQueue, 1, &cmdList, nullptr));
// Wait for completion
res = zeCommandQueueSynchronize(cmdQueue, std::numeric_limits<uint32_t>::max());
if (res) {
std::terminate();
}
VALIDATECALL(zeCommandQueueSynchronize(cmdQueue, std::numeric_limits<uint32_t>::max()));
// Validate
bool outputValidationSuccessful = true;
@@ -139,22 +129,11 @@ int main(int argc, char *argv[]) {
}
// Cleanup
res = zeDriverFreeMem(driverHandle, dstBuffer);
if (res) {
std::terminate();
}
res = zeDriverFreeMem(driverHandle, srcBuffer);
if (res) {
std::terminate();
}
res = zeCommandListDestroy(cmdList);
if (res) {
std::terminate();
}
res = zeCommandQueueDestroy(cmdQueue);
if (res) {
std::terminate();
}
VALIDATECALL(zeMemFree(context, dstBuffer));
VALIDATECALL(zeMemFree(context, srcBuffer));
VALIDATECALL(zeCommandListDestroy(cmdList));
VALIDATECALL(zeCommandQueueDestroy(cmdQueue));
VALIDATECALL(zeContextDestroy(context));
std::cout << "\nZello World Results validation " << (outputValidationSuccessful ? "PASSED" : "FAILED") << "\n";

View File

@@ -21,16 +21,14 @@ class CommandListFixture : public DeviceFixture {
DeviceFixture::SetUp();
commandList.reset(whitebox_cast(CommandList::create(productFamily, device, false)));
ze_event_pool_desc_t eventPoolDesc = {
ZE_EVENT_POOL_DESC_VERSION_CURRENT,
ZE_EVENT_POOL_FLAG_HOST_VISIBLE,
2};
ze_event_pool_desc_t eventPoolDesc = {};
eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_HOST_VISIBLE;
eventPoolDesc.count = 2;
ze_event_desc_t eventDesc = {
ZE_EVENT_DESC_VERSION_CURRENT,
0,
ZE_EVENT_SCOPE_FLAG_NONE,
ZE_EVENT_SCOPE_FLAG_NONE};
ze_event_desc_t eventDesc = {};
eventDesc.index = 0;
eventDesc.wait = 0;
eventDesc.signal = 0;
eventPool = std::unique_ptr<EventPool>(EventPool::create(driverHandle.get(), 0, nullptr, &eventPoolDesc));
event = std::unique_ptr<Event>(Event::create(eventPool.get(), &eventDesc, device));

View File

@@ -35,7 +35,7 @@ struct ModuleFixture : public DeviceFixture {
ASSERT_NE(0u, size);
ASSERT_NE(nullptr, src);
ze_module_desc_t moduleDesc = {ZE_MODULE_DESC_VERSION_CURRENT};
ze_module_desc_t moduleDesc = {};
moduleDesc.format = ZE_MODULE_FORMAT_NATIVE;
moduleDesc.pInputModule = reinterpret_cast<const uint8_t *>(src.get());
moduleDesc.inputSize = size;
@@ -46,7 +46,7 @@ struct ModuleFixture : public DeviceFixture {
}
void createKernel() {
ze_kernel_desc_t desc = {ZE_KERNEL_DESC_VERSION_CURRENT};
ze_kernel_desc_t desc = {};
desc.pKernelName = kernelName.c_str();
kernel = std::make_unique<WhiteBox<::L0::Kernel>>();
@@ -81,7 +81,7 @@ struct MultiDeviceModuleFixture : public MultiDeviceFixture {
ASSERT_NE(0u, size);
ASSERT_NE(nullptr, src);
ze_module_desc_t moduleDesc = {ZE_MODULE_DESC_VERSION_CURRENT};
ze_module_desc_t moduleDesc = {};
moduleDesc.format = ZE_MODULE_FORMAT_NATIVE;
moduleDesc.pInputModule = reinterpret_cast<const uint8_t *>(src.get());
moduleDesc.inputSize = size;

View File

@@ -18,16 +18,6 @@ using ::testing::_;
using ::testing::AnyNumber;
using ::testing::Return;
using DevicePropertyTest = Test<DeviceFixture>;
HWTEST2_F(DevicePropertyTest, givenReturnedDevicePropertiesThenExpectedPageFaultSupportReturned, IsGen12LP) {
ze_device_properties_t deviceProps;
deviceProps.version = ZE_DEVICE_PROPERTIES_VERSION_CURRENT;
device->getProperties(&deviceProps);
EXPECT_FALSE(deviceProps.onDemandPageFaultsSupported);
}
using DeviceQueueGroupTest = Test<DeviceFixture>;
HWTEST2_F(DeviceQueueGroupTest,

View File

@@ -19,21 +19,19 @@ using ::testing::Return;
using KernelPropertyTest = Test<DeviceFixture>;
HWTEST2_F(KernelPropertyTest, givenReturnedKernelPropertiesThenExpectedDp4aSupportReturned, IsGen9) {
ze_device_kernel_properties_t kernelProps;
kernelProps.version = ZE_DEVICE_KERNEL_PROPERTIES_VERSION_CURRENT;
ze_device_module_properties_t kernelProps;
device->getKernelProperties(&kernelProps);
EXPECT_FALSE(kernelProps.dp4aSupported);
EXPECT_EQ(0u, kernelProps.flags & ZE_DEVICE_MODULE_FLAG_DP4A);
}
using DevicePropertyTest = Test<DeviceFixture>;
HWTEST2_F(DevicePropertyTest, givenReturnedDevicePropertiesThenExpectedPageFaultSupportReturned, IsGen9) {
ze_device_properties_t deviceProps;
deviceProps.version = ZE_DEVICE_PROPERTIES_VERSION_CURRENT;
device->getProperties(&deviceProps);
EXPECT_FALSE(deviceProps.onDemandPageFaultsSupported);
EXPECT_EQ(0u, deviceProps.flags & ZE_DEVICE_PROPERTY_FLAG_ONDEMANDPAGING);
}
using DeviceQueueGroupTest = Test<DeviceFixture>;

View File

@@ -21,8 +21,8 @@ set(L0_MOCKS_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/mock_driver.cpp
${CMAKE_CURRENT_SOURCE_DIR}/mock_driver_handle.h
${CMAKE_CURRENT_SOURCE_DIR}/mock_driver_handle.cpp
${CMAKE_CURRENT_SOURCE_DIR}/mock_event.cpp
${CMAKE_CURRENT_SOURCE_DIR}/mock_event.h
${CMAKE_CURRENT_SOURCE_DIR}/mock_event.cpp
${CMAKE_CURRENT_SOURCE_DIR}/mock_gmm_resource_info_l0.cpp
${CMAKE_CURRENT_SOURCE_DIR}/mock_kernel.h
${CMAKE_CURRENT_SOURCE_DIR}/mock_l0_debugger.h

View File

@@ -252,10 +252,6 @@ struct MockCommandList : public CommandList {
(zet_metric_streamer_handle_t hMetricStreamer,
uint32_t value));
ADDMETHOD_NOBASE(appendMetricTracerMarker, ze_result_t, ZE_RESULT_SUCCESS,
(zet_metric_tracer_handle_t hMetricTracer,
uint32_t value));
ADDMETHOD_NOBASE(appendMetricQueryBegin, ze_result_t, ZE_RESULT_SUCCESS,
(zet_metric_query_handle_t hMetricQuery));

View File

@@ -61,7 +61,7 @@ struct Mock<CommandQueue> : public CommandQueue {
(override));
MOCK_METHOD(ze_result_t,
synchronize,
(uint32_t timeout),
(uint64_t timeout),
(override));
MOCK_METHOD(void,
dispatchTaskCountWrite,
@@ -78,7 +78,7 @@ struct MockCommandQueueHw : public L0::CommandQueueHw<gfxCoreFamily> {
MockCommandQueueHw(L0::Device *device, NEO::CommandStreamReceiver *csr, const ze_command_queue_desc_t *desc) : L0::CommandQueueHw<gfxCoreFamily>(device, csr, desc) {
}
ze_result_t synchronize(uint32_t timeout) override {
ze_result_t synchronize(uint64_t timeout) override {
synchronizedCalled++;
return ZE_RESULT_SUCCESS;
}

View File

@@ -22,8 +22,8 @@ using Context = WhiteBox<::L0::Context>;
template <>
struct Mock<Context> : public Context {
Mock();
~Mock() override;
Mock() = default;
~Mock() override = default;
MOCK_METHOD(ze_result_t,
destroy,
@@ -39,7 +39,7 @@ struct Mock<Context> : public Context {
(override));
MOCK_METHOD(ze_result_t,
allocHostMem,
(ze_host_mem_alloc_flag_t flags,
(ze_host_mem_alloc_flags_t flags,
size_t size,
size_t alignment,
void **ptr),
@@ -47,7 +47,7 @@ struct Mock<Context> : public Context {
MOCK_METHOD(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),
@@ -55,8 +55,8 @@ struct Mock<Context> : public Context {
MOCK_METHOD(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),
@@ -124,6 +124,12 @@ struct Mock<Context> : public Context {
const ze_command_queue_desc_t *desc,
ze_command_list_handle_t *commandList),
(override));
MOCK_METHOD(ze_result_t,
activateMetricGroups,
(zet_device_handle_t hDevice,
uint32_t count,
zet_metric_group_handle_t *phMetricGroups),
(override));
MOCK_METHOD(ze_result_t,
reserveVirtualMem,
(const void *pStart,
@@ -177,6 +183,24 @@ struct Mock<Context> : public Context {
ze_memory_access_attribute_t *access,
size_t *outSize),
(override));
MOCK_METHOD(ze_result_t,
openEventPoolIpcHandle,
(ze_ipc_event_pool_handle_t hIpc,
ze_event_pool_handle_t *phEventPool),
(override));
MOCK_METHOD(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));
MOCK_METHOD(ze_result_t,
createImage,
(ze_device_handle_t hDevice,
const ze_image_desc_t *desc,
ze_image_handle_t *phImage),
(override));
};
} // namespace ult

View File

@@ -94,7 +94,7 @@ struct Mock<Device> : public Device {
(override));
MOCK_METHOD(ze_result_t,
getKernelProperties,
(ze_device_kernel_properties_t * pKernelProperties),
(ze_device_module_properties_t * pKernelProperties),
(override));
MOCK_METHOD(ze_result_t,
getMemoryProperties,
@@ -125,11 +125,11 @@ struct Mock<Device> : public Device {
(override));
MOCK_METHOD(ze_result_t,
setIntermediateCacheConfig,
(ze_cache_config_t CacheConfig),
(ze_cache_config_flags_t CacheConfig),
(override));
MOCK_METHOD(ze_result_t,
setLastLevelCacheConfig,
(ze_cache_config_t CacheConfig),
(ze_cache_config_flags_t CacheConfig),
(override));
MOCK_METHOD(ze_result_t,
getCacheProperties,
@@ -153,26 +153,22 @@ struct Mock<Device> : public Device {
(override));
MOCK_METHOD(ze_result_t,
systemBarrier,
(),
(override));
MOCK_METHOD(ze_result_t,
registerCLMemory,
(cl_context context,
cl_mem mem,
void **ptr),
(override));
MOCK_METHOD(ze_result_t,
registerCLProgram,
(cl_context context,
cl_program program,
ze_module_handle_t *phModule),
(override));
MOCK_METHOD(ze_result_t,
registerCLCommandQueue,
(cl_context context,
cl_command_queue commandQueue,
ze_command_queue_handle_t *phCommandQueue),

View File

@@ -28,14 +28,14 @@ struct Mock<Driver> : public Driver {
MOCK_METHOD(ze_result_t,
driverInit,
(ze_init_flag_t),
(ze_init_flags_t),
(override));
MOCK_METHOD(void,
initialize,
(ze_result_t * result),
(override));
ze_result_t mockInit(ze_init_flag_t) { return this->DriverImp::driverInit(ZE_INIT_FLAG_NONE); }
ze_result_t mockInit(ze_init_flag_t) { return this->DriverImp::driverInit(ZE_INIT_FLAG_GPU_ONLY); }
void mockInitialize(ze_result_t *result) { *result = ZE_RESULT_SUCCESS; }
Driver *previousDriver = nullptr;

View File

@@ -52,7 +52,7 @@ ze_result_t Mock<DriverHandle>::doGetDevice(uint32_t *pCount, ze_device_handle_t
return ZE_RESULT_SUCCESS;
}
ze_result_t Mock<DriverHandle>::doAllocHostMem(ze_host_mem_alloc_flag_t flags, size_t size, size_t alignment,
ze_result_t Mock<DriverHandle>::doAllocHostMem(ze_host_mem_alloc_flags_t flags, size_t size, size_t alignment,
void **ptr) {
NEO::SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::HOST_UNIFIED_MEMORY);
@@ -67,7 +67,7 @@ ze_result_t Mock<DriverHandle>::doAllocHostMem(ze_host_mem_alloc_flag_t flags, s
return ZE_RESULT_SUCCESS;
}
ze_result_t Mock<DriverHandle>::doAllocDeviceMem(ze_device_handle_t hDevice, ze_device_mem_alloc_flag_t flags, size_t size, size_t alignment, void **ptr) {
ze_result_t Mock<DriverHandle>::doAllocDeviceMem(ze_device_handle_t hDevice, ze_device_mem_alloc_flags_t flags, size_t size, size_t alignment, void **ptr) {
NEO::SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::DEVICE_UNIFIED_MEMORY);
auto allocation = svmAllocsManager->createUnifiedMemoryAllocation(0u, size, unifiedMemoryProperties);

View File

@@ -99,7 +99,7 @@ struct Mock<DriverHandle> : public DriverHandleImp {
(override));
MOCK_METHOD(ze_result_t,
allocHostMem,
(ze_host_mem_alloc_flag_t flags,
(ze_host_mem_alloc_flags_t flags,
size_t size,
size_t alignment,
void **ptr),
@@ -107,7 +107,7 @@ struct Mock<DriverHandle> : public DriverHandleImp {
MOCK_METHOD(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),
@@ -115,8 +115,8 @@ struct Mock<DriverHandle> : public DriverHandleImp {
MOCK_METHOD(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),
@@ -139,12 +139,12 @@ struct Mock<DriverHandle> : public DriverHandleImp {
ze_device_handle_t *phDevices);
NEO::MemoryManager *doGetMemoryManager();
NEO::SVMAllocsManager *doGetSvmAllocManager();
ze_result_t doAllocHostMem(ze_host_mem_alloc_flag_t flags,
ze_result_t doAllocHostMem(ze_host_mem_alloc_flags_t flags,
size_t size,
size_t alignment,
void **ptr);
ze_result_t doAllocDeviceMem(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);

View File

@@ -44,10 +44,9 @@ struct Mock<Event> : public Event {
MOCK_METHOD3(create, L0::Event *(::L0::EventPool *eventPool, const ze_event_desc_t *desc, ::L0::Device *device));
MOCK_METHOD0(destroy, ze_result_t());
MOCK_METHOD0(hostSignal, ze_result_t());
MOCK_METHOD1(hostSynchronize, ze_result_t(uint32_t timeout));
MOCK_METHOD1(hostSynchronize, ze_result_t(uint64_t timeout));
MOCK_METHOD0(queryStatus, ze_result_t());
MOCK_METHOD0(reset, ze_result_t());
MOCK_METHOD2(getTimestamp, ze_result_t(ze_event_timestamp_type_t timestampType, void *dstptr));
MOCK_METHOD1(queryKernelTimestamp, ze_result_t(ze_kernel_timestamp_result_t *dstptr));
// Fake an allocation for event memory

View File

@@ -21,6 +21,7 @@
#include "level_zero/core/source/module/module.h"
#include "level_zero/core/test/unit_tests/fixtures/device_fixture.h"
#include "level_zero/core/test/unit_tests/mocks/mock_cmdlist.h"
#include "level_zero/core/test/unit_tests/mocks/mock_context.h"
#include "level_zero/core/test/unit_tests/mocks/mock_event.h"
#include "level_zero/core/test/unit_tests/mocks/mock_kernel.h"
@@ -53,8 +54,9 @@ TEST_F(ContextCommandListCreate, whenCreatingCommandListImmediateFromContextThen
using CommandListCreate = Test<DeviceFixture>;
TEST(zeCommandListCreateImmediate, redirectsToObject) {
TEST(zeCommandListCreateImmediate, DISABLED_redirectsToObject) {
Mock<Device> device;
Mock<Context> context;
ze_command_queue_desc_t desc = {};
ze_command_list_handle_t commandList = {};
@@ -62,7 +64,7 @@ TEST(zeCommandListCreateImmediate, redirectsToObject) {
.Times(1)
.WillRepeatedly(::testing::Return(ZE_RESULT_SUCCESS));
auto result = zeCommandListCreateImmediate(device.toHandle(), &desc, &commandList);
auto result = zeCommandListCreateImmediate(context.toHandle(), device.toHandle(), &desc, &commandList);
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
}
@@ -121,7 +123,7 @@ TEST_F(CommandListCreate, givenValidPtrThenAppendMemAdviseReturnsSuccess) {
void *ptr = nullptr;
auto res = driverHandle->allocDeviceMem(device->toHandle(),
ZE_DEVICE_MEM_ALLOC_FLAG_DEFAULT,
0u,
size, alignment, &ptr);
EXPECT_EQ(ZE_RESULT_SUCCESS, res);
EXPECT_NE(nullptr, ptr);
@@ -142,7 +144,7 @@ TEST_F(CommandListCreate, givenValidPtrThenAppendMemoryPrefetchReturnsSuccess) {
void *ptr = nullptr;
auto res = driverHandle->allocDeviceMem(device->toHandle(),
ZE_DEVICE_MEM_ALLOC_FLAG_DEFAULT,
0u,
size, alignment, &ptr);
EXPECT_EQ(ZE_RESULT_SUCCESS, res);
EXPECT_NE(nullptr, ptr);
@@ -158,12 +160,8 @@ TEST_F(CommandListCreate, givenValidPtrThenAppendMemoryPrefetchReturnsSuccess) {
}
TEST_F(CommandListCreate, givenImmediateCommandListThenCustomNumIddPerBlockUsed) {
const ze_command_queue_desc_t desc = {
ZE_COMMAND_QUEUE_DESC_VERSION_CURRENT,
ZE_COMMAND_QUEUE_FLAG_NONE,
ZE_COMMAND_QUEUE_MODE_DEFAULT,
ZE_COMMAND_QUEUE_PRIORITY_NORMAL,
0};
const ze_command_queue_desc_t desc = {};
std::unique_ptr<L0::CommandList> commandList(CommandList::createImmediate(productFamily, device, &desc, false, false));
ASSERT_NE(nullptr, commandList);
@@ -172,12 +170,7 @@ TEST_F(CommandListCreate, givenImmediateCommandListThenCustomNumIddPerBlockUsed)
}
TEST_F(CommandListCreate, whenCreatingImmediateCommandListThenItHasImmediateCommandQueueCreated) {
const ze_command_queue_desc_t desc = {
ZE_COMMAND_QUEUE_DESC_VERSION_CURRENT,
ZE_COMMAND_QUEUE_FLAG_NONE,
ZE_COMMAND_QUEUE_MODE_DEFAULT,
ZE_COMMAND_QUEUE_PRIORITY_NORMAL,
0};
const ze_command_queue_desc_t desc = {};
std::unique_ptr<L0::CommandList> commandList(CommandList::createImmediate(productFamily, device, &desc, false, false));
ASSERT_NE(nullptr, commandList);
@@ -367,8 +360,8 @@ HWTEST_F(CommandListCreate, givenCommandListWithCopyOnlyWhenAppendSignalEventThe
std::unique_ptr<L0::CommandList> commandList(CommandList::create(productFamily, device, true));
auto &commandContainer = commandList->commandContainer;
MockEvent event;
event.waitScope = ZE_EVENT_SCOPE_FLAG_NONE;
event.signalScope = ZE_EVENT_SCOPE_FLAG_NONE;
event.waitScope = ZE_EVENT_SCOPE_FLAG_HOST;
event.signalScope = ZE_EVENT_SCOPE_FLAG_HOST;
commandList->appendSignalEvent(event.toHandle());
GenCmdList cmdList;
ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(
@@ -383,8 +376,8 @@ HWTEST_F(CommandListCreate, givenCommandListWhenAppendSignalEventThePipeControlI
std::unique_ptr<L0::CommandList> commandList(CommandList::create(productFamily, device, false));
auto &commandContainer = commandList->commandContainer;
MockEvent event;
event.waitScope = ZE_EVENT_SCOPE_FLAG_NONE;
event.signalScope = ZE_EVENT_SCOPE_FLAG_NONE;
event.waitScope = ZE_EVENT_SCOPE_FLAG_HOST;
event.signalScope = ZE_EVENT_SCOPE_FLAG_HOST;
commandList->appendSignalEvent(event.toHandle());
GenCmdList cmdList;
ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(
@@ -399,7 +392,7 @@ HWTEST_F(CommandListCreate, givenCommandListWithCopyOnlyWhenAppendWaitEventsWith
std::unique_ptr<L0::CommandList> commandList(CommandList::create(productFamily, device, true));
auto &commandContainer = commandList->commandContainer;
MockEvent event;
event.signalScope = ZE_EVENT_SCOPE_FLAG_NONE;
event.signalScope = 0;
event.waitScope = ZE_EVENT_SCOPE_FLAG_HOST;
auto eventHandle = event.toHandle();
commandList->appendWaitOnEvents(1, &eventHandle);
@@ -416,7 +409,7 @@ HWTEST_F(CommandListCreate, givenCommandListyWhenAppendWaitEventsWithDcFlushTheP
std::unique_ptr<L0::CommandList> commandList(CommandList::create(productFamily, device, false));
auto &commandContainer = commandList->commandContainer;
MockEvent event;
event.signalScope = ZE_EVENT_SCOPE_FLAG_NONE;
event.signalScope = 0;
event.waitScope = ZE_EVENT_SCOPE_FLAG_HOST;
auto eventHandle = event.toHandle();
commandList->appendWaitOnEvents(1, &eventHandle);
@@ -630,7 +623,6 @@ HWTEST2_F(CommandListCreate, givenCopyOnlyCommandListWhenAppenBlitFillThenCopyBl
}
using ImageSupport = IsWithinProducts<IGFX_SKYLAKE, IGFX_TIGERLAKE_LP>;
HWTEST2_F(CommandListCreate, givenCopyCommandListWhenCopyFromImagBlitThenCommandAddedToStream, ImageSupport) {
using GfxFamily = typename NEO::GfxFamilyMapper<gfxCoreFamily>::GfxFamily;
using XY_COPY_BLT = typename GfxFamily::XY_COPY_BLT;
@@ -654,15 +646,12 @@ HWTEST2_F(CommandListCreate, givenCopyCommandListWhenTimestampPassedToMemoryCopy
using MI_STORE_REGISTER_MEM = typename GfxFamily::MI_STORE_REGISTER_MEM;
auto commandList = std::make_unique<WhiteBox<::L0::CommandListCoreFamily<gfxCoreFamily>>>();
commandList->initialize(device, true);
ze_event_pool_desc_t eventPoolDesc = {
ZE_EVENT_POOL_DESC_VERSION_CURRENT,
ZE_EVENT_POOL_FLAG_TIMESTAMP,
1};
ze_event_desc_t eventDesc = {
ZE_EVENT_DESC_VERSION_CURRENT,
0,
ZE_EVENT_SCOPE_FLAG_NONE,
ZE_EVENT_SCOPE_FLAG_NONE};
ze_event_pool_desc_t eventPoolDesc = {};
eventPoolDesc.count = 1;
eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP;
ze_event_desc_t eventDesc = {};
eventDesc.index = 0;
auto eventPool = std::unique_ptr<L0::EventPool>(L0::EventPool::create(driverHandle.get(), 0, nullptr, &eventPoolDesc));
auto event = std::unique_ptr<L0::Event>(L0::Event::create(eventPool.get(), &eventDesc, device));
@@ -716,15 +705,12 @@ HWTEST2_F(CommandListCreate, givenCopyCommandListWhenTimestampPassedToImageCopyB
using MI_STORE_REGISTER_MEM = typename GfxFamily::MI_STORE_REGISTER_MEM;
auto commandList = std::make_unique<WhiteBox<::L0::CommandListCoreFamily<gfxCoreFamily>>>();
commandList->initialize(device, true);
ze_event_pool_desc_t eventPoolDesc = {
ZE_EVENT_POOL_DESC_VERSION_CURRENT,
ZE_EVENT_POOL_FLAG_TIMESTAMP,
1};
ze_event_desc_t eventDesc = {
ZE_EVENT_DESC_VERSION_CURRENT,
0,
ZE_EVENT_SCOPE_FLAG_NONE,
ZE_EVENT_SCOPE_FLAG_NONE};
ze_event_pool_desc_t eventPoolDesc = {};
eventPoolDesc.count = 1;
eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP;
ze_event_desc_t eventDesc = {};
eventDesc.index = 0;
auto eventPool = std::unique_ptr<L0::EventPool>(L0::EventPool::create(driverHandle.get(), 0, nullptr, &eventPoolDesc));
auto event = std::unique_ptr<L0::Event>(L0::Event::create(eventPool.get(), &eventDesc, device));
@@ -750,15 +736,12 @@ HWTEST2_F(CommandListCreate, givenCopyCommandListWhenProfilingBeforeCommandForCo
using MI_STORE_REGISTER_MEM = typename GfxFamily::MI_STORE_REGISTER_MEM;
auto commandList = std::make_unique<WhiteBox<::L0::CommandListCoreFamily<gfxCoreFamily>>>();
commandList->initialize(device, true);
ze_event_pool_desc_t eventPoolDesc = {
ZE_EVENT_POOL_DESC_VERSION_CURRENT,
ZE_EVENT_POOL_FLAG_TIMESTAMP,
1};
ze_event_desc_t eventDesc = {
ZE_EVENT_DESC_VERSION_CURRENT,
0,
ZE_EVENT_SCOPE_FLAG_NONE,
ZE_EVENT_SCOPE_FLAG_NONE};
ze_event_pool_desc_t eventPoolDesc = {};
eventPoolDesc.count = 1;
eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP;
ze_event_desc_t eventDesc = {};
eventDesc.index = 0;
auto eventPool = std::unique_ptr<L0::EventPool>(L0::EventPool::create(driverHandle.get(), 0, nullptr, &eventPoolDesc));
auto event = std::unique_ptr<L0::Event>(L0::Event::create(eventPool.get(), &eventDesc, device));
@@ -786,15 +769,12 @@ HWTEST2_F(CommandListCreate, givenCopyCommandListWhenProfilingAfterCommandForCop
using MI_STORE_REGISTER_MEM = typename GfxFamily::MI_STORE_REGISTER_MEM;
auto commandList = std::make_unique<WhiteBox<::L0::CommandListCoreFamily<gfxCoreFamily>>>();
commandList->initialize(device, true);
ze_event_pool_desc_t eventPoolDesc = {
ZE_EVENT_POOL_DESC_VERSION_CURRENT,
ZE_EVENT_POOL_FLAG_TIMESTAMP,
1};
ze_event_desc_t eventDesc = {
ZE_EVENT_DESC_VERSION_CURRENT,
0,
ZE_EVENT_SCOPE_FLAG_NONE,
ZE_EVENT_SCOPE_FLAG_NONE};
ze_event_pool_desc_t eventPoolDesc = {};
eventPoolDesc.count = 1;
eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP;
ze_event_desc_t eventDesc = {};
eventDesc.index = 0;
auto eventPool = std::unique_ptr<L0::EventPool>(L0::EventPool::create(driverHandle.get(), 0, nullptr, &eventPoolDesc));
auto event = std::unique_ptr<L0::Event>(L0::Event::create(eventPool.get(), &eventDesc, device));

View File

@@ -329,15 +329,13 @@ HWTEST2_F(CommandListCreate, givenCommandListWhenTimestampPassedToMemoryCopyThen
void *srcPtr = reinterpret_cast<void *>(0x1234);
void *dstPtr = reinterpret_cast<void *>(0x2345);
ze_event_pool_desc_t eventPoolDesc = {
ZE_EVENT_POOL_DESC_VERSION_CURRENT,
ZE_EVENT_POOL_FLAG_TIMESTAMP,
1};
ze_event_desc_t eventDesc = {
ZE_EVENT_DESC_VERSION_CURRENT,
0,
ZE_EVENT_SCOPE_FLAG_NONE,
ZE_EVENT_SCOPE_FLAG_NONE};
ze_event_pool_desc_t eventPoolDesc = {};
eventPoolDesc.count = 1;
eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP;
ze_event_desc_t eventDesc = {};
eventDesc.index = 0;
auto eventPool = std::unique_ptr<L0::EventPool>(L0::EventPool::create(driverHandle.get(), 0, nullptr, &eventPoolDesc));
auto event = std::unique_ptr<L0::Event>(L0::Event::create(eventPool.get(), &eventDesc, device));
@@ -819,7 +817,6 @@ HWTEST2_F(CommandListCreate, givenPitchAndSlicePitchWhenMemoryCopyRegionCalledSi
EXPECT_EQ(cmdList.srcSize.x, pitch);
EXPECT_EQ(cmdList.srcSize.y, slicePitch / pitch);
}
template <GFXCORE_FAMILY gfxCoreFamily>
class MockCommandListForMemFill : public WhiteBox<::L0::CommandListCoreFamily<gfxCoreFamily>> {
public:
@@ -847,15 +844,15 @@ HWTEST2_F(CommandListCreate, givenCopyCommandListWhenTimestampPassedToMemoryCopy
commandList.initialize(device, true);
void *srcPtr = reinterpret_cast<void *>(0x1234);
void *dstPtr = reinterpret_cast<void *>(0x2345);
ze_event_pool_desc_t eventPoolDesc = {
ZE_EVENT_POOL_DESC_VERSION_CURRENT,
ZE_EVENT_POOL_FLAG_TIMESTAMP,
1};
ze_event_desc_t eventDesc = {
ZE_EVENT_DESC_VERSION_CURRENT,
0,
ZE_EVENT_SCOPE_FLAG_NONE,
ZE_EVENT_SCOPE_FLAG_NONE};
ze_event_pool_desc_t eventPoolDesc = {};
eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP;
eventPoolDesc.count = 1;
ze_event_desc_t eventDesc = {};
eventDesc.index = 0;
eventDesc.signal = 0;
eventDesc.wait = 0;
auto eventPool = std::unique_ptr<L0::EventPool>(L0::EventPool::create(driverHandle.get(), 0, nullptr, &eventPoolDesc));
auto event = std::unique_ptr<L0::Event>(L0::Event::create(eventPool.get(), &eventDesc, device));

View File

@@ -9,9 +9,9 @@
#include "level_zero/core/test/unit_tests/fixtures/device_fixture.h"
#include "level_zero/core/test/unit_tests/mocks/mock_cmdlist.h"
#include "level_zero/core/test/unit_tests/mocks/mock_context.h"
#include "level_zero/core/test/unit_tests/mocks/mock_kernel.h"
#include "third_party/level_zero/ze_api_ext.h"
#include <level_zero/ze_api.h>
namespace L0 {
namespace ult {
@@ -41,7 +41,7 @@ TEST_F(zeCommandListAppendMemAdviseTest, whenCalledThenRedirectedToObject) {
TEST(zeCommandListAppendMemoryCopy, whenCalledThenRedirectedToObject) {
MockCommandList commandList;
auto res = zeCommandListAppendMemoryCopy(&commandList, reinterpret_cast<void *>(0x2000), reinterpret_cast<const void *>(0x1000), 0x1000, nullptr);
auto res = zeCommandListAppendMemoryCopy(&commandList, reinterpret_cast<void *>(0x2000), reinterpret_cast<const void *>(0x1000), 0x1000, nullptr, 0, nullptr);
ASSERT_EQ(ZE_RESULT_SUCCESS, res);
}
@@ -51,7 +51,7 @@ TEST(zeCommandListAppendMemoryFill, whenCalledThenRedirectedToObject) {
int value = 0;
auto res = zeCommandListAppendMemoryFill(&commandList, reinterpret_cast<void *>(0x1000), reinterpret_cast<void *>(&value),
sizeof(value), bufferSize, nullptr);
sizeof(value), bufferSize, nullptr, 0, nullptr);
ASSERT_EQ(ZE_RESULT_SUCCESS, res);
}
@@ -63,10 +63,10 @@ TEST(zeCommandListAppendWaitOnEvent, whenCalledThenRedirectedToObject) {
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
}
TEST(zeCommandListAppendWriteGlobalTimestampExt, whenCalledThenRedirectedToObject) {
TEST(zeCommandListAppendWriteGlobalTimestamp, whenCalledThenRedirectedToObject) {
MockCommandList commandList;
auto result = zeCommandListAppendWriteGlobalTimestampExt(commandList.toHandle(), nullptr, nullptr, 0, nullptr);
auto result = zeCommandListAppendWriteGlobalTimestamp(commandList.toHandle(), nullptr, nullptr, 0, nullptr);
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
}

View File

@@ -209,16 +209,12 @@ HWCMDTEST_F(IGFX_GEN8_CORE, CommandListAppendLaunchKernel, givenEventsWhenAppend
Mock<::L0::Kernel> kernel;
std::unique_ptr<L0::CommandList> commandList(L0::CommandList::create(productFamily, device, false));
auto usedSpaceBefore = commandList->commandContainer.getCommandStream()->getUsed();
ze_event_pool_desc_t eventPoolDesc = {
ZE_EVENT_POOL_DESC_VERSION_CURRENT,
ZE_EVENT_POOL_FLAG_HOST_VISIBLE,
1};
ze_event_pool_desc_t eventPoolDesc = {};
eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_HOST_VISIBLE;
eventPoolDesc.count = 1;
ze_event_desc_t eventDesc = {
ZE_EVENT_DESC_VERSION_CURRENT,
0,
ZE_EVENT_SCOPE_FLAG_NONE,
ZE_EVENT_SCOPE_FLAG_NONE};
ze_event_desc_t eventDesc = {};
eventDesc.index = 0;
auto eventPool = std::unique_ptr<EventPool>(EventPool::create(driverHandle.get(), 0, nullptr, &eventPoolDesc));
auto event = std::unique_ptr<Event>(Event::create(eventPool.get(), &eventDesc, device));
@@ -273,16 +269,12 @@ HWTEST2_F(CommandListAppendLaunchKernel, givenTimestampEventsWhenAppendingKernel
Mock<::L0::Kernel> kernel;
std::unique_ptr<L0::CommandList> commandList(L0::CommandList::create(productFamily, device, false));
auto usedSpaceBefore = commandList->commandContainer.getCommandStream()->getUsed();
ze_event_pool_desc_t eventPoolDesc = {
ZE_EVENT_POOL_DESC_VERSION_CURRENT,
ZE_EVENT_POOL_FLAG_TIMESTAMP,
1};
ze_event_pool_desc_t eventPoolDesc = {};
eventPoolDesc.count = 1;
eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP;
ze_event_desc_t eventDesc = {
ZE_EVENT_DESC_VERSION_CURRENT,
0,
ZE_EVENT_SCOPE_FLAG_NONE,
ZE_EVENT_SCOPE_FLAG_NONE};
ze_event_desc_t eventDesc = {};
eventDesc.index = 0;
auto eventPool = std::unique_ptr<EventPool>(EventPool::create(driverHandle.get(), 0, nullptr, &eventPoolDesc));
auto event = std::unique_ptr<Event>(Event::create(eventPool.get(), &eventDesc, device));
@@ -360,13 +352,13 @@ HWTEST2_F(CommandListAppendLaunchKernel, givenKernelLaunchWithTSEventAndScopeFla
Mock<::L0::Kernel> kernel;
std::unique_ptr<L0::CommandList> commandList(L0::CommandList::create(productFamily, device, false));
auto usedSpaceBefore = commandList->commandContainer.getCommandStream()->getUsed();
ze_event_pool_desc_t eventPoolDesc = {
ZE_EVENT_POOL_DESC_VERSION_CURRENT,
ZE_EVENT_POOL_FLAG_TIMESTAMP,
1};
ze_event_pool_desc_t eventPoolDesc = {};
eventPoolDesc.count = 1;
eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP;
ze_event_desc_t eventDesc = {
ZE_EVENT_DESC_VERSION_CURRENT,
const ze_event_desc_t eventDesc = {
ZE_STRUCTURE_TYPE_EVENT_DESC,
nullptr,
0,
ZE_EVENT_SCOPE_FLAG_HOST,
ZE_EVENT_SCOPE_FLAG_HOST};
@@ -432,7 +424,7 @@ HWTEST_F(CommandListAppendLaunchKernel, givenIndirectDispatchWhenAppendingThenWo
std::unique_ptr<L0::CommandList> commandList(L0::CommandList::create(productFamily, device, false));
void *alloc = nullptr;
auto result = device->getDriverHandle()->allocDeviceMem(device->toHandle(), ZE_DEVICE_MEM_ALLOC_FLAG_DEFAULT, 16384u, 4096u, &alloc);
auto result = device->getDriverHandle()->allocDeviceMem(device->toHandle(), 0u, 16384u, 4096u, &alloc);
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
result = commandList->appendLaunchKernelIndirect(kernel.toHandle(),
@@ -542,13 +534,12 @@ HWTEST_F(CommandListAppendLaunchKernel, givenSingleValidWaitEventsAddsSemaphoreT
ASSERT_NE(nullptr, commandList->commandContainer.getCommandStream());
auto usedSpaceBefore = commandList->commandContainer.getCommandStream()->getUsed();
ze_event_pool_desc_t eventPoolDesc = {
ZE_EVENT_POOL_DESC_VERSION_CURRENT,
ZE_EVENT_POOL_FLAG_HOST_VISIBLE,
1};
ze_event_pool_desc_t eventPoolDesc = {};
eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_HOST_VISIBLE;
eventPoolDesc.count = 1;
ze_event_desc_t eventDesc = {ZE_EVENT_DESC_VERSION_CURRENT, 0, ZE_EVENT_SCOPE_FLAG_NONE,
ZE_EVENT_SCOPE_FLAG_NONE};
ze_event_desc_t eventDesc = {};
eventDesc.index = 0;
std::unique_ptr<EventPool> eventPool(EventPool::create(driverHandle.get(), 0, nullptr, &eventPoolDesc));
std::unique_ptr<Event> event(Event::create(eventPool.get(), &eventDesc, device));
@@ -585,16 +576,15 @@ HWTEST_F(CommandListAppendLaunchKernel, givenMultipleValidWaitEventsAddsSemaphor
ASSERT_NE(nullptr, commandList->commandContainer.getCommandStream());
auto usedSpaceBefore = commandList->commandContainer.getCommandStream()->getUsed();
ze_event_pool_desc_t eventPoolDesc = {
ZE_EVENT_POOL_DESC_VERSION_CURRENT,
ZE_EVENT_POOL_FLAG_HOST_VISIBLE,
2};
ze_event_pool_desc_t eventPoolDesc = {};
eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_HOST_VISIBLE;
eventPoolDesc.count = 2;
ze_event_desc_t eventDesc1 = {ZE_EVENT_DESC_VERSION_CURRENT, 0, ZE_EVENT_SCOPE_FLAG_NONE,
ZE_EVENT_SCOPE_FLAG_NONE};
ze_event_desc_t eventDesc1 = {};
eventDesc1.index = 0;
ze_event_desc_t eventDesc2 = {ZE_EVENT_DESC_VERSION_CURRENT, 1, ZE_EVENT_SCOPE_FLAG_NONE,
ZE_EVENT_SCOPE_FLAG_NONE};
ze_event_desc_t eventDesc2 = {};
eventDesc2.index = 1;
std::unique_ptr<EventPool> eventPool(EventPool::create(driverHandle.get(), 0, nullptr, &eventPoolDesc));
std::unique_ptr<Event> event1(Event::create(eventPool.get(), &eventDesc1, device));
@@ -630,7 +620,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, CommandListAppendLaunchKernel, givenAppendLaunchMult
const ze_kernel_handle_t launchFn = kernel->toHandle();
uint32_t *numLaunchArgs;
auto result = device->getDriverHandle()->allocDeviceMem(
device->toHandle(), ZE_DEVICE_MEM_ALLOC_FLAG_DEFAULT, 16384u, 4096u, reinterpret_cast<void **>(&numLaunchArgs));
device->toHandle(), 0u, 16384u, 4096u, reinterpret_cast<void **>(&numLaunchArgs));
result = commandList->appendLaunchMultipleKernelsIndirect(1, &launchFn, numLaunchArgs, nullptr, nullptr, 0, nullptr);
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
*numLaunchArgs = 0;
@@ -657,7 +647,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, CommandListAppendLaunchKernel, givenAppendLaunchMult
uint32_t *numLaunchArgs;
const uint32_t numKernels = 3;
auto result = device->getDriverHandle()->allocDeviceMem(
device->toHandle(), ZE_DEVICE_MEM_ALLOC_FLAG_DEFAULT, 16384u, 4096u, reinterpret_cast<void **>(&numLaunchArgs));
device->toHandle(), 0u, 16384u, 4096u, reinterpret_cast<void **>(&numLaunchArgs));
result = commandList->appendLaunchMultipleKernelsIndirect(numKernels, launchFn, numLaunchArgs, nullptr, nullptr, 0, nullptr);
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
*numLaunchArgs = 2;

View File

@@ -99,16 +99,13 @@ HWTEST_F(CommandListAppendSignalEvent, givenEventWithScopeFlagDeviceWhenAppendin
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;
using POST_SYNC_OPERATION = typename PIPE_CONTROL::POST_SYNC_OPERATION;
ze_event_pool_desc_t eventPoolDesc = {
ZE_EVENT_POOL_DESC_VERSION_CURRENT,
ZE_EVENT_POOL_FLAG_HOST_VISIBLE,
1};
ze_event_pool_desc_t eventPoolDesc = {};
eventPoolDesc.count = 1;
eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_HOST_VISIBLE;
ze_event_desc_t eventDesc = {
ZE_EVENT_DESC_VERSION_CURRENT,
0,
ZE_EVENT_SCOPE_FLAG_DEVICE,
ZE_EVENT_SCOPE_FLAG_NONE};
ze_event_desc_t eventDesc = {};
eventDesc.index = 0;
eventDesc.signal = ZE_EVENT_SCOPE_FLAG_DEVICE;
auto eventPoolHostVisible = std::unique_ptr<EventPool>(EventPool::create(driverHandle.get(), 0, nullptr, &eventPoolDesc));
auto eventHostVisible = std::unique_ptr<Event>(Event::create(eventPoolHostVisible.get(), &eventDesc, device));

View File

@@ -103,8 +103,12 @@ HWTEST_F(CommandListAppendWaitOnEvent, givenEventWithWaitScopeFlagDeviceWhenAppe
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;
auto usedSpaceBefore = commandList->commandContainer.getCommandStream()->getUsed();
ze_event_desc_t eventDesc = {ZE_EVENT_DESC_VERSION_CURRENT, 1, ZE_EVENT_SCOPE_FLAG_NONE,
ZE_EVENT_SCOPE_FLAG_DEVICE};
const ze_event_desc_t eventDesc = {
ZE_STRUCTURE_TYPE_EVENT_DESC,
nullptr,
0,
0,
ZE_EVENT_SCOPE_FLAG_DEVICE};
auto event = std::unique_ptr<Event>(Event::create(eventPool.get(), &eventDesc, device));
ze_event_handle_t hEventHandle = event->toHandle();

View File

@@ -28,13 +28,7 @@ namespace ult {
using CommandQueueCreate = Test<DeviceFixture>;
TEST_F(CommandQueueCreate, whenCreatingCommandQueueThenItIsInitialized) {
const ze_command_queue_desc_t desc = {
ZE_COMMAND_QUEUE_DESC_VERSION_CURRENT,
ZE_COMMAND_QUEUE_FLAG_NONE,
ZE_COMMAND_QUEUE_MODE_DEFAULT,
ZE_COMMAND_QUEUE_PRIORITY_NORMAL,
0};
const ze_command_queue_desc_t desc = {};
auto csr = std::unique_ptr<NEO::CommandStreamReceiver>(neoDevice->createCommandStreamReceiver());
L0::CommandQueue *commandQueue = CommandQueue::create(productFamily,
@@ -53,144 +47,6 @@ TEST_F(CommandQueueCreate, whenCreatingCommandQueueThenItIsInitialized) {
commandQueue->destroy();
}
TEST_F(CommandQueueCreate, givenOrdinalThenQueueIsCreatedOnlyIfOrdinalIsLessThanNumOfAsyncComputeEngines) {
ze_device_properties_t deviceProperties;
ze_result_t res = device->getProperties(&deviceProperties);
EXPECT_EQ(ZE_RESULT_SUCCESS, res);
auto expectedNumOfComputeEngines = NEO::HwHelper::getEnginesCount(device->getNEODevice()->getHardwareInfo());
EXPECT_EQ(expectedNumOfComputeEngines, deviceProperties.numAsyncComputeEngines);
ze_command_queue_desc_t desc = {};
desc.version = ZE_COMMAND_QUEUE_DESC_VERSION_CURRENT;
desc.ordinal = deviceProperties.numAsyncComputeEngines;
ze_command_queue_handle_t commandQueue = {};
res = device->createCommandQueue(&desc, &commandQueue);
EXPECT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, res);
EXPECT_EQ(nullptr, commandQueue);
std::vector<ze_command_queue_handle_t> commandQueueVector;
for (uint32_t i = 0; i < expectedNumOfComputeEngines; i++) {
desc.ordinal = i;
res = device->createCommandQueue(&desc, &commandQueue);
EXPECT_EQ(ZE_RESULT_SUCCESS, res);
EXPECT_NE(nullptr, commandQueue);
commandQueueVector.push_back(commandQueue);
}
for (uint32_t i = 0; i < expectedNumOfComputeEngines; i++) {
for (uint32_t j = 0; j < expectedNumOfComputeEngines; j++) {
if (i == j) {
continue;
}
EXPECT_NE(static_cast<CommandQueue *>(commandQueueVector[i])->getCsr(),
static_cast<CommandQueue *>(commandQueueVector[j])->getCsr());
}
}
for (auto commandQueue : commandQueueVector) {
L0::CommandQueue::fromHandle(commandQueue)->destroy();
}
}
TEST_F(CommandQueueCreate, givenOrdinalWhenQueueIsCreatedThenCorrectEngineIsSelected) {
ze_device_properties_t deviceProperties;
ze_result_t res = device->getProperties(&deviceProperties);
EXPECT_EQ(ZE_RESULT_SUCCESS, res);
auto numOfComputeEngines = NEO::HwHelper::getEnginesCount(device->getNEODevice()->getHardwareInfo());
ze_command_queue_desc_t desc = {};
desc.version = ZE_COMMAND_QUEUE_DESC_VERSION_CURRENT;
ze_command_queue_handle_t commandQueue = {};
auto &hwHelper = NEO::HwHelper::get(defaultHwInfo->platform.eRenderCoreFamily);
for (uint32_t i = 0; i < numOfComputeEngines; i++) {
desc.ordinal = i;
res = device->createCommandQueue(&desc, &commandQueue);
EXPECT_EQ(ZE_RESULT_SUCCESS, res);
ASSERT_NE(nullptr, commandQueue);
EXPECT_EQ(device->getNEODevice()->getEngine(hwHelper.getComputeEngineIndexByOrdinal(*defaultHwInfo, i)).commandStreamReceiver,
static_cast<CommandQueue *>(commandQueue)->getCsr());
L0::CommandQueue::fromHandle(commandQueue)->destroy();
}
}
struct MultiDeviceCommandQueueCreateTest : public ::testing::Test {
void SetUp() override {
DebugManager.flags.CreateMultipleSubDevices.set(numSubDevices);
auto executionEnvironment = new NEO::ExecutionEnvironment;
auto devices = NEO::DeviceFactory::createDevices(*executionEnvironment);
driverHandle = std::make_unique<Mock<L0::DriverHandleImp>>();
driverHandle->initialize(std::move(devices));
}
DebugManagerStateRestore restorer;
std::unique_ptr<Mock<L0::DriverHandleImp>> driverHandle;
const uint32_t numSubDevices = 2u;
void verifyCreationOfAllCommandQueuesAvailable(L0::Device *device) {
ze_device_properties_t deviceProperties;
ze_result_t res = device->getProperties(&deviceProperties);
EXPECT_EQ(ZE_RESULT_SUCCESS, res);
uint32_t numOfComputeEngines = NEO::HwHelper::getEnginesCount(device->getNEODevice()->getHardwareInfo());
EXPECT_EQ(numOfComputeEngines, deviceProperties.numAsyncComputeEngines);
ze_command_queue_desc_t desc = {};
desc.version = ZE_COMMAND_QUEUE_DESC_VERSION_CURRENT;
ze_command_queue_handle_t commandQueue = {};
auto &hwHelper = NEO::HwHelper::get(defaultHwInfo->platform.eRenderCoreFamily);
for (uint32_t i = 0; i < numOfComputeEngines; i++) {
desc.ordinal = i;
res = device->createCommandQueue(&desc, &commandQueue);
EXPECT_EQ(ZE_RESULT_SUCCESS, res);
ASSERT_NE(nullptr, commandQueue);
uint32_t engineIndex = hwHelper.getComputeEngineIndexByOrdinal(*defaultHwInfo,
desc.ordinal);
if (device->getNEODevice()->getNumAvailableDevices() > 1) {
EXPECT_EQ(device->getNEODevice()->getDeviceById(0)->getEngine(engineIndex).commandStreamReceiver,
static_cast<CommandQueue *>(commandQueue)->getCsr());
} else {
EXPECT_EQ(device->getNEODevice()->getEngine(engineIndex).commandStreamReceiver,
static_cast<CommandQueue *>(commandQueue)->getCsr());
}
L0::CommandQueue::fromHandle(commandQueue)->destroy();
}
}
};
TEST_F(MultiDeviceCommandQueueCreateTest, givenOrdinalWhenQueueIsCreatedThenCorrectEngineIsSelected) {
L0::Device *device = driverHandle->devices[0];
verifyCreationOfAllCommandQueuesAvailable(device);
uint32_t count = 0;
ze_result_t result = device->getSubDevices(&count, nullptr);
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
EXPECT_EQ(numSubDevices, count);
std::vector<ze_device_handle_t> subDevices(count);
result = device->getSubDevices(&count, subDevices.data());
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
for (auto subDevice : subDevices) {
verifyCreationOfAllCommandQueuesAvailable(Device::fromHandle(subDevice));
}
}
using CommandQueueSBASupport = IsWithinProducts<IGFX_SKYLAKE, IGFX_TIGERLAKE_LP>;
struct MockMemoryManagerCommandQueueSBA : public MemoryManagerMock {
@@ -232,7 +88,6 @@ struct CommandQueueProgramSBATest : public ::testing::Test {
HWTEST2_F(CommandQueueProgramSBATest, whenCreatingCommandQueueThenItIsInitialized, CommandQueueSBASupport) {
ze_command_queue_desc_t desc = {};
desc.version = ZE_COMMAND_QUEUE_DESC_VERSION_CURRENT;
auto csr = std::unique_ptr<NEO::CommandStreamReceiver>(neoDevice->createCommandStreamReceiver());
auto commandQueue = new MockCommandQueueHw<gfxCoreFamily>(device, csr.get(), &desc);
commandQueue->initialize(false);
@@ -254,12 +109,7 @@ HWTEST2_F(CommandQueueProgramSBATest, whenCreatingCommandQueueThenItIsInitialize
}
TEST_F(CommandQueueCreate, givenCmdQueueWithBlitCopyWhenExecutingNonCopyBlitCommandListThenWrongCommandListStatusReturned) {
const ze_command_queue_desc_t desc = {
ZE_COMMAND_QUEUE_DESC_VERSION_CURRENT,
ZE_COMMAND_QUEUE_FLAG_COPY_ONLY,
ZE_COMMAND_QUEUE_MODE_DEFAULT,
ZE_COMMAND_QUEUE_PRIORITY_NORMAL,
0};
const ze_command_queue_desc_t desc = {};
auto csr = std::unique_ptr<NEO::CommandStreamReceiver>(neoDevice->createCommandStreamReceiver());
@@ -280,12 +130,7 @@ TEST_F(CommandQueueCreate, givenCmdQueueWithBlitCopyWhenExecutingNonCopyBlitComm
}
TEST_F(CommandQueueCreate, givenCmdQueueWithBlitCopyWhenExecutingCopyBlitCommandListThenSuccessReturned) {
const ze_command_queue_desc_t desc = {
ZE_COMMAND_QUEUE_DESC_VERSION_CURRENT,
ZE_COMMAND_QUEUE_FLAG_COPY_ONLY,
ZE_COMMAND_QUEUE_MODE_DEFAULT,
ZE_COMMAND_QUEUE_PRIORITY_NORMAL,
0};
const ze_command_queue_desc_t desc = {};
auto defaultCsr = neoDevice->getDefaultEngine().commandStreamReceiver;
L0::CommandQueue *commandQueue = CommandQueue::create(productFamily,
@@ -309,7 +154,6 @@ using CommandQueueDestroy = Test<DeviceFixture>;
HWTEST2_F(CommandQueueDestroy, whenCommandQueueDestroyIsCalledPrintPrintfOutputIsCalled, CommandQueueDestroySupport) {
ze_command_queue_desc_t desc = {};
desc.version = ZE_COMMAND_QUEUE_DESC_VERSION_CURRENT;
auto csr = std::unique_ptr<NEO::CommandStreamReceiver>(neoDevice->createCommandStreamReceiver());
auto commandQueue = new MockCommandQueueHw<gfxCoreFamily>(device, csr.get(), &desc);
commandQueue->initialize(false);
@@ -324,12 +168,7 @@ HWTEST2_F(CommandQueueDestroy, whenCommandQueueDestroyIsCalledPrintPrintfOutputI
using CommandQueueCommands = Test<DeviceFixture>;
HWTEST_F(CommandQueueCommands, givenCommandQueueWhenExecutingCommandListsThenHardwareContextIsProgrammedAndGlobalAllocationResident) {
const ze_command_queue_desc_t desc = {
ZE_COMMAND_QUEUE_DESC_VERSION_CURRENT,
ZE_COMMAND_QUEUE_FLAG_NONE,
ZE_COMMAND_QUEUE_MODE_DEFAULT,
ZE_COMMAND_QUEUE_PRIORITY_NORMAL,
0};
const ze_command_queue_desc_t desc = {};
MockCsrHw2<FamilyType> csr(*neoDevice->getExecutionEnvironment(), 0);
csr.initializeTagAllocation();
@@ -364,12 +203,7 @@ HWTEST_F(CommandQueueCommands, givenCommandQueueWhenExecutingCommandListsThenHar
using CommandQueueIndirectAllocations = Test<ModuleFixture>;
HWTEST_F(CommandQueueIndirectAllocations, givenCommandQueueWhenExecutingCommandListsThenExpectedIndirectAllocationsAddedToResidencyContainer) {
const ze_command_queue_desc_t desc = {
ZE_COMMAND_QUEUE_DESC_VERSION_CURRENT,
ZE_COMMAND_QUEUE_FLAG_NONE,
ZE_COMMAND_QUEUE_MODE_DEFAULT,
ZE_COMMAND_QUEUE_PRIORITY_NORMAL,
0};
const ze_command_queue_desc_t desc = {};
MockCsrHw2<FamilyType> csr(*neoDevice->getExecutionEnvironment(), 0);
csr.initializeTagAllocation();
@@ -385,7 +219,7 @@ HWTEST_F(CommandQueueIndirectAllocations, givenCommandQueueWhenExecutingCommandL
std::unique_ptr<L0::CommandList> commandList(CommandList::create(productFamily, device, true));
void *deviceAlloc = nullptr;
auto result = device->getDriverHandle()->allocDeviceMem(device->toHandle(), ZE_DEVICE_MEM_ALLOC_FLAG_DEFAULT, 16384u, 4096u, &deviceAlloc);
auto result = device->getDriverHandle()->allocDeviceMem(device->toHandle(), 0u, 16384u, 4096u, &deviceAlloc);
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
auto gpuAlloc = device->getDriverHandle()->getSvmAllocsManager()->getSVMAllocs()->get(deviceAlloc)->gpuAllocations.getGraphicsAllocation(device->getRootDeviceIndex());
@@ -425,7 +259,6 @@ using ContextCreateCommandQueueTest = Test<ContextFixture>;
TEST_F(ContextCreateCommandQueueTest, givenCallToContextCreateCommandQueueThenCallSucceeds) {
ze_command_queue_desc_t desc = {};
desc.version = ZE_COMMAND_QUEUE_DESC_VERSION_CURRENT;
desc.ordinal = 0u;
ze_command_queue_handle_t commandQueue = {};

View File

@@ -26,7 +26,7 @@ TEST_F(DeviceWithDebuggerEnabledTest, givenDebuggingEnabledWhenModuleIsCreatedTh
debugger->isOptDisabled = true;
uint8_t binary[10];
ze_module_desc_t moduleDesc = {ZE_MODULE_DESC_VERSION_CURRENT};
ze_module_desc_t moduleDesc = {};
moduleDesc.format = ZE_MODULE_FORMAT_IL_SPIRV;
moduleDesc.pInputModule = binary;
moduleDesc.inputSize = 10;
@@ -47,7 +47,7 @@ TEST_F(DeviceWithDebuggerEnabledTest, GivenDebuggeableKernelWhenModuleIsInitiali
device->getExecutionEnvironment()->rootDeviceEnvironments[device->getRootDeviceIndex()]->compilerInterface.reset(cip);
uint8_t binary[10];
ze_module_desc_t moduleDesc = {ZE_MODULE_DESC_VERSION_CURRENT};
ze_module_desc_t moduleDesc = {};
moduleDesc.format = ZE_MODULE_FORMAT_IL_SPIRV;
moduleDesc.pInputModule = binary;
moduleDesc.inputSize = 10;
@@ -79,7 +79,7 @@ TEST_F(DeviceWithDebuggerEnabledTest, GivenNonDebuggeableKernelWhenModuleIsIniti
device->getExecutionEnvironment()->rootDeviceEnvironments[device->getRootDeviceIndex()]->compilerInterface.reset(cip);
uint8_t binary[10];
ze_module_desc_t moduleDesc = {ZE_MODULE_DESC_VERSION_CURRENT};
ze_module_desc_t moduleDesc = {};
moduleDesc.format = ZE_MODULE_FORMAT_IL_SPIRV;
moduleDesc.pInputModule = binary;
moduleDesc.inputSize = 10;

View File

@@ -71,40 +71,25 @@ TEST_F(DeviceTest, givenEmptySVmAllocStorageWhenAllocateMemoryFromHostPtrThenVal
}
TEST_F(DeviceTest, givenKernelPropertiesStructureWhenKernelPropertiesCalledThenAllPropertiesAreAssigned) {
ze_device_kernel_properties_t kernelProperties, kernelPropertiesBefore;
memset(&kernelProperties, std::numeric_limits<int>::max(), sizeof(ze_device_kernel_properties_t));
const auto &hardwareInfo = this->neoDevice->getHardwareInfo();
ze_device_module_properties_t kernelProperties, kernelPropertiesBefore;
memset(&kernelProperties, std::numeric_limits<int>::max(), sizeof(ze_device_module_properties_t));
kernelPropertiesBefore = kernelProperties;
device->getKernelProperties(&kernelProperties);
EXPECT_NE(kernelPropertiesBefore.spirvVersionSupported, kernelProperties.spirvVersionSupported);
EXPECT_NE(kernelPropertiesBefore.nativeKernelSupported.id, kernelProperties.nativeKernelSupported.id);
EXPECT_NE(kernelPropertiesBefore.fp16Supported, kernelProperties.fp16Supported);
EXPECT_NE(kernelPropertiesBefore.fp64Supported, kernelProperties.fp64Supported);
EXPECT_NE(kernelPropertiesBefore.int64AtomicsSupported, kernelProperties.int64AtomicsSupported);
EXPECT_TRUE(kernelPropertiesBefore.flags & ZE_DEVICE_MODULE_FLAG_FP16);
if (hardwareInfo.capabilityTable.ftrSupportsInteger64BitAtomics) {
EXPECT_TRUE(kernelPropertiesBefore.flags & ZE_DEVICE_MODULE_FLAG_INT64_ATOMICS);
}
EXPECT_NE(kernelPropertiesBefore.maxArgumentsSize, kernelProperties.maxArgumentsSize);
EXPECT_NE(kernelPropertiesBefore.printfBufferSize, kernelProperties.printfBufferSize);
}
TEST_F(DeviceTest, givenDeviceWithCopyEngineThenNumAsyncCopyEnginesDevicePropertyIsCorrectlyReturned) {
ze_device_properties_t deviceProperties;
deviceProperties.version = ZE_DEVICE_PROPERTIES_VERSION_CURRENT;
deviceProperties.numAsyncCopyEngines = std::numeric_limits<int>::max();
device->getProperties(&deviceProperties);
auto expecteNumOfCopyEngines = NEO::HwHelper::getCopyEnginesCount(device->getNEODevice()->getHardwareInfo());
EXPECT_EQ(expecteNumOfCopyEngines, deviceProperties.numAsyncCopyEngines);
}
TEST_F(DeviceTest, givenDeviceWithComputeEngineThenNumAsyncComputeEnginesDevicePropertyIsCorrectlyReturned) {
ze_device_properties_t deviceProperties;
deviceProperties.version = ZE_DEVICE_PROPERTIES_VERSION_CURRENT;
deviceProperties.numAsyncComputeEngines = std::numeric_limits<int>::max();
device->getProperties(&deviceProperties);
auto expectedNumOfComputeEngines = NEO::HwHelper::getEnginesCount(device->getNEODevice()->getHardwareInfo());
EXPECT_EQ(expectedNumOfComputeEngines, deviceProperties.numAsyncComputeEngines);
}
TEST_F(DeviceTest, givenDevicePropertiesStructureWhenDevicePropertiesCalledThenAllPropertiesAreAssigned) {
ze_device_properties_t deviceProperties, devicePropertiesBefore;
@@ -112,15 +97,8 @@ TEST_F(DeviceTest, givenDevicePropertiesStructureWhenDevicePropertiesCalledThenA
memset(&deviceProperties.vendorId, std::numeric_limits<int>::max(), sizeof(deviceProperties.vendorId));
memset(&deviceProperties.deviceId, std::numeric_limits<int>::max(), sizeof(deviceProperties.deviceId));
memset(&deviceProperties.uuid, std::numeric_limits<int>::max(), sizeof(deviceProperties.uuid));
memset(&deviceProperties.isSubdevice, std::numeric_limits<int>::max(), sizeof(deviceProperties.isSubdevice));
memset(&deviceProperties.subdeviceId, std::numeric_limits<int>::max(), sizeof(deviceProperties.subdeviceId));
memset(&deviceProperties.coreClockRate, std::numeric_limits<int>::max(), sizeof(deviceProperties.coreClockRate));
memset(&deviceProperties.unifiedMemorySupported, std::numeric_limits<int>::max(), sizeof(deviceProperties.unifiedMemorySupported));
memset(&deviceProperties.eccMemorySupported, std::numeric_limits<int>::max(), sizeof(deviceProperties.eccMemorySupported));
memset(&deviceProperties.onDemandPageFaultsSupported, std::numeric_limits<int>::max(), sizeof(deviceProperties.onDemandPageFaultsSupported));
memset(&deviceProperties.maxCommandQueues, std::numeric_limits<int>::max(), sizeof(deviceProperties.maxCommandQueues));
memset(&deviceProperties.numAsyncComputeEngines, std::numeric_limits<int>::max(), sizeof(deviceProperties.numAsyncComputeEngines));
memset(&deviceProperties.numAsyncCopyEngines, std::numeric_limits<int>::max(), sizeof(deviceProperties.numAsyncCopyEngines));
memset(&deviceProperties.maxCommandQueuePriority, std::numeric_limits<int>::max(), sizeof(deviceProperties.maxCommandQueuePriority));
memset(&deviceProperties.numThreadsPerEU, std::numeric_limits<int>::max(), sizeof(deviceProperties.numThreadsPerEU));
memset(&deviceProperties.physicalEUSimdWidth, std::numeric_limits<int>::max(), sizeof(deviceProperties.physicalEUSimdWidth));
@@ -137,15 +115,8 @@ TEST_F(DeviceTest, givenDevicePropertiesStructureWhenDevicePropertiesCalledThenA
EXPECT_NE(deviceProperties.vendorId, devicePropertiesBefore.vendorId);
EXPECT_NE(deviceProperties.deviceId, devicePropertiesBefore.deviceId);
EXPECT_NE(0, memcmp(&deviceProperties.uuid, &devicePropertiesBefore.uuid, sizeof(devicePropertiesBefore.uuid)));
EXPECT_NE(deviceProperties.isSubdevice, devicePropertiesBefore.isSubdevice);
EXPECT_NE(deviceProperties.subdeviceId, devicePropertiesBefore.subdeviceId);
EXPECT_NE(deviceProperties.coreClockRate, devicePropertiesBefore.coreClockRate);
EXPECT_NE(deviceProperties.unifiedMemorySupported, devicePropertiesBefore.unifiedMemorySupported);
EXPECT_NE(deviceProperties.eccMemorySupported, devicePropertiesBefore.eccMemorySupported);
EXPECT_NE(deviceProperties.onDemandPageFaultsSupported, devicePropertiesBefore.onDemandPageFaultsSupported);
EXPECT_NE(deviceProperties.maxCommandQueues, devicePropertiesBefore.maxCommandQueues);
EXPECT_NE(deviceProperties.numAsyncComputeEngines, devicePropertiesBefore.numAsyncComputeEngines);
EXPECT_NE(deviceProperties.numAsyncCopyEngines, devicePropertiesBefore.numAsyncCopyEngines);
EXPECT_NE(deviceProperties.maxCommandQueuePriority, devicePropertiesBefore.maxCommandQueuePriority);
EXPECT_NE(deviceProperties.numThreadsPerEU, devicePropertiesBefore.numThreadsPerEU);
EXPECT_NE(deviceProperties.physicalEUSimdWidth, devicePropertiesBefore.physicalEUSimdWidth);
@@ -190,20 +161,22 @@ struct DeviceHasNoDoubleFp64Test : public ::testing::Test {
};
TEST_F(DeviceHasNoDoubleFp64Test, givenDeviceThatDoesntHaveFp64WhenDbgFlagEnablesFp64ThenReportFp64Flags) {
ze_device_kernel_properties_t kernelProperties;
memset(&kernelProperties, std::numeric_limits<int>::max(), sizeof(ze_device_kernel_properties_t));
ze_device_module_properties_t kernelProperties;
memset(&kernelProperties, std::numeric_limits<int>::max(), sizeof(ze_device_module_properties_t));
device->getKernelProperties(&kernelProperties);
EXPECT_EQ(ZE_FP_CAPS_NONE, kernelProperties.doubleFpCapabilities);
EXPECT_EQ(ZE_FP_CAPS_NONE, kernelProperties.singleFpCapabilities);
EXPECT_EQ(0u, kernelProperties.fp64flags);
DebugManagerStateRestore dbgRestorer;
DebugManager.flags.OverrideDefaultFP64Settings.set(1);
device->getKernelProperties(&kernelProperties);
EXPECT_EQ(true, kernelProperties.fp64Supported);
EXPECT_NE(ZE_FP_CAPS_NONE, kernelProperties.doubleFpCapabilities);
EXPECT_EQ(ZE_FP_CAPS_ROUNDED_DIVIDE_SQRT, kernelProperties.singleFpCapabilities);
EXPECT_TRUE(kernelProperties.fp64flags & ZE_DEVICE_FP_FLAG_ROUND_TO_NEAREST);
EXPECT_TRUE(kernelProperties.fp64flags & ZE_DEVICE_FP_FLAG_ROUND_TO_ZERO);
EXPECT_TRUE(kernelProperties.fp64flags & ZE_DEVICE_FP_FLAG_ROUND_TO_INF);
EXPECT_TRUE(kernelProperties.fp64flags & ZE_DEVICE_FP_FLAG_INF_NAN);
EXPECT_TRUE(kernelProperties.fp64flags & ZE_DEVICE_FP_FLAG_DENORM);
EXPECT_TRUE(kernelProperties.fp64flags & ZE_DEVICE_FP_FLAG_FMA);
}
struct MockMemoryManagerMultiDevice : public MemoryManagerMock {
@@ -453,52 +426,6 @@ TEST_F(MultipleDevicesSameFamilyAndLocalMemorySupportTest, givenTwoDevicesFromSa
EXPECT_FALSE(canAccess);
}
TEST_F(DeviceTest, givenBlitterSupportAndCopyOnlyFlagWhenCopyOnlyDebugFlagIsDefaultThenUseBliterIsTrueAndSuccessIsReturned) {
NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo.get();
hwInfo.capabilityTable.blitterOperationsSupported = true;
auto *neoMockDevice = NEO::MockDevice::createWithNewExecutionEnvironment<NEO::MockDevice>(&hwInfo, rootDeviceIndex);
Mock<L0::DeviceImp> l0Device(neoMockDevice, neoDevice->getExecutionEnvironment());
ze_command_list_desc_t desc = {};
desc.flags = ZE_COMMAND_LIST_FLAG_COPY_ONLY;
auto flag = ZE_COMMAND_LIST_FLAG_COPY_ONLY;
bool useBliter = false;
ze_result_t res = l0Device.isCreatedCommandListCopyOnly(&desc, &useBliter, flag);
EXPECT_TRUE(useBliter);
EXPECT_EQ(ZE_RESULT_SUCCESS, res);
}
TEST_F(DeviceTest, givenBlitterSupportAndCopyOnlyFlagWhenCopyOnlyDebugFlagIsSetToZeroThenUseBliterIsFalseAndSuccessIsReturned) {
DebugManagerStateRestore dbgRestore;
DebugManager.flags.EnableCopyOnlyCommandListsAndCommandQueues.set(0);
NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo.get();
hwInfo.capabilityTable.blitterOperationsSupported = true;
auto *neoMockDevice = NEO::MockDevice::createWithNewExecutionEnvironment<NEO::MockDevice>(&hwInfo, rootDeviceIndex);
Mock<L0::DeviceImp> l0Device(neoMockDevice, neoDevice->getExecutionEnvironment());
ze_command_list_desc_t desc = {};
desc.flags = ZE_COMMAND_LIST_FLAG_COPY_ONLY;
auto flag = ZE_COMMAND_LIST_FLAG_COPY_ONLY;
bool useBliter = true;
ze_result_t res = l0Device.isCreatedCommandListCopyOnly(&desc, &useBliter, flag);
EXPECT_FALSE(useBliter);
EXPECT_EQ(ZE_RESULT_SUCCESS, res);
}
TEST_F(DeviceTest, givenBlitterSupportAndCopyOnlyFlagWhenCopyOnlyDebugFlagIsSetToOneThenUseBliterIsTrueAndSuccessIsReturned) {
DebugManagerStateRestore dbgRestore;
DebugManager.flags.EnableCopyOnlyCommandListsAndCommandQueues.set(1);
NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo.get();
hwInfo.capabilityTable.blitterOperationsSupported = true;
auto *neoMockDevice = NEO::MockDevice::createWithNewExecutionEnvironment<NEO::MockDevice>(&hwInfo, rootDeviceIndex);
Mock<L0::DeviceImp> l0Device(neoMockDevice, neoDevice->getExecutionEnvironment());
ze_command_list_desc_t desc = {};
desc.flags = ZE_COMMAND_LIST_FLAG_COPY_ONLY;
auto flag = ZE_COMMAND_LIST_FLAG_COPY_ONLY;
bool useBliter = false;
ze_result_t res = l0Device.isCreatedCommandListCopyOnly(&desc, &useBliter, flag);
EXPECT_TRUE(useBliter);
EXPECT_EQ(ZE_RESULT_SUCCESS, res);
}
TEST_F(DeviceTest, givenNoActiveSourceLevelDebuggerWhenGetIsCalledThenNullptrIsReturned) {
EXPECT_EQ(nullptr, device->getSourceLevelDebugger());
}

View File

@@ -14,13 +14,13 @@
namespace L0 {
namespace ult {
using EventPoolCreate = Test<DeviceFixture>;
using EventCreate = Test<DeviceFixture>;
TEST_F(EventPoolCreate, allocationContainsAtLeast16Bytes) {
ze_event_pool_desc_t eventPoolDesc = {
ZE_EVENT_POOL_DESC_VERSION_CURRENT,
ZE_STRUCTURE_TYPE_EVENT_POOL_DESC,
nullptr,
ZE_EVENT_POOL_FLAG_HOST_VISIBLE,
1};
@@ -35,10 +35,9 @@ TEST_F(EventPoolCreate, allocationContainsAtLeast16Bytes) {
}
TEST_F(EventPoolCreate, givenTimestampEventsThenEventSizeSufficientForAllKernelTimestamps) {
ze_event_pool_desc_t eventPoolDesc = {
ZE_EVENT_POOL_DESC_VERSION_CURRENT,
ZE_EVENT_POOL_FLAG_TIMESTAMP,
1};
ze_event_pool_desc_t eventPoolDesc = {};
eventPoolDesc.count = 1;
eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP;
std::unique_ptr<L0::EventPool> eventPool(EventPool::create(driverHandle.get(), 0, nullptr, &eventPoolDesc));
ASSERT_NE(nullptr, eventPool);
@@ -49,15 +48,14 @@ TEST_F(EventPoolCreate, givenTimestampEventsThenEventSizeSufficientForAllKernelT
}
TEST_F(EventPoolCreate, givenAnEventIsCreatedFromThisEventPoolThenEventContainsDeviceCommandStreamReceiver) {
ze_event_pool_desc_t eventPoolDesc = {
ZE_EVENT_POOL_DESC_VERSION_CURRENT,
ZE_EVENT_POOL_FLAG_HOST_VISIBLE,
1};
const ze_event_desc_t eventDesc = {
ZE_EVENT_DESC_VERSION_CURRENT,
0,
ZE_EVENT_SCOPE_FLAG_HOST,
ZE_EVENT_SCOPE_FLAG_HOST};
ze_event_pool_desc_t eventPoolDesc = {};
eventPoolDesc.count = 1;
eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_HOST_VISIBLE;
ze_event_desc_t eventDesc = {};
eventDesc.index = 0;
eventDesc.signal = ZE_EVENT_SCOPE_FLAG_HOST;
eventDesc.wait = ZE_EVENT_SCOPE_FLAG_HOST;
ze_event_handle_t event = nullptr;
@@ -73,11 +71,13 @@ TEST_F(EventPoolCreate, givenAnEventIsCreatedFromThisEventPoolThenEventContainsD
TEST_F(EventCreate, givenAnEventCreatedThenTheEventHasTheDeviceCommandStreamReceiverSet) {
ze_event_pool_desc_t eventPoolDesc = {
ZE_EVENT_POOL_DESC_VERSION_CURRENT,
ZE_STRUCTURE_TYPE_EVENT_POOL_DESC,
nullptr,
ZE_EVENT_POOL_FLAG_HOST_VISIBLE,
1};
const ze_event_desc_t eventDesc = {
ZE_EVENT_DESC_VERSION_CURRENT,
ZE_STRUCTURE_TYPE_EVENT_DESC,
nullptr,
0,
ZE_EVENT_SCOPE_FLAG_DEVICE,
ZE_EVENT_SCOPE_FLAG_DEVICE};
@@ -93,12 +93,14 @@ TEST_F(EventCreate, givenAnEventCreatedThenTheEventHasTheDeviceCommandStreamRece
TEST_F(EventCreate, givenAnEventCreateWithInvalidIndexUsingThisEventPoolThenErrorIsReturned) {
ze_event_pool_desc_t eventPoolDesc = {
ZE_EVENT_POOL_DESC_VERSION_CURRENT,
ZE_STRUCTURE_TYPE_EVENT_POOL_DESC,
nullptr,
ZE_EVENT_POOL_FLAG_HOST_VISIBLE,
1};
const ze_event_desc_t eventDesc = {
ZE_EVENT_DESC_VERSION_CURRENT,
1,
ZE_STRUCTURE_TYPE_EVENT_DESC,
nullptr,
2,
ZE_EVENT_SCOPE_FLAG_DEVICE,
ZE_EVENT_SCOPE_FLAG_DEVICE};
@@ -115,7 +117,8 @@ TEST_F(EventCreate, givenAnEventCreateWithInvalidIndexUsingThisEventPoolThenErro
TEST_F(EventPoolCreate, returnsSuccessFromCreateEventPoolWithNoDevice) {
ze_event_pool_desc_t eventPoolDesc = {
ZE_EVENT_POOL_DESC_VERSION_CURRENT,
ZE_STRUCTURE_TYPE_EVENT_POOL_DESC,
nullptr,
ZE_EVENT_POOL_FLAG_HOST_VISIBLE,
4};
@@ -127,7 +130,8 @@ TEST_F(EventPoolCreate, returnsSuccessFromCreateEventPoolWithNoDevice) {
TEST_F(EventPoolCreate, returnsSuccessFromCreateEventPoolWithDevice) {
ze_event_pool_desc_t eventPoolDesc = {
ZE_EVENT_POOL_DESC_VERSION_CURRENT,
ZE_STRUCTURE_TYPE_EVENT_POOL_DESC,
nullptr,
ZE_EVENT_POOL_FLAG_HOST_VISIBLE,
4};
@@ -163,7 +167,8 @@ struct EventCreateAllocationResidencyTest : public ::testing::Test {
TEST_F(EventCreateAllocationResidencyTest,
givenEventCreateAndEventDestroyCallsThenMakeResidentAndEvictAreCalled) {
ze_event_pool_desc_t eventPoolDesc = {
ZE_EVENT_POOL_DESC_VERSION_CURRENT,
ZE_STRUCTURE_TYPE_EVENT_POOL_DESC,
nullptr,
ZE_EVENT_POOL_FLAG_HOST_VISIBLE,
1};
@@ -171,11 +176,12 @@ TEST_F(EventCreateAllocationResidencyTest,
auto eventPool = EventPool::create(driverHandle.get(), 1, &deviceHandle, &eventPoolDesc);
ASSERT_NE(nullptr, eventPool);
ze_event_desc_t eventDesc = {
ZE_EVENT_DESC_VERSION_CURRENT,
const ze_event_desc_t eventDesc = {
ZE_STRUCTURE_TYPE_EVENT_DESC,
nullptr,
0,
ZE_EVENT_SCOPE_FLAG_NONE,
ZE_EVENT_SCOPE_FLAG_NONE};
ZE_EVENT_SCOPE_FLAG_DEVICE,
ZE_EVENT_SCOPE_FLAG_DEVICE};
EXPECT_CALL(*mockMemoryOperationsHandler, makeResident).Times(1);
auto event = L0::Event::create(eventPool, &eventDesc, device);
@@ -195,16 +201,14 @@ class TimestampEventCreate : public Test<DeviceFixture> {
public:
void SetUp() override {
DeviceFixture::SetUp();
ze_event_pool_desc_t eventPoolDesc = {
ZE_EVENT_POOL_DESC_VERSION_CURRENT,
ZE_EVENT_POOL_FLAG_TIMESTAMP,
1};
ze_event_pool_desc_t eventPoolDesc = {};
eventPoolDesc.count = 1;
eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP;
ze_event_desc_t eventDesc = {
ZE_EVENT_DESC_VERSION_CURRENT,
0,
ZE_EVENT_SCOPE_FLAG_NONE,
ZE_EVENT_SCOPE_FLAG_NONE};
ze_event_desc_t eventDesc = {};
eventDesc.index = 0;
eventDesc.signal = 0;
eventDesc.wait = 0;
eventPool = std::unique_ptr<L0::EventPool>(L0::EventPool::create(driverHandle.get(), 0, nullptr, &eventPoolDesc));
ASSERT_NE(nullptr, eventPool);
@@ -224,20 +228,6 @@ TEST_F(TimestampEventCreate, givenEventCreatedWithTimestampThenIsTimestampEventF
EXPECT_TRUE(event->isTimestampEvent);
}
TEST_F(TimestampEventCreate, givenEventTimestampsNotTriggeredThenValuesInInitialState) {
uint64_t globalStart, globalEnd, contextStart, contextEnd;
event->getTimestamp(ZE_EVENT_TIMESTAMP_GLOBAL_START, &globalStart);
event->getTimestamp(ZE_EVENT_TIMESTAMP_GLOBAL_END, &globalEnd);
event->getTimestamp(ZE_EVENT_TIMESTAMP_CONTEXT_START, &contextStart);
event->getTimestamp(ZE_EVENT_TIMESTAMP_CONTEXT_END, &contextEnd);
EXPECT_EQ(static_cast<uint64_t>(Event::STATE_CLEARED), globalStart);
EXPECT_EQ(static_cast<uint64_t>(Event::STATE_CLEARED), globalEnd);
EXPECT_EQ(static_cast<uint64_t>(Event::STATE_CLEARED), contextStart);
EXPECT_EQ(static_cast<uint64_t>(Event::STATE_CLEARED), contextEnd);
}
TEST_F(TimestampEventCreate, givenSingleTimestampEventThenAllocationSizeCreatedForAllTimestamps) {
auto allocation = &eventPool->getAllocation();
ASSERT_NE(nullptr, allocation);

View File

@@ -81,8 +81,7 @@ HWTEST2_F(ImageCreate, givenValidImageDescriptionWhenImageCreateThenImageIsCreat
zeDesc.width = 1u;
zeDesc.miplevels = 1u;
zeDesc.type = ZE_IMAGE_TYPE_2DARRAY;
zeDesc.version = ZE_IMAGE_DESC_VERSION_CURRENT;
zeDesc.flags = ZE_IMAGE_FLAG_PROGRAM_READ;
zeDesc.flags = ZE_IMAGE_FLAG_BIAS_UNCACHED;
zeDesc.format = {ZE_IMAGE_FORMAT_LAYOUT_32,
ZE_IMAGE_FORMAT_TYPE_UINT,
@@ -174,15 +173,15 @@ HWTEST2_P(TestImageFormats, givenValidLayoutAndTypeWhenCreateImageCoreFamilyThen
zeDesc.width = 10u;
zeDesc.miplevels = 1u;
zeDesc.type = ZE_IMAGE_TYPE_2D;
zeDesc.version = ZE_IMAGE_DESC_VERSION_CURRENT;
zeDesc.flags = ZE_IMAGE_FLAG_PROGRAM_READ;
zeDesc.flags = ZE_IMAGE_FLAG_KERNEL_WRITE;
zeDesc.format = {params.first,
params.second,
ZE_IMAGE_FORMAT_SWIZZLE_R,
ZE_IMAGE_FORMAT_SWIZZLE_G,
ZE_IMAGE_FORMAT_SWIZZLE_B,
ZE_IMAGE_FORMAT_SWIZZLE_A};
zeDesc.format = {};
zeDesc.format.layout = params.first;
zeDesc.format.type = params.second;
zeDesc.format.x = ZE_IMAGE_FORMAT_SWIZZLE_R;
zeDesc.format.y = ZE_IMAGE_FORMAT_SWIZZLE_G;
zeDesc.format.z = ZE_IMAGE_FORMAT_SWIZZLE_B;
zeDesc.format.w = ZE_IMAGE_FORMAT_SWIZZLE_A;
auto imageHW = std::make_unique<WhiteBox<::L0::ImageCoreFamily<gfxCoreFamily>>>();
@@ -394,7 +393,7 @@ TEST(ImageFormatDescHelperTest, givenSwizzlesThenEqualityIsProperlyDetermined) {
}
TEST(ImageFormatDescHelperTest, givenSupportedSwizzlesThenProperClEnumIsReturned) {
ze_image_format_desc_t format{};
ze_image_format_t format{};
format.x = ZE_IMAGE_FORMAT_SWIZZLE_R;
format.y = ZE_IMAGE_FORMAT_SWIZZLE_0;

View File

@@ -208,8 +208,6 @@ class KernelPropertiesTests : public ModuleFixture, public ::testing::Test {
ModuleFixture::SetUp();
ze_kernel_desc_t kernelDesc = {};
kernelDesc.version = ZE_KERNEL_DESC_VERSION_CURRENT;
kernelDesc.flags = ZE_KERNEL_FLAG_NONE;
kernelDesc.pKernelName = kernelName.c_str();
ze_result_t res = module->createKernel(&kernelDesc, &kernelHandle);
@@ -248,14 +246,14 @@ HWTEST_F(KernelPropertiesTests, givenKernelThenCorrectNameIsRetrieved) {
}
HWTEST_F(KernelPropertiesTests, givenInvalidKernelThenUnitializedIsReturned) {
ze_kernel_propertiesExt_t kernelProperties = {};
ze_kernel_properties_t kernelProperties = {};
std::vector<KernelInfo *> prevKernelInfos;
L0::ModuleImp *moduleImp = reinterpret_cast<L0::ModuleImp *>(module.get());
moduleImp->getTranslationUnit()->programInfo.kernelInfos.swap(prevKernelInfos);
EXPECT_EQ(0u, moduleImp->getTranslationUnit()->programInfo.kernelInfos.size());
ze_result_t res = kernel->getPropertiesExt(&kernelProperties);
ze_result_t res = kernel->getProperties(&kernelProperties);
EXPECT_EQ(ZE_RESULT_ERROR_UNINITIALIZED, res);
prevKernelInfos.swap(moduleImp->getTranslationUnit()->programInfo.kernelInfos);
@@ -263,7 +261,7 @@ HWTEST_F(KernelPropertiesTests, givenInvalidKernelThenUnitializedIsReturned) {
}
HWTEST_F(KernelPropertiesTests, givenValidKernelThenPropertiesAreRetrieved) {
ze_kernel_propertiesExt_t kernelProperties = {};
ze_kernel_properties_t kernelProperties = {};
kernelProperties.requiredNumSubGroups = std::numeric_limits<uint32_t>::max();
kernelProperties.requiredSubgroupSize = std::numeric_limits<uint32_t>::max();
@@ -278,14 +276,12 @@ HWTEST_F(KernelPropertiesTests, givenValidKernelThenPropertiesAreRetrieved) {
memset(&kernelProperties.uuid.mid, std::numeric_limits<int>::max(),
sizeof(kernelProperties.uuid.mid));
ze_kernel_propertiesExt_t kernelPropertiesBefore = {};
ze_kernel_properties_t kernelPropertiesBefore = {};
kernelPropertiesBefore = kernelProperties;
ze_result_t res = kernel->getPropertiesExt(&kernelProperties);
ze_result_t res = kernel->getProperties(&kernelProperties);
EXPECT_EQ(ZE_RESULT_SUCCESS, res);
EXPECT_EQ(0, strncmp(kernelName.c_str(), kernelProperties.name,
sizeof(kernelProperties.name)));
EXPECT_EQ(numKernelArguments, kernelProperties.numKernelArgs);
L0::ModuleImp *moduleImp = reinterpret_cast<L0::ModuleImp *>(module.get());
@@ -334,14 +330,14 @@ HWTEST_F(KernelPropertiesTests, givenValidKernelThenPropertiesAreRetrieved) {
}
HWTEST_F(KernelPropertiesTests, givenValidKernelAndNoMediavfestateThenSpillMemSizeIsZero) {
ze_kernel_propertiesExt_t kernelProperties = {};
ze_kernel_properties_t kernelProperties = {};
kernelProperties.spillMemSize = std::numeric_limits<uint32_t>::max();
ze_kernel_propertiesExt_t kernelPropertiesBefore = {};
ze_kernel_properties_t kernelPropertiesBefore = {};
kernelPropertiesBefore = kernelProperties;
ze_result_t res = kernel->getPropertiesExt(&kernelProperties);
ze_result_t res = kernel->getProperties(&kernelProperties);
EXPECT_EQ(ZE_RESULT_SUCCESS, res);
L0::ModuleImp *moduleImp = reinterpret_cast<L0::ModuleImp *>(module.get());
@@ -358,14 +354,14 @@ HWTEST_F(KernelPropertiesTests, givenValidKernelAndNoMediavfestateThenSpillMemSi
}
HWTEST_F(KernelPropertiesTests, givenValidKernelAndNollocateStatelessPrivateSurfaceThenPrivateMemSizeIsZero) {
ze_kernel_propertiesExt_t kernelProperties = {};
ze_kernel_properties_t kernelProperties = {};
kernelProperties.spillMemSize = std::numeric_limits<uint32_t>::max();
ze_kernel_propertiesExt_t kernelPropertiesBefore = {};
ze_kernel_properties_t kernelPropertiesBefore = {};
kernelPropertiesBefore = kernelProperties;
ze_result_t res = kernel->getPropertiesExt(&kernelProperties);
ze_result_t res = kernel->getProperties(&kernelProperties);
EXPECT_EQ(ZE_RESULT_SUCCESS, res);
L0::ModuleImp *moduleImp = reinterpret_cast<L0::ModuleImp *>(module.get());

View File

@@ -23,13 +23,12 @@ TEST_F(MemoryTest, givenDevicePointerThenDriverGetAllocPropertiesReturnsDeviceHa
void *ptr = nullptr;
ze_result_t result = driverHandle->allocDeviceMem(device->toHandle(),
ZE_DEVICE_MEM_ALLOC_FLAG_DEFAULT,
0u,
size, alignment, &ptr);
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
EXPECT_NE(nullptr, ptr);
ze_memory_allocation_properties_t memoryProperties = {};
memoryProperties.version = ZE_MEMORY_ALLOCATION_PROPERTIES_VERSION_CURRENT;
ze_device_handle_t deviceHandle;
result = driverHandle->getMemAllocProperties(ptr, &memoryProperties, &deviceHandle);
@@ -50,7 +49,7 @@ TEST_F(DeviceMemorySizeTest, givenSizeGreaterThanLimitThenDeviceAllocationFails)
void *ptr = nullptr;
ze_result_t result = driverHandle->allocDeviceMem(nullptr,
ZE_DEVICE_MEM_ALLOC_FLAG_DEFAULT,
0u,
size, alignment, &ptr);
EXPECT_EQ(ZE_RESULT_ERROR_UNSUPPORTED_SIZE, result);
}
@@ -61,14 +60,13 @@ TEST_F(MemoryTest, givenSharedPointerThenDriverGetAllocPropertiesReturnsDeviceHa
void *ptr = nullptr;
ze_result_t result = driverHandle->allocSharedMem(device->toHandle(),
ZE_DEVICE_MEM_ALLOC_FLAG_DEFAULT,
ZE_HOST_MEM_ALLOC_FLAG_DEFAULT,
0u,
0u,
size, alignment, &ptr);
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
EXPECT_NE(nullptr, ptr);
ze_memory_allocation_properties_t memoryProperties = {};
memoryProperties.version = ZE_MEMORY_ALLOCATION_PROPERTIES_VERSION_CURRENT;
ze_device_handle_t deviceHandle;
result = driverHandle->getMemAllocProperties(ptr, &memoryProperties, &deviceHandle);
@@ -86,13 +84,12 @@ TEST_F(MemoryTest, givenHostPointerThenDriverGetAllocPropertiesReturnsNullDevice
size_t alignment = 1u;
void *ptr = nullptr;
ze_result_t result = driverHandle->allocHostMem(ZE_HOST_MEM_ALLOC_FLAG_DEFAULT,
ze_result_t result = driverHandle->allocHostMem(0u,
size, alignment, &ptr);
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
EXPECT_NE(nullptr, ptr);
ze_memory_allocation_properties_t memoryProperties = {};
memoryProperties.version = ZE_MEMORY_ALLOCATION_PROPERTIES_VERSION_CURRENT;
ze_device_handle_t deviceHandle;
result = driverHandle->getMemAllocProperties(ptr, &memoryProperties, &deviceHandle);
@@ -110,7 +107,6 @@ TEST_F(MemoryTest, givenSystemAllocatedPointerThenDriverGetAllocPropertiesReturn
int *ptr = new int[size];
ze_memory_allocation_properties_t memoryProperties = {};
memoryProperties.version = ZE_MEMORY_ALLOCATION_PROPERTIES_VERSION_CURRENT;
ze_device_handle_t deviceHandle;
ze_result_t result = driverHandle->getMemAllocProperties(ptr, &memoryProperties, &deviceHandle);
@@ -127,8 +123,8 @@ TEST_F(MemoryTest, givenSharedPointerAndDeviceHandleAsNullThenDriverReturnsSucce
ASSERT_NE(nullptr, device->toHandle());
ze_result_t result = driverHandle->allocSharedMem(nullptr,
ZE_DEVICE_MEM_ALLOC_FLAG_DEFAULT,
ZE_HOST_MEM_ALLOC_FLAG_DEFAULT,
0u,
0u,
size, alignment, &ptr);
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
EXPECT_NE(nullptr, ptr);
@@ -144,8 +140,8 @@ TEST_F(MemoryTest, givenNoDeviceWhenAllocatingSharedMemoryThenDeviceInAllocation
ASSERT_NE(nullptr, device->toHandle());
ze_result_t result = driverHandle->allocSharedMem(nullptr,
ZE_DEVICE_MEM_ALLOC_FLAG_DEFAULT,
ZE_HOST_MEM_ALLOC_FLAG_DEFAULT,
0u,
0u,
size, alignment, &ptr);
auto alloc = driverHandle->svmAllocsManager->getSVMAlloc(ptr);
EXPECT_EQ(alloc->device, nullptr);
@@ -193,14 +189,13 @@ struct MemoryBitfieldTest : testing::Test {
TEST_F(MemoryBitfieldTest, givenDeviceWithValidBitfieldWhenAllocatingDeviceMemoryThenPassProperBitfield) {
auto result = driverHandle->allocDeviceMem(device->toHandle(),
ZE_DEVICE_MEM_ALLOC_FLAG_DEFAULT,
0u,
size, alignment, &ptr);
EXPECT_EQ(neoDevice->getDeviceBitfield(), memoryManager->recentlyPassedDeviceBitfield);
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
EXPECT_NE(nullptr, ptr);
}
TEST(MemoryBitfieldTests, givenDeviceWithValidBitfieldWhenAllocatingSharedMemoryThenPassProperBitfield) {
DebugManagerStateRestore restorer;
size_t size = 10;
@@ -229,8 +224,8 @@ TEST(MemoryBitfieldTests, givenDeviceWithValidBitfieldWhenAllocatingSharedMemory
EXPECT_NE(neoDevice0->getDeviceBitfield(), neoDevice1->getDeviceBitfield());
EXPECT_NE(neoDevice0->getDeviceBitfield(), memoryManager->recentlyPassedDeviceBitfield);
auto result = driverHandle->allocSharedMem(nullptr,
ZE_DEVICE_MEM_ALLOC_FLAG_DEFAULT,
ZE_HOST_MEM_ALLOC_FLAG_DEFAULT,
ZE_DEVICE_MEMORY_PROPERTY_FLAG_TBD,
0u,
size, alignment, &ptr);
EXPECT_EQ(neoDevice0->getDeviceBitfield(), memoryManager->recentlyPassedDeviceBitfield);
@@ -242,8 +237,8 @@ TEST(MemoryBitfieldTests, givenDeviceWithValidBitfieldWhenAllocatingSharedMemory
memoryManager->recentlyPassedDeviceBitfield = {};
EXPECT_NE(neoDevice1->getDeviceBitfield(), memoryManager->recentlyPassedDeviceBitfield);
result = driverHandle->allocSharedMem(driverHandle->devices[1]->toHandle(),
ZE_DEVICE_MEM_ALLOC_FLAG_DEFAULT,
ZE_HOST_MEM_ALLOC_FLAG_DEFAULT,
ZE_DEVICE_MEMORY_PROPERTY_FLAG_TBD,
0u,
size, alignment, &ptr);
EXPECT_EQ(neoDevice1->getDeviceBitfield(), memoryManager->recentlyPassedDeviceBitfield);
@@ -310,7 +305,7 @@ TEST_F(AllocHostMemoryTest,
whenCallingAllocHostMemThenAllocateGraphicsMemoryWithPropertiesIsCalledTheNumberOfTimesOfRootDevices) {
void *ptr = nullptr;
ze_result_t result = driverHandle->allocHostMem(ZE_HOST_MEM_ALLOC_FLAG_DEFAULT,
ze_result_t result = driverHandle->allocHostMem(0u,
4096u, 0u, &ptr);
EXPECT_EQ(memoryManager->allocateGraphicsMemoryWithPropertiesCount, numRootDevices);
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
@@ -326,7 +321,7 @@ TEST_F(AllocHostMemoryTest,
void *ptr = nullptr;
ze_result_t result = driverHandle->allocHostMem(ZE_HOST_MEM_ALLOC_FLAG_DEFAULT,
ze_result_t result = driverHandle->allocHostMem(0u,
4096u, 0u, &ptr);
EXPECT_EQ(memoryManager->allocateGraphicsMemoryWithPropertiesCount, 1u);
EXPECT_EQ(ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY, result);
@@ -340,7 +335,7 @@ TEST_F(AllocHostMemoryTest,
void *ptr = nullptr;
ze_result_t result = driverHandle->allocHostMem(ZE_HOST_MEM_ALLOC_FLAG_DEFAULT,
ze_result_t result = driverHandle->allocHostMem(0u,
4096u, 0u, &ptr);
EXPECT_EQ(memoryManager->allocateGraphicsMemoryWithPropertiesCount, numRootDevices);
EXPECT_EQ(ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY, result);
@@ -355,8 +350,8 @@ TEST_F(ContextMemoryTest, whenAllocatingSharedAllocationFromContextThenAllocatio
void *ptr = nullptr;
ze_result_t result = context->allocSharedMem(device->toHandle(),
ZE_DEVICE_MEM_ALLOC_FLAG_DEFAULT,
ZE_HOST_MEM_ALLOC_FLAG_DEFAULT,
0u,
0u,
size, alignment, &ptr);
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
EXPECT_NE(nullptr, ptr);
@@ -370,7 +365,7 @@ TEST_F(ContextMemoryTest, whenAllocatingHostAllocationFromContextThenAllocationS
size_t alignment = 1u;
void *ptr = nullptr;
ze_result_t result = context->allocHostMem(ZE_HOST_MEM_ALLOC_FLAG_DEFAULT,
ze_result_t result = context->allocHostMem(0u,
size, alignment, &ptr);
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
EXPECT_NE(nullptr, ptr);
@@ -385,7 +380,7 @@ TEST_F(ContextMemoryTest, whenAllocatingDeviceAllocationFromContextThenAllocatio
void *ptr = nullptr;
ze_result_t result = context->allocDeviceMem(device->toHandle(),
ZE_DEVICE_MEM_ALLOC_FLAG_DEFAULT,
0u,
size, alignment, &ptr);
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
EXPECT_NE(nullptr, ptr);
@@ -400,7 +395,7 @@ TEST_F(ContextMemoryTest, whenRetrievingAddressRangeForDeviceAllocationThenRange
void *allocPtr = nullptr;
ze_result_t result = context->allocDeviceMem(device->toHandle(),
ZE_DEVICE_MEM_ALLOC_FLAG_DEFAULT,
0u,
allocSize, alignment, &allocPtr);
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
EXPECT_NE(nullptr, allocPtr);
@@ -422,7 +417,6 @@ TEST_F(ContextMemoryTest, givenSystemAllocatedPointerThenGetAllocPropertiesRetur
int *ptr = new int[size];
ze_memory_allocation_properties_t memoryProperties = {};
memoryProperties.version = ZE_MEMORY_ALLOCATION_PROPERTIES_VERSION_CURRENT;
ze_device_handle_t deviceHandle;
ze_result_t result = context->getMemAllocProperties(ptr, &memoryProperties, &deviceHandle);

View File

@@ -37,8 +37,6 @@ HWTEST_F(ModuleTest, givenKernelCreateReturnsSuccess) {
ze_kernel_handle_t kernelHandle;
ze_kernel_desc_t kernelDesc = {};
kernelDesc.version = ZE_KERNEL_DESC_VERSION_CURRENT;
kernelDesc.flags = ZE_KERNEL_FLAG_NONE;
kernelDesc.pKernelName = kernelName.c_str();
ze_result_t res = module->createKernel(&kernelDesc, &kernelHandle);
@@ -55,8 +53,6 @@ HWTEST2_F(ModuleTest, givenNonPatchedTokenThenSurfaceBaseAddressIsCorrectlySet,
ze_kernel_handle_t kernelHandle;
ze_kernel_desc_t kernelDesc = {};
kernelDesc.version = ZE_KERNEL_DESC_VERSION_CURRENT;
kernelDesc.flags = ZE_KERNEL_FLAG_NONE;
kernelDesc.pKernelName = kernelName.c_str();
ze_result_t res = module->createKernel(&kernelDesc, &kernelHandle);
@@ -67,7 +63,7 @@ HWTEST2_F(ModuleTest, givenNonPatchedTokenThenSurfaceBaseAddressIsCorrectlySet,
void *devicePtr = nullptr;
res = device->getDriverHandle()->allocDeviceMem(device->toHandle(),
ZE_DEVICE_MEM_ALLOC_FLAG_DEFAULT,
0u,
16384u,
0u,
&devicePtr);
@@ -93,8 +89,6 @@ HWTEST_F(ModuleTest, givenKernelCreateWithIncorrectKernelNameReturnsFailure) {
ze_kernel_handle_t kernelHandle;
ze_kernel_desc_t kernelDesc = {};
kernelDesc.version = ZE_KERNEL_DESC_VERSION_CURRENT;
kernelDesc.flags = ZE_KERNEL_FLAG_NONE;
kernelDesc.pKernelName = "nonexistent_function";
ze_result_t res = module->createKernel(&kernelDesc, &kernelHandle);
@@ -120,7 +114,7 @@ struct ModuleSpecConstantsTests : public DeviceFixture,
const uint32_t moduleNumSpecConstants = 4;
ze_module_constants_t specConstants;
std::vector<uint64_t> specConstantsPointerValues;
std::vector<const void *> specConstantsPointerValues;
const std::string binaryFilename = "test_kernel";
const std::string kernelName = "test";
@@ -138,14 +132,14 @@ HWTEST_F(ModuleSpecConstantsTests, givenSpecializationConstantsSetInDescriptorTh
ASSERT_NE(0u, size);
ASSERT_NE(nullptr, src);
ze_module_desc_t moduleDesc = {ZE_MODULE_DESC_VERSION_CURRENT};
ze_module_desc_t moduleDesc = {};
moduleDesc.format = ZE_MODULE_FORMAT_IL_SPIRV;
moduleDesc.pInputModule = reinterpret_cast<const uint8_t *>(src.get());
moduleDesc.inputSize = size;
specConstants.numConstants = mockCompiler->moduleNumSpecConstants;
for (uint32_t i = 0; i < mockCompiler->moduleNumSpecConstants; i++) {
specConstantsPointerValues.push_back(reinterpret_cast<uint64_t>(&mockCompiler->moduleSpecConstantsValues[i]));
specConstantsPointerValues.push_back(&mockCompiler->moduleSpecConstantsValues[i]);
}
specConstants.pConstantIds = mockCompiler->moduleSpecConstantsIds.data();
@@ -175,7 +169,7 @@ HWTEST_F(ModuleLinkingTest, givenFailureDuringLinkingWhenCreatingModuleThenModul
mockTranslationUnit->programInfo.linkerInput = std::move(linkerInput);
uint8_t spirvData{};
ze_module_desc_t moduleDesc = {ZE_MODULE_DESC_VERSION_CURRENT};
ze_module_desc_t moduleDesc = {};
moduleDesc.format = ZE_MODULE_FORMAT_IL_SPIRV;
moduleDesc.pInputModule = &spirvData;
moduleDesc.inputSize = sizeof(spirvData);
@@ -204,7 +198,7 @@ HWTEST_F(ModuleLinkingTest, givenRemainingUnresolvedSymbolsDuringLinkingWhenCrea
mockTranslationUnit->programInfo.linkerInput = std::move(linkerInput);
uint8_t spirvData{};
ze_module_desc_t moduleDesc = {ZE_MODULE_DESC_VERSION_CURRENT};
ze_module_desc_t moduleDesc = {};
moduleDesc.format = ZE_MODULE_FORMAT_IL_SPIRV;
moduleDesc.pInputModule = &spirvData;
moduleDesc.inputSize = sizeof(spirvData);
@@ -237,7 +231,6 @@ HWTEST_F(ModuleDynamicLinkTests, givenCallToDynamicLinkThenUnsupportedFeatureIsR
delete module0;
delete module1;
}
class MultiDeviceModuleSetArgBufferTest : public MultiDeviceModuleFixture, public ::testing::Test {
public:
void SetUp() override {
@@ -250,13 +243,11 @@ class MultiDeviceModuleSetArgBufferTest : public MultiDeviceModuleFixture, publi
void createKernelAndAllocMemory(uint32_t rootDeviceIndex, void **ptr, ze_kernel_handle_t *kernelHandle) {
ze_kernel_desc_t kernelDesc = {};
kernelDesc.version = ZE_KERNEL_DESC_VERSION_CURRENT;
kernelDesc.flags = ZE_KERNEL_FLAG_NONE;
kernelDesc.pKernelName = kernelName.c_str();
ze_result_t res = modules[rootDeviceIndex].get()->createKernel(&kernelDesc, kernelHandle);
EXPECT_EQ(ZE_RESULT_SUCCESS, res);
res = driverHandle->allocHostMem(ZE_HOST_MEM_ALLOC_FLAG_DEFAULT, 4096u, rootDeviceIndex, ptr);
res = driverHandle->allocHostMem(0u, 4096u, rootDeviceIndex, ptr);
EXPECT_EQ(ZE_RESULT_SUCCESS, res);
}
};
@@ -297,7 +288,7 @@ HWTEST_F(ContextModuleCreateTest, givenCallToCreateModuleThenModuleIsReturned) {
ASSERT_NE(0u, size);
ASSERT_NE(nullptr, src);
ze_module_desc_t moduleDesc = {ZE_MODULE_DESC_VERSION_CURRENT};
ze_module_desc_t moduleDesc = {};
moduleDesc.format = ZE_MODULE_FORMAT_NATIVE;
moduleDesc.pInputModule = reinterpret_cast<const uint8_t *>(src.get());
moduleDesc.inputSize = size;

View File

@@ -55,7 +55,6 @@ HWTEST2_P(SamplerCreateTest, givenDifferentDescriptorValuesThenSamplerIsCorrectl
ze_bool_t isNormalized = std::get<2>(GetParam());
ze_sampler_desc_t desc = {};
desc.version = ZE_SAMPLER_DESC_VERSION_CURRENT;
desc.addressMode = addressMode;
desc.filterMode = filterMode;
desc.isNormalized = isNormalized;
@@ -159,7 +158,6 @@ HWTEST2_F(ContextCreateSamplerTest, givenDifferentDescriptorValuesThenSamplerIsC
ze_bool_t isNormalized = false;
ze_sampler_desc_t desc = {};
desc.version = ZE_SAMPLER_DESC_VERSION_CURRENT;
desc.addressMode = addressMode;
desc.filterMode = filterMode;
desc.isNormalized = isNormalized;