From 9a3fea9849c56e41df2aa43ee05269217a13516b Mon Sep 17 00:00:00 2001 From: "Dunajski, Bartosz" Date: Fri, 17 Nov 2023 10:22:58 +0000 Subject: [PATCH] feature: disable IPC for CB Events Related-To: NEO-8145 Signed-off-by: Dunajski, Bartosz --- level_zero/core/source/event/event.cpp | 10 ++++++++-- .../test_cmdlist_append_launch_kernel_3.cpp | 14 ++++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/level_zero/core/source/event/event.cpp b/level_zero/core/source/event/event.cpp index ec1b2291e4..57b8de5827 100644 --- a/level_zero/core/source/event/event.cpp +++ b/level_zero/core/source/event/event.cpp @@ -42,6 +42,12 @@ template Event *Event::create(EventPool *, const ze_event_desc_t *, De ze_result_t EventPool::initialize(DriverHandle *driver, Context *context, uint32_t numDevices, ze_device_handle_t *deviceHandles) { this->context = static_cast(context); + bool ipcPool = eventPoolFlags & ZE_EVENT_POOL_FLAG_IPC; + + if (ipcPool && counterBased) { + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; + } + RootDeviceIndicesContainer rootDeviceIndices; uint32_t maxRootDeviceIndex = 0u; uint32_t currentNumDevices = numDevices; @@ -108,7 +114,7 @@ ze_result_t EventPool::initialize(DriverHandle *driver, Context *context, uint32 if (graphicsAllocation) { eventPoolAllocations->addAllocation(graphicsAllocation); allocatedMemory = true; - if (eventPoolFlags & ZE_EVENT_POOL_FLAG_IPC) { + if (ipcPool) { uint64_t handle = 0; this->isShareableEventMemory = (graphicsAllocation->peekInternalHandle(memoryManager, handle) == 0); } @@ -121,7 +127,7 @@ ze_result_t EventPool::initialize(DriverHandle *driver, Context *context, uint32 eventPoolPtr = driver->getMemoryManager()->createMultiGraphicsAllocationInSystemMemoryPool(rootDeviceIndices, allocationProperties, *eventPoolAllocations); - if (eventPoolFlags & ZE_EVENT_POOL_FLAG_IPC) { + if (ipcPool) { this->isShareableEventMemory = eventPoolAllocations->getDefaultGraphicsAllocation()->isShareableHostMemory; } allocatedMemory = (nullptr != eventPoolPtr); diff --git a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_launch_kernel_3.cpp b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_launch_kernel_3.cpp index 9131ad96ab..8f131cad22 100644 --- a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_launch_kernel_3.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_launch_kernel_3.cpp @@ -923,6 +923,20 @@ HWTEST2_F(InOrderCmdListTests, givenNotSignaledInOrderEventWhenAddedToWaitListTh EXPECT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, returnValue); } +HWTEST2_F(InOrderCmdListTests, givenIpcAndCounterBasedEventPoolFlagsWhenCreatingThenReturnError, IsAtLeastSkl) { + ze_event_pool_desc_t eventPoolDesc = {}; + eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_IPC; + eventPoolDesc.count = 1; + + ze_event_pool_counter_based_exp_desc_t counterBasedExtension = {ZE_STRUCTURE_TYPE_COUNTER_BASED_EVENT_POOL_EXP_DESC}; + eventPoolDesc.pNext = &counterBasedExtension; + + auto eventPool = EventPool::create(driverHandle.get(), context, 0, nullptr, &eventPoolDesc, returnValue); + + EXPECT_EQ(nullptr, eventPool); + EXPECT_EQ(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, returnValue); +} + HWTEST2_F(InOrderCmdListTests, givenNotSignaledInOrderWhenWhenCallingQueryStatusThenReturnNotReady, IsAtLeastSkl) { auto eventPool = createEvents(1, false); events[0]->enableCounterBasedMode(true);