disable event query status optimization for ipc events
Related-To: NEO-7636 Signed-off-by: Zbigniew Zdanowicz <zbigniew.zdanowicz@intel.com>
This commit is contained in:
parent
272254569d
commit
9441e1c510
|
@ -218,6 +218,7 @@ struct Event : _ze_event_handle_t {
|
|||
bool isTimestampEvent = false;
|
||||
bool usingContextEndOffset = false;
|
||||
bool signalAllEventPackets = false;
|
||||
bool isFromIpcPool = false;
|
||||
};
|
||||
|
||||
template <typename TagSizeT>
|
||||
|
|
|
@ -43,6 +43,7 @@ Event *Event::create(EventPool *eventPool, const ze_event_desc_t *desc, Device *
|
|||
event->csr = csr;
|
||||
event->maxKernelCount = eventPool->getMaxKernelCount();
|
||||
event->maxPacketCount = eventPool->getEventMaxPackets();
|
||||
event->isFromIpcPool = eventPool->isImportedIpcPool;
|
||||
|
||||
event->kernelEventCompletionData =
|
||||
std::make_unique<KernelEventCompletionData<TagSizeT>[]>(event->maxKernelCount);
|
||||
|
@ -180,7 +181,7 @@ ze_result_t EventImp<TagSizeT>::queryStatus() {
|
|||
this->csr->downloadAllocation(this->getAllocation(this->device));
|
||||
}
|
||||
|
||||
if (isAlreadyCompleted()) {
|
||||
if (!this->isFromIpcPool && isAlreadyCompleted()) {
|
||||
return ZE_RESULT_SUCCESS;
|
||||
} else {
|
||||
return queryStatusEventPackets();
|
||||
|
|
|
@ -22,6 +22,7 @@ struct WhiteBox<::L0::Event> : public ::L0::Event {
|
|||
using BaseClass::csr;
|
||||
using BaseClass::Event;
|
||||
using BaseClass::hostAddress;
|
||||
using BaseClass::isFromIpcPool;
|
||||
using BaseClass::l3FlushAppliedOnKernel;
|
||||
using BaseClass::maxKernelCount;
|
||||
using BaseClass::signalAllEventPackets;
|
||||
|
@ -71,6 +72,7 @@ class MockEvent : public ::L0::Event {
|
|||
using ::L0::Event::gpuEndTimestamp;
|
||||
using ::L0::Event::gpuStartTimestamp;
|
||||
using ::L0::Event::isCompleted;
|
||||
using ::L0::Event::isFromIpcPool;
|
||||
using ::L0::Event::l3FlushAppliedOnKernel;
|
||||
using ::L0::Event::maxKernelCount;
|
||||
using ::L0::Event::signalAllEventPackets;
|
||||
|
|
|
@ -301,9 +301,18 @@ class MemoryManagerEventPoolIPCMock : public NEO::MockMemoryManager {
|
|||
alloc->isShareableHostMemory = true;
|
||||
multiGraphicsAllocation.addAllocation(alloc);
|
||||
return reinterpret_cast<void *>(alloc->getUnderlyingBuffer());
|
||||
};
|
||||
char buffer[64];
|
||||
}
|
||||
GraphicsAllocation *createGraphicsAllocationFromSharedHandle(osHandle handle, const AllocationProperties &properties, bool requireSpecificBitness, bool isHostIpcAllocation, bool reuseSharedAllocation) override {
|
||||
if (callParentCreateGraphicsAllocationFromSharedHandle) {
|
||||
return NEO::MockMemoryManager::createGraphicsAllocationFromSharedHandle(handle, properties, requireSpecificBitness, isHostIpcAllocation, reuseSharedAllocation);
|
||||
}
|
||||
alloc = new NEO::MockGraphicsAllocation(&buffer, sizeof(buffer));
|
||||
alloc->isShareableHostMemory = true;
|
||||
return alloc;
|
||||
}
|
||||
char buffer[256];
|
||||
NEO::MockGraphicsAllocation *alloc;
|
||||
bool callParentCreateGraphicsAllocationFromSharedHandle = true;
|
||||
};
|
||||
|
||||
using EventPoolIPCHandleTests = Test<DeviceFixture>;
|
||||
|
@ -610,6 +619,64 @@ TEST_F(EventPoolIPCHandleTests, GivenEventPoolWithIPCEventFlagAndHostMemoryThenS
|
|||
EXPECT_FALSE(allocation->getGraphicsAllocation(device->getNEODevice()->getRootDeviceIndex())->isShareableHostMemory);
|
||||
}
|
||||
|
||||
TEST_F(EventPoolIPCHandleTests, GivenIpcEventPoolWhenCreatingEventFromIpcPoolThenExpectIpcFlag) {
|
||||
uint32_t numEvents = 1;
|
||||
ze_event_pool_desc_t eventPoolDesc = {
|
||||
ZE_STRUCTURE_TYPE_EVENT_POOL_DESC,
|
||||
nullptr,
|
||||
ZE_EVENT_POOL_FLAG_HOST_VISIBLE | ZE_EVENT_POOL_FLAG_IPC,
|
||||
numEvents};
|
||||
|
||||
auto deviceHandle = device->toHandle();
|
||||
ze_result_t result = ZE_RESULT_SUCCESS;
|
||||
auto curMemoryManager = driverHandle->getMemoryManager();
|
||||
MemoryManagerEventPoolIPCMock *mockMemoryManager = new MemoryManagerEventPoolIPCMock(*neoDevice->executionEnvironment);
|
||||
mockMemoryManager->callParentCreateGraphicsAllocationFromSharedHandle = false;
|
||||
driverHandle->setMemoryManager(mockMemoryManager);
|
||||
auto eventPool = EventPool::create(driverHandle.get(), context, 1, &deviceHandle, &eventPoolDesc, result);
|
||||
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
ASSERT_NE(nullptr, eventPool);
|
||||
|
||||
ze_ipc_event_pool_handle_t ipcHandle = {};
|
||||
ze_result_t res = eventPool->getIpcHandle(&ipcHandle);
|
||||
EXPECT_EQ(res, ZE_RESULT_SUCCESS);
|
||||
|
||||
ze_event_pool_handle_t ipcEventPoolHandle = {};
|
||||
res = context->openEventPoolIpcHandle(ipcHandle, &ipcEventPoolHandle);
|
||||
ASSERT_EQ(res, ZE_RESULT_SUCCESS);
|
||||
|
||||
auto ipcEventPool = L0::EventPool::fromHandle(ipcEventPoolHandle);
|
||||
|
||||
const ze_event_desc_t eventDesc = {
|
||||
ZE_STRUCTURE_TYPE_EVENT_DESC,
|
||||
nullptr,
|
||||
0,
|
||||
0,
|
||||
0};
|
||||
|
||||
auto event = whiteboxCast(Event::create<uint32_t>(ipcEventPool, &eventDesc, device));
|
||||
ASSERT_NE(nullptr, event);
|
||||
EXPECT_TRUE(event->isFromIpcPool);
|
||||
|
||||
res = ipcEventPool->closeIpcHandle();
|
||||
EXPECT_EQ(res, ZE_RESULT_SUCCESS);
|
||||
|
||||
uint32_t *data = static_cast<uint32_t *>(event->getCompletionFieldHostAddress());
|
||||
for (uint32_t i = 0; i < event->getPacketsInUse(); i++) {
|
||||
*data = L0::Event::STATE_CLEARED;
|
||||
data = ptrOffset(data, event->getSinglePacketSize());
|
||||
}
|
||||
event->setIsCompleted();
|
||||
result = event->queryStatus();
|
||||
EXPECT_EQ(ZE_RESULT_NOT_READY, result);
|
||||
event->destroy();
|
||||
|
||||
res = eventPool->destroy();
|
||||
EXPECT_EQ(res, ZE_RESULT_SUCCESS);
|
||||
delete mockMemoryManager;
|
||||
driverHandle->setMemoryManager(curMemoryManager);
|
||||
}
|
||||
|
||||
using EventPoolOpenIPCHandleFailTests = Test<DeviceFixture>;
|
||||
|
||||
TEST_F(EventPoolOpenIPCHandleFailTests, givenFailureToAllocateMemoryWhenOpeningIpcHandleForEventPoolThenInvalidArgumentIsReturned) {
|
||||
|
|
|
@ -14,9 +14,9 @@
|
|||
namespace L0 {
|
||||
namespace ult {
|
||||
|
||||
class MemoryManagerEventPoolIPCMock : public NEO::MockMemoryManager {
|
||||
class MemoryManagerEventPoolIPCMockXeHpc : public NEO::MockMemoryManager {
|
||||
public:
|
||||
MemoryManagerEventPoolIPCMock(NEO::ExecutionEnvironment &executionEnvironment) : NEO::MockMemoryManager(executionEnvironment) {}
|
||||
MemoryManagerEventPoolIPCMockXeHpc(NEO::ExecutionEnvironment &executionEnvironment) : NEO::MockMemoryManager(executionEnvironment) {}
|
||||
void *createMultiGraphicsAllocationInSystemMemoryPool(RootDeviceIndicesContainer &rootDeviceIndices, AllocationProperties &properties, NEO::MultiGraphicsAllocation &multiGraphicsAllocation) override {
|
||||
alloc = new NEO::MockGraphicsAllocation(&buffer, sizeof(buffer));
|
||||
alloc->isShareableHostMemory = true;
|
||||
|
@ -40,7 +40,7 @@ HWTEST2_F(EventPoolIPCHandleHpcCoreTests, whenGettingIpcHandleForEventPoolWithDe
|
|||
auto deviceHandle = device->toHandle();
|
||||
ze_result_t result = ZE_RESULT_SUCCESS;
|
||||
auto curMemoryManager = driverHandle->getMemoryManager();
|
||||
MemoryManagerEventPoolIPCMock *mockMemoryManager = new MemoryManagerEventPoolIPCMock(*neoDevice->executionEnvironment);
|
||||
MemoryManagerEventPoolIPCMockXeHpc *mockMemoryManager = new MemoryManagerEventPoolIPCMockXeHpc(*neoDevice->executionEnvironment);
|
||||
driverHandle->setMemoryManager(mockMemoryManager);
|
||||
auto eventPool = EventPool::create(driverHandle.get(), context, 1, &deviceHandle, &eventPoolDesc, result);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
|
@ -81,7 +81,7 @@ HWTEST2_F(EventPoolIPCHandleHpcCoreTests, whenOpeningIpcHandleForEventPoolWithHo
|
|||
auto deviceHandle = device->toHandle();
|
||||
ze_result_t result = ZE_RESULT_SUCCESS;
|
||||
auto curMemoryManager = driverHandle->getMemoryManager();
|
||||
MemoryManagerEventPoolIPCMock *mockMemoryManager = new MemoryManagerEventPoolIPCMock(*neoDevice->executionEnvironment);
|
||||
MemoryManagerEventPoolIPCMockXeHpc *mockMemoryManager = new MemoryManagerEventPoolIPCMockXeHpc(*neoDevice->executionEnvironment);
|
||||
driverHandle->setMemoryManager(mockMemoryManager);
|
||||
auto eventPool = EventPool::create(driverHandle.get(), context, 1, &deviceHandle, &eventPoolDesc, result);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
|
|
Loading…
Reference in New Issue