Refactor event pool class hierarchy

Related-To: NEO-7636

Signed-off-by: Zbigniew Zdanowicz <zbigniew.zdanowicz@intel.com>
This commit is contained in:
Zbigniew Zdanowicz 2023-01-16 17:12:02 +00:00 committed by Compute-Runtime-Automation
parent 16d5a323c7
commit 172ea34fc2
8 changed files with 82 additions and 105 deletions

View File

@ -589,11 +589,11 @@ ze_result_t ContextImp::openIpcMemHandles(ze_device_handle_t hDevice,
return ZE_RESULT_SUCCESS;
}
ze_result_t EventPoolImp::closeIpcHandle() {
ze_result_t EventPool::closeIpcHandle() {
return this->destroy();
}
ze_result_t EventPoolImp::getIpcHandle(ze_ipc_event_pool_handle_t *ipcHandle) {
ze_result_t EventPool::getIpcHandle(ze_ipc_event_pool_handle_t *ipcHandle) {
// L0 uses a vector of ZE_MAX_IPC_HANDLE_SIZE bytes to send the IPC handle, i.e.
// char data[ZE_MAX_IPC_HANDLE_SIZE];
// First four bytes (which is of size sizeof(int)) of it contain the file descriptor
@ -624,7 +624,7 @@ ze_result_t ContextImp::openEventPoolIpcHandle(const ze_ipc_event_pool_handle_t
ze_event_pool_desc_t desc = {ZE_STRUCTURE_TYPE_EVENT_POOL_DESC};
desc.count = static_cast<uint32_t>(poolData.numEvents);
auto eventPool = new EventPoolImp(&desc);
auto eventPool = new EventPool(&desc);
eventPool->isDeviceEventPoolAllocation = poolData.isDeviceEventPoolAllocation;
eventPool->isHostVisibleEventPoolAllocation = poolData.isHostVisibleEventPoolAllocation;

View File

@ -40,7 +40,7 @@ namespace L0 {
template Event *Event::create<uint64_t>(EventPool *, const ze_event_desc_t *, Device *);
template Event *Event::create<uint32_t>(EventPool *, const ze_event_desc_t *, Device *);
ze_result_t EventPoolImp::initialize(DriverHandle *driver, Context *context, uint32_t numDevices, ze_device_handle_t *phDevices) {
ze_result_t EventPool::initialize(DriverHandle *driver, Context *context, uint32_t numDevices, ze_device_handle_t *deviceHandles) {
this->context = static_cast<ContextImp *>(context);
RootDeviceIndicesContainer rootDeviceIndices;
@ -60,7 +60,7 @@ ze_result_t EventPoolImp::initialize(DriverHandle *driver, Context *context, uin
Device *eventDevice = nullptr;
if (useDevicesFromApi) {
eventDevice = Device::fromHandle(phDevices[i]);
eventDevice = Device::fromHandle(deviceHandles[i]);
} else {
eventDevice = driverHandleImp->devices[i];
}
@ -81,7 +81,7 @@ ze_result_t EventPoolImp::initialize(DriverHandle *driver, Context *context, uin
auto &l0GfxCoreHelper = rootDeviceEnvironment.getHelper<L0GfxCoreHelper>();
this->isDeviceEventPoolAllocation |= l0GfxCoreHelper.alwaysAllocateEventInLocalMem();
initializeSizeParameters(numDevices, phDevices, *driverHandleImp, rootDeviceEnvironment);
initializeSizeParameters(numDevices, deviceHandles, *driverHandleImp, rootDeviceEnvironment);
NEO::AllocationType allocationType = isEventPoolTimestampFlagSet() ? NEO::AllocationType::TIMESTAMP_PACKET_TAG_BUFFER
: NEO::AllocationType::BUFFER_HOST_MEMORY;
@ -135,7 +135,7 @@ ze_result_t EventPoolImp::initialize(DriverHandle *driver, Context *context, uin
return ZE_RESULT_SUCCESS;
}
EventPoolImp::~EventPoolImp() {
EventPool::~EventPool() {
if (eventPoolAllocations) {
auto graphicsAllocations = eventPoolAllocations->getGraphicsAllocations();
auto memoryManager = devices[0]->getDriverHandle()->getMemoryManager();
@ -145,25 +145,25 @@ EventPoolImp::~EventPoolImp() {
}
}
ze_result_t EventPoolImp::destroy() {
ze_result_t EventPool::destroy() {
delete this;
return ZE_RESULT_SUCCESS;
}
ze_result_t EventPoolImp::createEvent(const ze_event_desc_t *desc, ze_event_handle_t *phEvent) {
ze_result_t EventPool::createEvent(const ze_event_desc_t *desc, ze_event_handle_t *eventHandle) {
if (desc->index > (getNumEvents() - 1)) {
return ZE_RESULT_ERROR_INVALID_ARGUMENT;
}
auto &l0GfxCoreHelper = getDevice()->getNEODevice()->getRootDeviceEnvironment().getHelper<L0GfxCoreHelper>();
*phEvent = l0GfxCoreHelper.createEvent(this, desc, getDevice());
*eventHandle = l0GfxCoreHelper.createEvent(this, desc, getDevice());
return ZE_RESULT_SUCCESS;
}
void EventPoolImp::initializeSizeParameters(uint32_t numDevices, ze_device_handle_t *deviceHandles, DriverHandleImp &driver, const NEO::RootDeviceEnvironment &rootDeviceEnvironment) {
void EventPool::initializeSizeParameters(uint32_t numDevices, ze_device_handle_t *deviceHandles, DriverHandleImp &driver, const NEO::RootDeviceEnvironment &rootDeviceEnvironment) {
auto &l0GfxCoreHelper = rootDeviceEnvironment.getHelper<L0GfxCoreHelper>();
auto &gfxCoreHelper = rootDeviceEnvironment.getHelper<NEO::GfxCoreHelper>();
@ -188,22 +188,22 @@ ze_result_t Event::destroy() {
return ZE_RESULT_SUCCESS;
}
EventPool *EventPool::create(DriverHandle *driver, Context *context, uint32_t numDevices, ze_device_handle_t *phDevices, const ze_event_pool_desc_t *desc, ze_result_t &result) {
auto eventPool = std::make_unique<EventPoolImp>(desc);
EventPool *EventPool::create(DriverHandle *driver, Context *context, uint32_t numDevices, ze_device_handle_t *deviceHandles, const ze_event_pool_desc_t *desc, ze_result_t &result) {
auto eventPool = std::make_unique<EventPool>(desc);
if (!eventPool) {
result = ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY;
DEBUG_BREAK_IF(true);
return nullptr;
}
result = eventPool->initialize(driver, context, numDevices, phDevices);
result = eventPool->initialize(driver, context, numDevices, deviceHandles);
if (result) {
return nullptr;
}
return eventPool.release();
}
bool EventPool::isEventPoolTimestampFlagSet() {
bool EventPool::isEventPoolTimestampFlagSet() const {
if (NEO::DebugManager.flags.OverrideTimestampEvents.get() != -1) {
auto timestampOverride = !!NEO::DebugManager.flags.OverrideTimestampEvents.get();
return timestampOverride;

View File

@ -55,7 +55,7 @@ struct Event : _ze_event_handle_t {
virtual ze_result_t queryStatus() = 0;
virtual ze_result_t reset() = 0;
virtual ze_result_t queryKernelTimestamp(ze_kernel_timestamp_result_t *dstptr) = 0;
virtual ze_result_t queryTimestampsExp(Device *device, uint32_t *pCount, ze_kernel_timestamp_result_t *pTimestamps) = 0;
virtual ze_result_t queryTimestampsExp(Device *device, uint32_t *count, ze_kernel_timestamp_result_t *timestamps) = 0;
enum State : uint32_t {
STATE_SIGNALED = 0u,
HOST_CACHING_DISABLED_PERMANENT = std::numeric_limits<uint32_t>::max() - 2,
@ -254,7 +254,7 @@ struct EventImp : public Event {
ze_result_t reset() override;
ze_result_t queryKernelTimestamp(ze_kernel_timestamp_result_t *dstptr) override;
ze_result_t queryTimestampsExp(Device *device, uint32_t *pCount, ze_kernel_timestamp_result_t *pTimestamps) override;
ze_result_t queryTimestampsExp(Device *device, uint32_t *count, ze_kernel_timestamp_result_t *timestamps) override;
void resetDeviceCompletionData(bool resetAllPackets);
void resetKernelCountAndPacketUsedCount() override;
@ -278,13 +278,15 @@ struct EventImp : public Event {
};
struct EventPool : _ze_event_pool_handle_t {
static EventPool *create(DriverHandle *driver, Context *context, uint32_t numDevices, ze_device_handle_t *phDevices, const ze_event_pool_desc_t *desc, ze_result_t &result);
virtual ~EventPool() = default;
virtual ze_result_t destroy() = 0;
virtual ze_result_t getIpcHandle(ze_ipc_event_pool_handle_t *ipcHandle) = 0;
virtual ze_result_t closeIpcHandle() = 0;
virtual ze_result_t createEvent(const ze_event_desc_t *desc, ze_event_handle_t *phEvent) = 0;
virtual Device *getDevice() = 0;
static EventPool *create(DriverHandle *driver, Context *context, uint32_t numDevices, ze_device_handle_t *deviceHandles, const ze_event_pool_desc_t *desc, ze_result_t &result);
EventPool(const ze_event_pool_desc_t *desc) : EventPool(desc->count) {
eventPoolFlags = desc->flags;
}
virtual ~EventPool();
MOCKABLE_VIRTUAL ze_result_t destroy();
MOCKABLE_VIRTUAL ze_result_t getIpcHandle(ze_ipc_event_pool_handle_t *ipcHandle);
MOCKABLE_VIRTUAL ze_result_t closeIpcHandle();
MOCKABLE_VIRTUAL ze_result_t createEvent(const ze_event_desc_t *desc, ze_event_handle_t *eventHandle);
static EventPool *fromHandle(ze_event_pool_handle_t handle) {
return static_cast<EventPool *>(handle);
@ -292,7 +294,7 @@ struct EventPool : _ze_event_pool_handle_t {
inline ze_event_pool_handle_t toHandle() { return this; }
virtual NEO::MultiGraphicsAllocation &getAllocation() { return *eventPoolAllocations; }
MOCKABLE_VIRTUAL NEO::MultiGraphicsAllocation &getAllocation() { return *eventPoolAllocations; }
uint32_t getEventSize() const { return eventSize; }
void setEventSize(uint32_t size) { eventSize = size; }
@ -301,9 +303,9 @@ struct EventPool : _ze_event_pool_handle_t {
uint32_t getEventMaxPackets() const { return eventPackets; }
size_t getEventPoolSize() const { return eventPoolSize; }
bool isEventPoolTimestampFlagSet();
bool isEventPoolTimestampFlagSet() const;
bool isEventPoolDeviceAllocationFlagSet() {
bool isEventPoolDeviceAllocationFlagSet() const {
if (!(eventPoolFlags & ZE_EVENT_POOL_FLAG_HOST_VISIBLE)) {
return true;
}
@ -314,10 +316,21 @@ struct EventPool : _ze_event_pool_handle_t {
return maxKernelCount;
}
ze_result_t initialize(DriverHandle *driver, Context *context, uint32_t numDevices, ze_device_handle_t *deviceHandles);
void initializeSizeParameters(uint32_t numDevices, ze_device_handle_t *deviceHandles, DriverHandleImp &driver, const NEO::RootDeviceEnvironment &rootDeviceEnvironment);
Device *getDevice() const { return devices[0]; }
std::vector<Device *> devices;
std::unique_ptr<NEO::MultiGraphicsAllocation> eventPoolAllocations;
void *eventPoolPtr = nullptr;
ContextImp *context = nullptr;
ze_event_pool_flags_t eventPoolFlags;
bool isDeviceEventPoolAllocation = false;
bool isHostVisibleEventPoolAllocation = false;
bool isImportedIpcPool = false;
bool isShareableEventMemory = false;
protected:
EventPool() = default;
@ -331,32 +344,4 @@ struct EventPool : _ze_event_pool_handle_t {
uint32_t maxKernelCount = 0;
};
struct EventPoolImp : public EventPool {
EventPoolImp(const ze_event_pool_desc_t *desc) : EventPool(desc->count) {
eventPoolFlags = desc->flags;
}
ze_result_t initialize(DriverHandle *driver, Context *context, uint32_t numDevices, ze_device_handle_t *phDevices);
~EventPoolImp() override;
ze_result_t destroy() override;
ze_result_t getIpcHandle(ze_ipc_event_pool_handle_t *ipcHandle) override;
ze_result_t closeIpcHandle() override;
ze_result_t createEvent(const ze_event_desc_t *desc, ze_event_handle_t *phEvent) override;
void initializeSizeParameters(uint32_t numDevices, ze_device_handle_t *deviceHandles, DriverHandleImp &driver, const NEO::RootDeviceEnvironment &rootDeviceEnvironment);
Device *getDevice() override { return devices[0]; }
std::vector<Device *> devices;
void *eventPoolPtr = nullptr;
ContextImp *context = nullptr;
bool isImportedIpcPool = false;
bool isShareableEventMemory = false;
};
} // namespace L0

View File

@ -54,10 +54,9 @@ Event *Event::create(EventPool *eventPool, const ze_event_desc_t *desc, Device *
}
event->setUsingContextEndOffset(useContextEndOffset);
EventPoolImp *eventPoolImp = static_cast<struct EventPoolImp *>(eventPool);
// do not reset even if it has been imported, since event pool
// might have been imported after events being already signaled
if (eventPoolImp->isImportedIpcPool == false) {
if (eventPool->isImportedIpcPool == false) {
event->resetDeviceCompletionData(true);
}
@ -384,7 +383,7 @@ ze_result_t EventImp<TagSizeT>::queryKernelTimestamp(ze_kernel_timestamp_result_
}
template <typename TagSizeT>
ze_result_t EventImp<TagSizeT>::queryTimestampsExp(Device *device, uint32_t *pCount, ze_kernel_timestamp_result_t *pTimestamps) {
ze_result_t EventImp<TagSizeT>::queryTimestampsExp(Device *device, uint32_t *count, ze_kernel_timestamp_result_t *timestamps) {
uint32_t timestampPacket = 0;
uint64_t globalStartTs, globalEndTs, contextStartTs, contextEndTs;
globalStartTs = globalEndTs = contextStartTs = contextEndTs = Event::STATE_INITIAL;
@ -404,14 +403,14 @@ ze_result_t EventImp<TagSizeT>::queryTimestampsExp(Device *device, uint32_t *pCo
numPacketsUsed = this->getPacketsInUse();
}
if ((*pCount == 0) ||
(*pCount > numPacketsUsed)) {
*pCount = numPacketsUsed;
if ((*count == 0) ||
(*count > numPacketsUsed)) {
*count = numPacketsUsed;
return ZE_RESULT_SUCCESS;
}
for (auto i = 0u; i < *pCount; i++) {
ze_kernel_timestamp_result_t &result = *(pTimestamps + i);
for (auto i = 0u; i < *count; i++) {
ze_kernel_timestamp_result_t &result = *(timestamps + i);
auto queryTsEventAssignFunc = [&](uint64_t &timestampFieldForWriting, uint64_t &timestampFieldToCopy) {
memcpy_s(&timestampFieldForWriting, sizeof(uint64_t), static_cast<void *>(&timestampFieldToCopy), sizeof(uint64_t));

View File

@ -47,7 +47,7 @@ struct Mock<Event> : public Event {
ADDMETHOD_NOBASE(queryStatus, ze_result_t, ZE_RESULT_SUCCESS, ());
ADDMETHOD_NOBASE(reset, ze_result_t, ZE_RESULT_SUCCESS, ());
ADDMETHOD_NOBASE(queryKernelTimestamp, ze_result_t, ZE_RESULT_SUCCESS, (ze_kernel_timestamp_result_t * dstptr));
ADDMETHOD_NOBASE(queryTimestampsExp, ze_result_t, ZE_RESULT_SUCCESS, (::L0::Device * device, uint32_t *pCount, ze_kernel_timestamp_result_t *pTimestamps));
ADDMETHOD_NOBASE(queryTimestampsExp, ze_result_t, ZE_RESULT_SUCCESS, (::L0::Device * device, uint32_t *count, ze_kernel_timestamp_result_t *timestamps));
// Fake an allocation for event memory
alignas(16) uint32_t memory = -1;
@ -61,8 +61,7 @@ struct Mock<EventPool> : public EventPool {
ADDMETHOD_NOBASE(destroy, ze_result_t, ZE_RESULT_SUCCESS, ());
ADDMETHOD_NOBASE(getIpcHandle, ze_result_t, ZE_RESULT_SUCCESS, (ze_ipc_event_pool_handle_t * ipcHandle));
ADDMETHOD_NOBASE(closeIpcHandle, ze_result_t, ZE_RESULT_SUCCESS, ());
ADDMETHOD_NOBASE(createEvent, ze_result_t, ZE_RESULT_SUCCESS, (const ze_event_desc_t *desc, ze_event_handle_t *phEvent));
ADDMETHOD_NOBASE(getDevice, Device *, nullptr, ());
ADDMETHOD_NOBASE(createEvent, ze_result_t, ZE_RESULT_SUCCESS, (const ze_event_desc_t *desc, ze_event_handle_t *eventHandle));
using EventPool::eventPoolAllocations;
};
@ -121,7 +120,7 @@ class MockEvent : public ::L0::Event {
ze_result_t queryKernelTimestamp(ze_kernel_timestamp_result_t *dstptr) override {
return ZE_RESULT_SUCCESS;
}
ze_result_t queryTimestampsExp(L0::Device *device, uint32_t *pCount, ze_kernel_timestamp_result_t *pTimestamps) override {
ze_result_t queryTimestampsExp(L0::Device *device, uint32_t *count, ze_kernel_timestamp_result_t *timestamps) override {
return ZE_RESULT_SUCCESS;
}
uint32_t getPacketsUsedInLastKernel() override { return 1; }

View File

@ -188,8 +188,7 @@ TEST_F(EventPoolCreate, givenEventPoolCreatedWithTimestampFlagThenHasTimestampEv
std::unique_ptr<L0::EventPool> eventPool(EventPool::create(driverHandle.get(), context, 0, nullptr, &eventPoolDesc, result));
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
ASSERT_NE(nullptr, eventPool);
EventPoolImp *eventPoolImp = static_cast<EventPoolImp *>(eventPool.get());
EXPECT_TRUE(eventPoolImp->isEventPoolTimestampFlagSet());
EXPECT_TRUE(eventPool->isEventPoolTimestampFlagSet());
}
TEST_F(EventPoolCreate, givenEventPoolCreatedWithNoTimestampFlagThenHasTimestampEventsReturnsFalse) {
@ -200,8 +199,7 @@ TEST_F(EventPoolCreate, givenEventPoolCreatedWithNoTimestampFlagThenHasTimestamp
std::unique_ptr<L0::EventPool> eventPool(EventPool::create(driverHandle.get(), context, 0, nullptr, &eventPoolDesc, result));
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
ASSERT_NE(nullptr, eventPool);
EventPoolImp *eventPoolImp = static_cast<EventPoolImp *>(eventPool.get());
EXPECT_FALSE(eventPoolImp->isEventPoolTimestampFlagSet());
EXPECT_FALSE(eventPool->isEventPoolTimestampFlagSet());
}
TEST_F(EventPoolCreate, givenEventPoolCreatedWithTimestampFlagAndOverrideTimestampEventsFlagThenHasTimestampEventsReturnsFalse) {
@ -216,8 +214,7 @@ TEST_F(EventPoolCreate, givenEventPoolCreatedWithTimestampFlagAndOverrideTimesta
std::unique_ptr<L0::EventPool> eventPool(EventPool::create(driverHandle.get(), context, 0, nullptr, &eventPoolDesc, result));
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
ASSERT_NE(nullptr, eventPool);
EventPoolImp *eventPoolImp = static_cast<EventPoolImp *>(eventPool.get());
EXPECT_FALSE(eventPoolImp->isEventPoolTimestampFlagSet());
EXPECT_FALSE(eventPool->isEventPoolTimestampFlagSet());
}
TEST_F(EventPoolCreate, givenEventPoolCreatedWithoutTimestampFlagAndOverrideTimestampEventsFlagThenHasTimestampEventsReturnsTrue) {
@ -232,8 +229,7 @@ TEST_F(EventPoolCreate, givenEventPoolCreatedWithoutTimestampFlagAndOverrideTime
std::unique_ptr<L0::EventPool> eventPool(EventPool::create(driverHandle.get(), context, 0, nullptr, &eventPoolDesc, result));
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
ASSERT_NE(nullptr, eventPool);
EventPoolImp *eventPoolImp = static_cast<EventPoolImp *>(eventPool.get());
EXPECT_TRUE(eventPoolImp->isEventPoolTimestampFlagSet());
EXPECT_TRUE(eventPool->isEventPoolTimestampFlagSet());
}
TEST_F(EventPoolCreate, givenAnEventIsCreatedFromThisEventPoolThenEventContainsDeviceCommandStreamReceiver) {
@ -477,7 +473,7 @@ TEST_F(EventPoolIPCHandleTests, whenOpeningIpcHandleForEventPoolThenEventPoolIsC
res = context->openEventPoolIpcHandle(ipcHandle, &ipcEventPoolHandle);
EXPECT_EQ(res, ZE_RESULT_SUCCESS);
auto ipcEventPool = static_cast<L0::EventPoolImp *>(L0::EventPool::fromHandle(ipcEventPoolHandle));
auto ipcEventPool = L0::EventPool::fromHandle(ipcEventPoolHandle);
EXPECT_EQ(ipcEventPool->getEventSize(), eventPool->getEventSize());
EXPECT_EQ(numEvents, static_cast<uint32_t>(ipcEventPool->getNumEvents()));
@ -516,7 +512,7 @@ TEST_F(EventPoolIPCHandleTests, whenOpeningIpcHandleForEventPoolWithHostVisibleT
res = context->openEventPoolIpcHandle(ipcHandle, &ipcEventPoolHandle);
EXPECT_EQ(res, ZE_RESULT_SUCCESS);
auto ipcEventPool = static_cast<L0::EventPoolImp *>(L0::EventPool::fromHandle(ipcEventPoolHandle));
auto ipcEventPool = L0::EventPool::fromHandle(ipcEventPoolHandle);
EXPECT_EQ(ipcEventPool->isHostVisibleEventPoolAllocation, eventPool->isHostVisibleEventPoolAllocation);
EXPECT_TRUE(ipcEventPool->isHostVisibleEventPoolAllocation);
@ -558,7 +554,7 @@ TEST_F(EventPoolIPCHandleTests, whenOpeningIpcHandleForEventPoolWithDeviceAllocT
auto &ipcHandleData = *reinterpret_cast<IpcEventPoolData *>(ipcHandle.data);
EXPECT_TRUE(ipcHandleData.isDeviceEventPoolAllocation);
auto ipcEventPool = static_cast<L0::EventPoolImp *>(L0::EventPool::fromHandle(ipcEventPoolHandle));
auto ipcEventPool = L0::EventPool::fromHandle(ipcEventPoolHandle);
EXPECT_TRUE(ipcEventPool->isDeviceEventPoolAllocation);
@ -589,9 +585,8 @@ TEST_F(EventPoolIPCHandleTests, GivenEventPoolWithIPCEventFlagAndDeviceMemoryThe
std::unique_ptr<L0::EventPool> eventPool(EventPool::create(driverHandle.get(), context, 0, nullptr, &eventPoolDesc, result));
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
ASSERT_NE(nullptr, eventPool);
L0::EventPoolImp *eventPoolImp = reinterpret_cast<L0::EventPoolImp *>(eventPool.get());
EXPECT_TRUE(eventPoolImp->isShareableEventMemory);
EXPECT_TRUE(eventPool->isShareableEventMemory);
}
TEST_F(EventPoolIPCHandleTests, GivenEventPoolWithIPCEventFlagAndHostMemoryThenShareableEventMemoryIsFalse) {
@ -1167,17 +1162,16 @@ TEST_F(EventUsedPacketSignalSynchronizeTest, givenInfiniteTimeoutWhenWaitingForT
using EventPoolIPCEventResetTests = Test<DeviceFixture>;
TEST_F(EventPoolIPCEventResetTests, whenOpeningIpcHandleForEventPoolCreateWithIpcFlagThenEventsInNewPoolAreNotReset) {
std::unique_ptr<L0::EventPoolImp> eventPool = nullptr;
ze_event_pool_desc_t eventPoolDesc = {};
eventPoolDesc.count = 1;
eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_HOST_VISIBLE;
ze_result_t result = ZE_RESULT_SUCCESS;
eventPool = std::unique_ptr<L0::EventPoolImp>(static_cast<L0::EventPoolImp *>(L0::EventPool::create(driverHandle.get(),
context,
0,
nullptr,
&eventPoolDesc,
result)));
std::unique_ptr<L0::EventPool> eventPool = std::unique_ptr<L0::EventPool>(L0::EventPool::create(driverHandle.get(),
context,
0,
nullptr,
&eventPoolDesc,
result));
EXPECT_NE(nullptr, eventPool);
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
@ -1952,7 +1946,7 @@ TEST_F(EventPoolCreateNegativeTest, whenInitializingEventPoolButMemoryManagerFai
result = zeDeviceGet(driverHandle.get(), &deviceCount, devices);
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
auto eventPool = new L0::EventPoolImp(&eventPoolDesc);
auto eventPool = new L0::EventPool(&eventPoolDesc);
EXPECT_NE(nullptr, eventPool);
result = eventPool->initialize(driverHandle.get(), context, numRootDevices, devices);
@ -2140,7 +2134,7 @@ struct EventSizeFixture : public DeviceFixture {
DebugManagerStateRestore restore;
ze_device_handle_t hDevice = 0;
std::unique_ptr<EventPoolImp> eventPool;
std::unique_ptr<L0::EventPool> eventPool;
std::unique_ptr<L0::Event> eventObj0;
std::unique_ptr<L0::Event> eventObj1;
};
@ -2149,7 +2143,7 @@ using EventSizeTests = Test<EventSizeFixture>;
HWTEST_F(EventSizeTests, whenCreatingEventPoolThenUseCorrectSizeAndAlignment) {
ze_result_t result = ZE_RESULT_SUCCESS;
eventPool.reset(static_cast<EventPoolImp *>(EventPool::create(device->getDriverHandle(), context, 1, &hDevice, &eventPoolDesc, result)));
eventPool.reset(EventPool::create(device->getDriverHandle(), context, 1, &hDevice, &eventPoolDesc, result));
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
auto &gfxCoreHelper = device->getGfxCoreHelper();
auto &hwInfo = device->getHwInfo();
@ -2201,7 +2195,7 @@ HWTEST_F(EventSizeTests, givenDebugFlagwhenCreatingEventPoolThenUseCorrectSizeAn
DebugManager.flags.OverrideTimestampPacketSize.set(4);
ze_result_t result = ZE_RESULT_SUCCESS;
eventPool.reset(static_cast<EventPoolImp *>(EventPool::create(device->getDriverHandle(), context, 1, &hDevice, &eventPoolDesc, result)));
eventPool.reset(EventPool::create(device->getDriverHandle(), context, 1, &hDevice, &eventPoolDesc, result));
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
auto singlePacketSize = TimestampPackets<uint32_t>::getSinglePacketSize();
@ -2222,7 +2216,7 @@ HWTEST_F(EventSizeTests, givenDebugFlagwhenCreatingEventPoolThenUseCorrectSizeAn
DebugManager.flags.OverrideTimestampPacketSize.set(8);
ze_result_t result = ZE_RESULT_SUCCESS;
eventPool.reset(static_cast<EventPoolImp *>(EventPool::create(device->getDriverHandle(), context, 1, &hDevice, &eventPoolDesc, result)));
eventPool.reset(EventPool::create(device->getDriverHandle(), context, 1, &hDevice, &eventPoolDesc, result));
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
auto singlePacketSize = TimestampPackets<uint64_t>::getSinglePacketSize();

View File

@ -354,12 +354,12 @@ TEST_F(MemoryExportImportObtainFdTest,
auto deviceHandle = device->toHandle();
ze_result_t result = ZE_RESULT_SUCCESS;
auto eventPool = static_cast<EventPoolImp *>(EventPool::create(driverHandle.get(),
context.get(),
1,
&deviceHandle,
&eventPoolDesc,
result));
auto eventPool = EventPool::create(driverHandle.get(),
context.get(),
1,
&deviceHandle,
&eventPoolDesc,
result);
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
EXPECT_NE(nullptr, eventPool);
@ -382,12 +382,12 @@ TEST_F(MemoryExportImportObtainFdTest,
auto deviceHandle = device->toHandle();
ze_result_t result = ZE_RESULT_SUCCESS;
auto eventPool = static_cast<EventPoolImp *>(EventPool::create(driverHandle.get(),
context.get(),
1,
&deviceHandle,
&eventPoolDesc,
result));
auto eventPool = EventPool::create(driverHandle.get(),
context.get(),
1,
&deviceHandle,
&eventPoolDesc,
result);
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
EXPECT_NE(nullptr, eventPool);
eventPool->isShareableEventMemory = true;

View File

@ -95,7 +95,7 @@ HWTEST2_F(EventPoolIPCHandleHpcCoreTests, whenOpeningIpcHandleForEventPoolWithHo
res = context->openEventPoolIpcHandle(ipcHandle, &ipcEventPoolHandle);
EXPECT_EQ(res, ZE_RESULT_SUCCESS);
auto ipcEventPool = static_cast<L0::EventPoolImp *>(L0::EventPool::fromHandle(ipcEventPoolHandle));
auto ipcEventPool = L0::EventPool::fromHandle(ipcEventPoolHandle);
EXPECT_EQ(ipcEventPool->isDeviceEventPoolAllocation, eventPool->isDeviceEventPoolAllocation);
EXPECT_TRUE(ipcEventPool->isDeviceEventPoolAllocation);