Use device allocation for events if host visibility not set
Related-To: LOCI-1684 Signed-off-by: Aravind Gopalakrishnan <aravind.gopalakrishnan@intel.com>
This commit is contained in:
parent
3770410733
commit
b204a4f135
|
@ -214,35 +214,6 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendLaunchMultipleKernelsInd
|
|||
return ret;
|
||||
}
|
||||
|
||||
template <GFXCORE_FAMILY gfxCoreFamily>
|
||||
ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendEventReset(ze_event_handle_t hEvent) {
|
||||
using POST_SYNC_OPERATION = typename GfxFamily::PIPE_CONTROL::POST_SYNC_OPERATION;
|
||||
auto event = Event::fromHandle(hEvent);
|
||||
|
||||
uint64_t baseAddr = event->getGpuAddress();
|
||||
size_t eventOffset = 0;
|
||||
if (event->isTimestampEvent) {
|
||||
eventOffset = offsetof(TimestampPacketStorage::Packet, contextEnd);
|
||||
event->resetPackets();
|
||||
}
|
||||
commandContainer.addToResidencyContainer(&event->getAllocation());
|
||||
if (isCopyOnly()) {
|
||||
NEO::EncodeMiFlushDW<GfxFamily>::programMiFlushDw(*commandContainer.getCommandStream(), event->getGpuAddress(), Event::STATE_CLEARED, false, true);
|
||||
} else {
|
||||
NEO::PipeControlArgs args;
|
||||
args.dcFlushEnable = (!event->signalScope) ? false : true;
|
||||
NEO::MemorySynchronizationCommands<GfxFamily>::addPipeControlAndProgramPostSyncOperation(
|
||||
*commandContainer.getCommandStream(),
|
||||
POST_SYNC_OPERATION::POST_SYNC_OPERATION_WRITE_IMMEDIATE_DATA,
|
||||
ptrOffset(baseAddr, eventOffset),
|
||||
Event::STATE_CLEARED,
|
||||
commandContainer.getDevice()->getHardwareInfo(),
|
||||
args);
|
||||
}
|
||||
|
||||
return ZE_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
template <GFXCORE_FAMILY gfxCoreFamily>
|
||||
ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendBarrier(ze_event_handle_t hSignalEvent,
|
||||
uint32_t numWaitEvents,
|
||||
|
@ -1496,6 +1467,34 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendSignalEvent(ze_event_han
|
|||
return ZE_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
template <GFXCORE_FAMILY gfxCoreFamily>
|
||||
ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendEventReset(ze_event_handle_t hEvent) {
|
||||
using POST_SYNC_OPERATION = typename GfxFamily::PIPE_CONTROL::POST_SYNC_OPERATION;
|
||||
auto event = Event::fromHandle(hEvent);
|
||||
|
||||
uint64_t baseAddr = event->getGpuAddress();
|
||||
size_t eventOffset = 0;
|
||||
if (event->isTimestampEvent) {
|
||||
eventOffset = offsetof(TimestampPacketStorage::Packet, contextEnd);
|
||||
}
|
||||
commandContainer.addToResidencyContainer(&event->getAllocation());
|
||||
if (isCopyOnly()) {
|
||||
NEO::EncodeMiFlushDW<GfxFamily>::programMiFlushDw(*commandContainer.getCommandStream(), event->getGpuAddress(), Event::STATE_CLEARED, false, true);
|
||||
} else {
|
||||
NEO::PipeControlArgs args;
|
||||
args.dcFlushEnable = (!event->signalScope) ? false : true;
|
||||
NEO::MemorySynchronizationCommands<GfxFamily>::addPipeControlAndProgramPostSyncOperation(
|
||||
*commandContainer.getCommandStream(),
|
||||
POST_SYNC_OPERATION::POST_SYNC_OPERATION_WRITE_IMMEDIATE_DATA,
|
||||
ptrOffset(baseAddr, eventOffset),
|
||||
Event::STATE_CLEARED,
|
||||
commandContainer.getDevice()->getHardwareInfo(),
|
||||
args);
|
||||
}
|
||||
|
||||
return ZE_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
template <GFXCORE_FAMILY gfxCoreFamily>
|
||||
ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendWaitOnEvents(uint32_t numEvents,
|
||||
ze_event_handle_t *phEvent) {
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
#include "shared/source/memory_manager/memory_operations_handler.h"
|
||||
#include "shared/source/utilities/cpuintrinsics.h"
|
||||
|
||||
#include "level_zero/core/source/cmdlist/cmdlist.h"
|
||||
#include "level_zero/core/source/cmdqueue/cmdqueue.h"
|
||||
#include "level_zero/core/source/device/device.h"
|
||||
#include "level_zero/core/source/device/device_imp.h"
|
||||
#include "level_zero/tools/source/metrics/metric.h"
|
||||
|
@ -56,23 +58,52 @@ ze_result_t EventPoolImp::initialize(DriverHandle *driver, uint32_t numDevices,
|
|||
maxRootDeviceIndex = rootDeviceIndices[0];
|
||||
}
|
||||
|
||||
if (this->devices.size() > 1) {
|
||||
this->allocOnDevice = false;
|
||||
}
|
||||
|
||||
if (allocOnDevice) {
|
||||
ze_command_queue_desc_t cmdQueueDesc = {};
|
||||
cmdQueueDesc.ordinal = 0;
|
||||
cmdQueueDesc.index = 0;
|
||||
cmdQueueDesc.flags = 0;
|
||||
cmdQueueDesc.stype = ZE_STRUCTURE_TYPE_COMMAND_QUEUE_DESC;
|
||||
cmdQueueDesc.mode = ZE_COMMAND_QUEUE_MODE_SYNCHRONOUS;
|
||||
ze_result_t returnValue = ZE_RESULT_SUCCESS;
|
||||
eventPoolCommandList =
|
||||
CommandList::createImmediate(
|
||||
static_cast<DeviceImp *>(this->devices[0])->neoDevice->getHardwareInfo().platform.eProductFamily,
|
||||
this->devices[0],
|
||||
&cmdQueueDesc,
|
||||
true,
|
||||
NEO::EngineGroupType::RenderCompute,
|
||||
returnValue);
|
||||
|
||||
if (!this->eventPoolCommandList) {
|
||||
this->allocOnDevice = false;
|
||||
}
|
||||
}
|
||||
|
||||
eventPoolAllocations = new NEO::MultiGraphicsAllocation(maxRootDeviceIndex);
|
||||
|
||||
uint32_t rootDeviceIndex = rootDeviceIndices.at(0);
|
||||
auto deviceBitfield = devices[0]->getNEODevice()->getDeviceBitfield();
|
||||
auto allocationType = isEventPoolUsedForTimestamp ? NEO::GraphicsAllocation::AllocationType::TIMESTAMP_PACKET_TAG_BUFFER : NEO::GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY;
|
||||
if (this->allocOnDevice) {
|
||||
allocationType = NEO::GraphicsAllocation::AllocationType::BUFFER;
|
||||
}
|
||||
|
||||
NEO::AllocationProperties unifiedMemoryProperties{rootDeviceIndex,
|
||||
NEO::AllocationProperties eventPoolAllocationProperties{rootDeviceIndex,
|
||||
true,
|
||||
alignUp<size_t>(numEvents * eventSize, MemoryConstants::pageSize64k),
|
||||
isEventPoolUsedForTimestamp ? NEO::GraphicsAllocation::AllocationType::TIMESTAMP_PACKET_TAG_BUFFER
|
||||
: NEO::GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY,
|
||||
allocationType,
|
||||
deviceBitfield.count() > 1,
|
||||
deviceBitfield.count() > 1,
|
||||
deviceBitfield};
|
||||
unifiedMemoryProperties.alignment = eventAlignment;
|
||||
eventPoolAllocationProperties.alignment = MemoryConstants::cacheLineSize;
|
||||
|
||||
void *eventPoolPtr = driver->getMemoryManager()->createMultiGraphicsAllocation(rootDeviceIndices,
|
||||
unifiedMemoryProperties,
|
||||
eventPoolAllocationProperties,
|
||||
*eventPoolAllocations);
|
||||
if (!eventPoolPtr) {
|
||||
return ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY;
|
||||
|
@ -88,6 +119,11 @@ EventPoolImp::~EventPoolImp() {
|
|||
}
|
||||
delete eventPoolAllocations;
|
||||
eventPoolAllocations = nullptr;
|
||||
|
||||
if (eventPoolCommandList) {
|
||||
eventPoolCommandList->destroy();
|
||||
eventPoolCommandList = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
ze_result_t EventPoolImp::getIpcHandle(ze_ipc_event_pool_handle_t *pIpcHandle) {
|
||||
|
@ -122,6 +158,10 @@ Event *Event::create(EventPool *eventPool, const ze_event_desc_t *desc, Device *
|
|||
event->timestampsData = std::make_unique<TimestampPacketStorage>();
|
||||
}
|
||||
|
||||
if (eventPool->allocOnDevice) {
|
||||
event->allocOnDevice = true;
|
||||
}
|
||||
|
||||
auto alloc = eventPool->getAllocation().getGraphicsAllocation(device->getNEODevice()->getRootDeviceIndex());
|
||||
|
||||
uint64_t baseHostAddr = reinterpret_cast<uint64_t>(alloc->getUnderlyingBuffer());
|
||||
|
@ -132,6 +172,10 @@ Event *Event::create(EventPool *eventPool, const ze_event_desc_t *desc, Device *
|
|||
event->csr = static_cast<DeviceImp *>(device)->neoDevice->getDefaultEngine().commandStreamReceiver;
|
||||
event->reset();
|
||||
|
||||
if (event->allocOnDevice) {
|
||||
eventPool->eventPoolCommandList->appendEventReset(event->toHandle());
|
||||
}
|
||||
|
||||
return event;
|
||||
}
|
||||
|
||||
|
@ -188,6 +232,10 @@ void EventImp::assignTimestampData(void *address) {
|
|||
}
|
||||
}
|
||||
|
||||
uint64_t Event::getGpuAddress() {
|
||||
return gpuAddress;
|
||||
}
|
||||
|
||||
ze_result_t Event::destroy() {
|
||||
delete this;
|
||||
return ZE_RESULT_SUCCESS;
|
||||
|
@ -292,6 +340,10 @@ ze_result_t EventImp::hostSynchronize(uint64_t timeout) {
|
|||
}
|
||||
|
||||
ze_result_t EventImp::reset() {
|
||||
if (allocOnDevice) {
|
||||
return ZE_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
resetPackets();
|
||||
return hostEventSetValue(Event::STATE_INITIAL);
|
||||
}
|
||||
|
|
|
@ -48,17 +48,18 @@ struct Event : _ze_event_handle_t {
|
|||
|
||||
void increasePacketsInUse() { packetsInUse++; }
|
||||
void resetPackets() { packetsInUse = 0; }
|
||||
uint64_t getGpuAddress() { return gpuAddress; }
|
||||
uint32_t getPacketsInUse() { return packetsInUse; }
|
||||
uint64_t getTimestampPacketAddress();
|
||||
virtual uint64_t getGpuAddress();
|
||||
|
||||
void *hostAddress = nullptr;
|
||||
uint64_t gpuAddress;
|
||||
uint32_t packetsInUse;
|
||||
uint64_t gpuAddress = 0u;
|
||||
|
||||
ze_event_scope_flags_t signalScope = 0u;
|
||||
ze_event_scope_flags_t waitScope = 0u;
|
||||
bool isTimestampEvent = false;
|
||||
bool allocOnDevice = false;
|
||||
|
||||
std::unique_ptr<TimestampPacketStorage> timestampsData = nullptr;
|
||||
uint64_t globalStartTS;
|
||||
|
@ -118,9 +119,12 @@ struct EventPool : _ze_event_pool_handle_t {
|
|||
|
||||
virtual NEO::MultiGraphicsAllocation &getAllocation() { return *eventPoolAllocations; }
|
||||
|
||||
virtual uint32_t getEventSize() = 0;
|
||||
virtual size_t getEventSize() = 0;
|
||||
|
||||
bool isEventPoolUsedForTimestamp = false;
|
||||
bool allocOnDevice = false;
|
||||
|
||||
CommandList *eventPoolCommandList = nullptr;
|
||||
|
||||
protected:
|
||||
NEO::MultiGraphicsAllocation *eventPoolAllocations = nullptr;
|
||||
|
@ -131,6 +135,10 @@ struct EventPoolImp : public EventPool {
|
|||
if (flags & ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP) {
|
||||
isEventPoolUsedForTimestamp = true;
|
||||
}
|
||||
|
||||
if (!(flags & ZE_EVENT_POOL_FLAG_HOST_VISIBLE)) {
|
||||
allocOnDevice = true;
|
||||
}
|
||||
}
|
||||
|
||||
ze_result_t initialize(DriverHandle *driver,
|
||||
|
@ -148,7 +156,7 @@ struct EventPoolImp : public EventPool {
|
|||
|
||||
ze_result_t createEvent(const ze_event_desc_t *desc, ze_event_handle_t *phEvent) override;
|
||||
|
||||
uint32_t getEventSize() override { return eventSize; }
|
||||
size_t getEventSize() override { return eventSize; }
|
||||
size_t getNumEvents() { return numEvents; }
|
||||
|
||||
Device *getDevice() override { return devices[0]; }
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2020 Intel Corporation
|
||||
* Copyright (C) 2020-2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
|
@ -20,7 +20,7 @@ struct TimestampEvent : public Test<DeviceFixture> {
|
|||
DeviceFixture::SetUp();
|
||||
ze_event_pool_desc_t eventPoolDesc = {};
|
||||
eventPoolDesc.count = 1;
|
||||
eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP;
|
||||
eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP | ZE_EVENT_POOL_FLAG_HOST_VISIBLE;
|
||||
|
||||
ze_event_desc_t eventDesc = {};
|
||||
eventDesc.index = 0;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2020 Intel Corporation
|
||||
* Copyright (C) 2020-2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
|
@ -72,7 +72,7 @@ struct Mock<EventPool> : public EventPool {
|
|||
MOCK_METHOD2(reserveEventFromPool, ze_result_t(int index, ::L0::Event *event));
|
||||
MOCK_METHOD1(releaseEventToPool, ze_result_t(::L0::Event *event));
|
||||
MOCK_METHOD0(getDevice, Device *());
|
||||
MOCK_METHOD0(getEventSize, uint32_t());
|
||||
MOCK_METHOD0(getEventSize, size_t());
|
||||
|
||||
std::vector<int> pool;
|
||||
|
||||
|
|
|
@ -1023,7 +1023,7 @@ HWTEST2_F(CommandListCreate, givenCopyCommandListWhenProfilingBeforeCommandForCo
|
|||
commandList->initialize(device, NEO::EngineGroupType::Copy);
|
||||
ze_event_pool_desc_t eventPoolDesc = {};
|
||||
eventPoolDesc.count = 1;
|
||||
eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP;
|
||||
eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP | ZE_EVENT_POOL_FLAG_HOST_VISIBLE;
|
||||
|
||||
ze_event_desc_t eventDesc = {};
|
||||
eventDesc.index = 0;
|
||||
|
@ -1060,7 +1060,7 @@ HWTEST2_F(CommandListCreate, givenCopyCommandListWhenProfilingAfterCommandForCop
|
|||
commandList->initialize(device, NEO::EngineGroupType::Copy);
|
||||
ze_event_pool_desc_t eventPoolDesc = {};
|
||||
eventPoolDesc.count = 1;
|
||||
eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP;
|
||||
eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP | ZE_EVENT_POOL_FLAG_HOST_VISIBLE;
|
||||
|
||||
ze_event_desc_t eventDesc = {};
|
||||
eventDesc.index = 0;
|
||||
|
|
|
@ -1079,7 +1079,7 @@ HWTEST2_F(CommandListCreate, givenCopyCommandListWhenTimestampPassedToMemoryCopy
|
|||
void *srcPtr = reinterpret_cast<void *>(0x1234);
|
||||
void *dstPtr = reinterpret_cast<void *>(0x2345);
|
||||
ze_event_pool_desc_t eventPoolDesc = {};
|
||||
eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP;
|
||||
eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP | ZE_EVENT_POOL_FLAG_HOST_VISIBLE;
|
||||
eventPoolDesc.count = 1;
|
||||
|
||||
ze_event_desc_t eventDesc = {};
|
||||
|
@ -1170,7 +1170,7 @@ HWTEST2_F(CommandListCreate, givenCommandListWhenTimestampPassedToMemoryCopyThen
|
|||
|
||||
ze_event_pool_desc_t eventPoolDesc = {};
|
||||
eventPoolDesc.count = 1;
|
||||
eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP;
|
||||
eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP | ZE_EVENT_POOL_FLAG_HOST_VISIBLE;
|
||||
|
||||
ze_event_desc_t eventDesc = {};
|
||||
eventDesc.index = 0;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2020 Intel Corporation
|
||||
* Copyright (C) 2020-2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
|
@ -129,7 +129,7 @@ HWTEST2_F(CommandListAppendEventReset, givenTimestampEventUsedInResetThenPipeCon
|
|||
|
||||
ze_event_pool_desc_t eventPoolDesc = {};
|
||||
eventPoolDesc.count = 1;
|
||||
eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP;
|
||||
eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP | ZE_EVENT_POOL_FLAG_HOST_VISIBLE;
|
||||
|
||||
ze_event_desc_t eventDesc = {};
|
||||
eventDesc.index = 0;
|
||||
|
@ -170,6 +170,7 @@ HWTEST2_F(CommandListAppendEventReset, givenEventWithHostScopeUsedInResetThenPip
|
|||
|
||||
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;
|
||||
|
|
|
@ -292,7 +292,7 @@ HWTEST2_F(CommandListAppendLaunchKernel, givenTimestampEventsWhenAppendingKernel
|
|||
auto usedSpaceBefore = commandList->commandContainer.getCommandStream()->getUsed();
|
||||
ze_event_pool_desc_t eventPoolDesc = {};
|
||||
eventPoolDesc.count = 1;
|
||||
eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP;
|
||||
eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP | ZE_EVENT_POOL_FLAG_HOST_VISIBLE;
|
||||
|
||||
ze_event_desc_t eventDesc = {};
|
||||
eventDesc.index = 0;
|
||||
|
@ -382,7 +382,7 @@ HWTEST2_F(CommandListAppendLaunchKernel, givenKernelLaunchWithTSEventAndScopeFla
|
|||
auto usedSpaceBefore = commandList->commandContainer.getCommandStream()->getUsed();
|
||||
ze_event_pool_desc_t eventPoolDesc = {};
|
||||
eventPoolDesc.count = 1;
|
||||
eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP;
|
||||
eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP | ZE_EVENT_POOL_FLAG_HOST_VISIBLE;
|
||||
|
||||
const ze_event_desc_t eventDesc = {
|
||||
ZE_STRUCTURE_TYPE_EVENT_DESC,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2020 Intel Corporation
|
||||
* Copyright (C) 2020-2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
|
@ -193,7 +193,7 @@ HWTEST2_F(CommandListAppendSignalEvent, givenTimestampEventUsedInSignalThenPipeC
|
|||
|
||||
ze_event_pool_desc_t eventPoolDesc = {};
|
||||
eventPoolDesc.count = 1;
|
||||
eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP;
|
||||
eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP | ZE_EVENT_POOL_FLAG_HOST_VISIBLE;
|
||||
|
||||
ze_event_desc_t eventDesc = {};
|
||||
eventDesc.index = 0;
|
||||
|
|
|
@ -185,7 +185,7 @@ HWTEST2_F(AppendMemoryCopy, givenCopyCommandListWhenTimestampPassedToMemoryCopyR
|
|||
commandList->initialize(device, NEO::EngineGroupType::Copy);
|
||||
ze_event_pool_desc_t eventPoolDesc = {};
|
||||
eventPoolDesc.count = 1;
|
||||
eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP;
|
||||
eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP | ZE_EVENT_POOL_FLAG_HOST_VISIBLE;
|
||||
|
||||
ze_event_desc_t eventDesc = {};
|
||||
eventDesc.index = 0;
|
||||
|
@ -244,7 +244,7 @@ HWTEST2_F(AppendMemoryCopy, givenCopyCommandListWhenTimestampPassedToImageCopyBl
|
|||
commandList->initialize(device, NEO::EngineGroupType::Copy);
|
||||
ze_event_pool_desc_t eventPoolDesc = {};
|
||||
eventPoolDesc.count = 1;
|
||||
eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP;
|
||||
eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP | ZE_EVENT_POOL_FLAG_HOST_VISIBLE;
|
||||
|
||||
ze_event_desc_t eventDesc = {};
|
||||
eventDesc.index = 0;
|
||||
|
|
|
@ -30,7 +30,7 @@ TEST_F(EventPoolCreate, GivenEventPoolThenAllocationContainsAtLeast16Bytes) {
|
|||
auto allocation = &eventPool->getAllocation();
|
||||
ASSERT_NE(nullptr, allocation);
|
||||
|
||||
uint32_t minAllocationSize = eventPool->getEventSize();
|
||||
size_t minAllocationSize = eventPool->getEventSize();
|
||||
EXPECT_GE(allocation->getGraphicsAllocation(device->getNEODevice()->getRootDeviceIndex())->getUnderlyingBufferSize(),
|
||||
minAllocationSize);
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ TEST_F(EventPoolCreate, GivenEventPoolThenAllocationContainsAtLeast16Bytes) {
|
|||
TEST_F(EventPoolCreate, givenTimestampEventsThenEventSizeSufficientForAllKernelTimestamps) {
|
||||
ze_event_pool_desc_t eventPoolDesc = {};
|
||||
eventPoolDesc.count = 1;
|
||||
eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP;
|
||||
eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP | ZE_EVENT_POOL_FLAG_HOST_VISIBLE;
|
||||
|
||||
std::unique_ptr<L0::EventPool> eventPool(EventPool::create(driverHandle.get(), 0, nullptr, &eventPoolDesc));
|
||||
ASSERT_NE(nullptr, eventPool);
|
||||
|
@ -142,6 +142,37 @@ TEST_F(EventPoolCreate, GivenDeviceThenEventPoolIsCreated) {
|
|||
eventPool->destroy();
|
||||
}
|
||||
|
||||
TEST_F(EventPoolCreate, whenHostVisibleFlagNotSetThenEventAllocationIsOnDevice) {
|
||||
ze_event_pool_desc_t eventPoolDesc = {
|
||||
ZE_STRUCTURE_TYPE_EVENT_POOL_DESC,
|
||||
nullptr,
|
||||
0u,
|
||||
4};
|
||||
|
||||
auto deviceHandle = device->toHandle();
|
||||
auto eventPool = EventPool::create(driverHandle.get(), 1, &deviceHandle, &eventPoolDesc);
|
||||
|
||||
ASSERT_NE(nullptr, eventPool);
|
||||
|
||||
EXPECT_EQ(NEO::GraphicsAllocation::AllocationType::BUFFER, eventPool->getAllocation().getAllocationType());
|
||||
eventPool->destroy();
|
||||
}
|
||||
|
||||
TEST_F(EventPoolCreate, whenHostVisibleFlagNotSetThenEventPoolCommandListIsCreated) {
|
||||
ze_event_pool_desc_t eventPoolDesc = {
|
||||
ZE_STRUCTURE_TYPE_EVENT_POOL_DESC,
|
||||
nullptr,
|
||||
0u,
|
||||
4};
|
||||
|
||||
auto deviceHandle = device->toHandle();
|
||||
auto eventPool = EventPool::create(driverHandle.get(), 1, &deviceHandle, &eventPoolDesc);
|
||||
|
||||
ASSERT_NE(nullptr, eventPool->eventPoolCommandList);
|
||||
|
||||
eventPool->destroy();
|
||||
}
|
||||
|
||||
struct EventCreateAllocationResidencyTest : public ::testing::Test {
|
||||
void SetUp() override {
|
||||
neoDevice = NEO::MockDevice::createWithNewExecutionEnvironment<NEO::MockDevice>(NEO::defaultHwInfo.get());
|
||||
|
@ -170,7 +201,7 @@ class TimestampEventCreate : public Test<DeviceFixture> {
|
|||
DeviceFixture::SetUp();
|
||||
ze_event_pool_desc_t eventPoolDesc = {};
|
||||
eventPoolDesc.count = 1;
|
||||
eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP;
|
||||
eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP | ZE_EVENT_POOL_FLAG_HOST_VISIBLE;
|
||||
|
||||
ze_event_desc_t eventDesc = {};
|
||||
eventDesc.index = 0;
|
||||
|
@ -213,7 +244,7 @@ TEST_F(TimestampEventCreate, givenSingleTimestampEventThenAllocationSizeCreatedF
|
|||
auto allocation = &eventPool->getAllocation();
|
||||
ASSERT_NE(nullptr, allocation);
|
||||
|
||||
uint32_t minTimestampEventAllocation = eventPool->getEventSize();
|
||||
size_t minTimestampEventAllocation = eventPool->getEventSize();
|
||||
EXPECT_GE(allocation->getGraphicsAllocation(device->getNEODevice()->getRootDeviceIndex())->getUnderlyingBufferSize(),
|
||||
minTimestampEventAllocation);
|
||||
}
|
||||
|
@ -301,6 +332,37 @@ TEST_F(EventPoolCreateMultiDevice, whenCreatingEventPoolWithMultipleDevicesThenE
|
|||
delete[] devices;
|
||||
}
|
||||
|
||||
TEST_F(EventPoolCreateMultiDevice, whenCreatingEventPoolWithMultipleDevicesAndHostVisibleFlagNotSetThenEventPoolCreateSucceedsButEventAllocNotPlacedOnDevice) {
|
||||
ze_event_pool_desc_t eventPoolDesc = {};
|
||||
eventPoolDesc.stype = ZE_STRUCTURE_TYPE_EVENT_POOL_DESC;
|
||||
eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_HOST_VISIBLE;
|
||||
eventPoolDesc.count = 32;
|
||||
|
||||
uint32_t deviceCount = 0;
|
||||
ze_result_t result = zeDeviceGet(driverHandle.get(), &deviceCount, nullptr);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
EXPECT_EQ(deviceCount, numRootDevices);
|
||||
|
||||
ze_device_handle_t *devices = new ze_device_handle_t[deviceCount];
|
||||
result = zeDeviceGet(driverHandle.get(), &deviceCount, devices);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
|
||||
std::unique_ptr<L0::EventPool> eventPool(EventPool::create(driverHandle.get(),
|
||||
deviceCount,
|
||||
devices,
|
||||
&eventPoolDesc));
|
||||
EXPECT_NE(nullptr, eventPool);
|
||||
|
||||
auto allocation = &eventPool->getAllocation();
|
||||
EXPECT_NE(nullptr, allocation);
|
||||
|
||||
EXPECT_EQ(allocation->getGraphicsAllocations().size(), numRootDevices);
|
||||
|
||||
EXPECT_EQ(false, eventPool->allocOnDevice);
|
||||
|
||||
delete[] devices;
|
||||
}
|
||||
|
||||
TEST_F(EventPoolCreateMultiDevice, whenCreatingEventPoolWithNoDevicesThenEventPoolCreatedWithOneDevice) {
|
||||
ze_event_pool_desc_t eventPoolDesc = {};
|
||||
eventPoolDesc.stype = ZE_STRUCTURE_TYPE_EVENT_POOL_DESC;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2020 Intel Corporation
|
||||
* Copyright (C) 2020-2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
|
@ -537,7 +537,7 @@ TEST_F(MetricQueryPoolTest, givenCorrectArgumentsWhenZeEventPoolCreateIsCalledTh
|
|||
ze_event_pool_handle_t eventPoolHandle = {};
|
||||
ze_event_pool_desc_t eventPoolDesc = {};
|
||||
eventPoolDesc.count = 1;
|
||||
eventPoolDesc.flags = 0;
|
||||
eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_HOST_VISIBLE;
|
||||
eventPoolDesc.stype = ZE_STRUCTURE_TYPE_EVENT_POOL_DESC;
|
||||
|
||||
// Create event pool.
|
||||
|
@ -554,7 +554,7 @@ TEST_F(MetricQueryPoolTest, givenIncorrectArgumentsWhenZeEventCreateIsCalledThen
|
|||
ze_event_pool_handle_t eventPoolHandle = {};
|
||||
ze_event_pool_desc_t eventPoolDesc = {};
|
||||
eventPoolDesc.count = 1;
|
||||
eventPoolDesc.flags = 0;
|
||||
eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_HOST_VISIBLE;
|
||||
eventPoolDesc.stype = ZE_STRUCTURE_TYPE_EVENT_POOL_DESC;
|
||||
|
||||
// Create event pool.
|
||||
|
@ -572,7 +572,7 @@ TEST_F(MetricQueryPoolTest, givenCorrectArgumentsWhenZeEventCreateIsCalledThenRe
|
|||
ze_event_pool_handle_t eventPoolHandle = {};
|
||||
ze_event_pool_desc_t eventPoolDesc = {};
|
||||
eventPoolDesc.count = 1;
|
||||
eventPoolDesc.flags = 0;
|
||||
eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_HOST_VISIBLE;
|
||||
eventPoolDesc.stype = ZE_STRUCTURE_TYPE_EVENT_POOL_DESC;
|
||||
|
||||
ze_event_handle_t eventHandle = {};
|
||||
|
@ -606,7 +606,7 @@ TEST_F(MetricQueryPoolTest, givenIncorrectArgumentsWhenZetCommandListAppendMetri
|
|||
ze_event_pool_handle_t eventPoolHandle = {};
|
||||
ze_event_pool_desc_t eventPoolDesc = {};
|
||||
eventPoolDesc.count = 1;
|
||||
eventPoolDesc.flags = 0;
|
||||
eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_HOST_VISIBLE;
|
||||
eventPoolDesc.stype = ZE_STRUCTURE_TYPE_EVENT_POOL_DESC;
|
||||
|
||||
ze_event_handle_t eventHandle = {};
|
||||
|
@ -717,7 +717,7 @@ TEST_F(MetricQueryPoolTest, givenCorrectArgumentsWhenZetCommandListAppendMetricQ
|
|||
ze_event_pool_handle_t eventPoolHandle = {};
|
||||
ze_event_pool_desc_t eventPoolDesc = {};
|
||||
eventPoolDesc.count = 1;
|
||||
eventPoolDesc.flags = 0;
|
||||
eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_HOST_VISIBLE;
|
||||
eventPoolDesc.stype = ZE_STRUCTURE_TYPE_EVENT_POOL_DESC;
|
||||
|
||||
ze_event_handle_t eventHandle = {};
|
||||
|
@ -834,7 +834,7 @@ TEST_F(MetricQueryPoolTest, givenIncorrectArgumentsWhenZetMetricQueryGetDataIsCa
|
|||
ze_event_pool_handle_t eventPoolHandle = {};
|
||||
ze_event_pool_desc_t eventPoolDesc = {};
|
||||
eventPoolDesc.count = 1;
|
||||
eventPoolDesc.flags = 0;
|
||||
eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_HOST_VISIBLE;
|
||||
eventPoolDesc.stype = ZE_STRUCTURE_TYPE_EVENT_POOL_DESC;
|
||||
|
||||
ze_event_handle_t eventHandle = {};
|
||||
|
@ -950,7 +950,7 @@ TEST_F(MetricQueryPoolTest, givenCorrectArgumentsWhenZetMetricQueryGetDataIsCall
|
|||
ze_event_pool_handle_t eventPoolHandle = {};
|
||||
ze_event_pool_desc_t eventPoolDesc = {};
|
||||
eventPoolDesc.count = 1;
|
||||
eventPoolDesc.flags = 0;
|
||||
eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_HOST_VISIBLE;
|
||||
eventPoolDesc.stype = ZE_STRUCTURE_TYPE_EVENT_POOL_DESC;
|
||||
|
||||
ze_event_handle_t eventHandle = {};
|
||||
|
@ -1094,7 +1094,7 @@ TEST_F(MetricQueryPoolTest, givenCorrectArgumentsWhenZetMetricQueryGetDataIsCall
|
|||
ze_event_pool_handle_t eventPoolHandle = {};
|
||||
ze_event_pool_desc_t eventPoolDesc = {};
|
||||
eventPoolDesc.count = 1;
|
||||
eventPoolDesc.flags = 0;
|
||||
eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_HOST_VISIBLE;
|
||||
eventPoolDesc.stype = ZE_STRUCTURE_TYPE_EVENT_POOL_DESC;
|
||||
|
||||
ze_event_handle_t eventHandle = {};
|
||||
|
|
Loading…
Reference in New Issue