mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-05 09:09:04 +08:00
Revert "Fix Device Allocated IPC Events"
This reverts commit 1360ec9179.
Signed-off-by: Compute-Runtime-Validation <compute-runtime-validation@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
feb1366f6f
commit
ad072b4d5d
@@ -568,9 +568,6 @@ ze_result_t EventPoolImp::getIpcHandle(ze_ipc_event_pool_handle_t *pIpcHandle) {
|
||||
memcpy_s(pIpcHandle->data + sizeof(int) + sizeof(this->numEvents),
|
||||
sizeof(rootDeviceIndex), &rootDeviceIndex, sizeof(rootDeviceIndex));
|
||||
|
||||
memcpy_s(pIpcHandle->data + sizeof(int) + sizeof(this->numEvents) + sizeof(uint32_t),
|
||||
sizeof(this->isDeviceEventPoolAllocation), &this->isDeviceEventPoolAllocation, sizeof(this->isDeviceEventPoolAllocation));
|
||||
|
||||
return ZE_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -590,25 +587,15 @@ ze_result_t ContextImp::openEventPoolIpcHandle(const ze_ipc_event_pool_handle_t
|
||||
memcpy_s(&rootDeviceIndex, sizeof(rootDeviceIndex),
|
||||
hIpc.data + sizeof(int) + sizeof(numEvents), sizeof(rootDeviceIndex));
|
||||
|
||||
memcpy_s(&eventPool->isDeviceEventPoolAllocation, sizeof(eventPool->isDeviceEventPoolAllocation),
|
||||
hIpc.data + sizeof(int) + sizeof(numEvents) + sizeof(rootDeviceIndex), sizeof(eventPool->isDeviceEventPoolAllocation));
|
||||
|
||||
auto device = Device::fromHandle(this->devices.begin()->second);
|
||||
auto neoDevice = device->getNEODevice();
|
||||
NEO::osHandle osHandle = static_cast<NEO::osHandle>(handle);
|
||||
|
||||
eventPool->initializeSizeParameters(this->numDevices, this->deviceHandles.data(), *this->driverHandle, device->getHwInfo());
|
||||
|
||||
NEO::AllocationType allocationType = NEO::AllocationType::BUFFER_HOST_MEMORY;
|
||||
bool isHostUsmAllocation = true;
|
||||
if (eventPool->isDeviceEventPoolAllocation) {
|
||||
allocationType = NEO::AllocationType::GPU_TIMESTAMP_DEVICE_BUFFER;
|
||||
isHostUsmAllocation = false;
|
||||
}
|
||||
|
||||
NEO::AllocationProperties unifiedMemoryProperties{rootDeviceIndex,
|
||||
eventPool->getEventPoolSize(),
|
||||
allocationType,
|
||||
NEO::AllocationType::BUFFER_HOST_MEMORY,
|
||||
systemMemoryBitfield};
|
||||
|
||||
unifiedMemoryProperties.subDevicesBitfield = neoDevice->getDeviceBitfield();
|
||||
@@ -616,7 +603,7 @@ ze_result_t ContextImp::openEventPoolIpcHandle(const ze_ipc_event_pool_handle_t
|
||||
NEO::GraphicsAllocation *alloc = memoryManager->createGraphicsAllocationFromSharedHandle(osHandle,
|
||||
unifiedMemoryProperties,
|
||||
false,
|
||||
isHostUsmAllocation,
|
||||
true,
|
||||
false);
|
||||
|
||||
if (alloc == nullptr) {
|
||||
|
||||
@@ -48,7 +48,7 @@ ze_result_t EventPoolImp::initialize(DriverHandle *driver, Context *context, uin
|
||||
|
||||
DriverHandleImp *driverHandleImp = static_cast<DriverHandleImp *>(driver);
|
||||
bool useDevicesFromApi = true;
|
||||
this->isDeviceEventPoolAllocation = isEventPoolDeviceAllocationFlagSet();
|
||||
bool useDeviceAlloc = isEventPoolDeviceAllocationFlagSet();
|
||||
|
||||
if (numDevices == 0) {
|
||||
currentNumDevices = static_cast<uint32_t>(driverHandleImp->devices.size());
|
||||
@@ -78,17 +78,17 @@ ze_result_t EventPoolImp::initialize(DriverHandle *driver, Context *context, uin
|
||||
|
||||
auto &hwInfo = getDevice()->getHwInfo();
|
||||
auto &l0GfxCoreHelper = getDevice()->getNEODevice()->getRootDeviceEnvironment().getHelper<L0GfxCoreHelper>();
|
||||
this->isDeviceEventPoolAllocation |= l0GfxCoreHelper.alwaysAllocateEventInLocalMem();
|
||||
useDeviceAlloc |= l0GfxCoreHelper.alwaysAllocateEventInLocalMem();
|
||||
|
||||
initializeSizeParameters(numDevices, phDevices, *driverHandleImp, hwInfo);
|
||||
|
||||
NEO::AllocationType allocationType = isEventPoolTimestampFlagSet() ? NEO::AllocationType::TIMESTAMP_PACKET_TAG_BUFFER
|
||||
: NEO::AllocationType::BUFFER_HOST_MEMORY;
|
||||
if (this->devices.size() > 1) {
|
||||
this->isDeviceEventPoolAllocation = false;
|
||||
useDeviceAlloc = false;
|
||||
}
|
||||
|
||||
if (this->isDeviceEventPoolAllocation) {
|
||||
if (useDeviceAlloc) {
|
||||
allocationType = NEO::AllocationType::GPU_TIMESTAMP_DEVICE_BUFFER;
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ ze_result_t EventPoolImp::initialize(DriverHandle *driver, Context *context, uin
|
||||
|
||||
bool allocatedMemory = false;
|
||||
|
||||
if (this->isDeviceEventPoolAllocation) {
|
||||
if (useDeviceAlloc) {
|
||||
NEO::AllocationProperties allocationProperties{*rootDeviceIndices.begin(), this->eventPoolSize, allocationType, devices[0]->getNEODevice()->getDeviceBitfield()};
|
||||
allocationProperties.alignment = eventAlignment;
|
||||
|
||||
|
||||
@@ -304,7 +304,6 @@ struct EventPool : _ze_event_pool_handle_t {
|
||||
|
||||
std::unique_ptr<NEO::MultiGraphicsAllocation> eventPoolAllocations;
|
||||
ze_event_pool_flags_t eventPoolFlags;
|
||||
bool isDeviceEventPoolAllocation = false;
|
||||
|
||||
protected:
|
||||
EventPool() = default;
|
||||
|
||||
@@ -343,55 +343,6 @@ TEST_F(EventPoolIPCHandleTests, whenGettingIpcHandleForEventPoolThenHandleAndNum
|
||||
driverHandle->setMemoryManager(curMemoryManager);
|
||||
}
|
||||
|
||||
TEST_F(EventPoolIPCHandleTests, whenGettingIpcHandleForEventPoolWithDeviceAllocThenHandleAndDeviceAllocAreReturnedInHandle) {
|
||||
uint32_t numEvents = 4;
|
||||
ze_event_pool_desc_t eventPoolDesc = {
|
||||
ZE_STRUCTURE_TYPE_EVENT_POOL_DESC,
|
||||
nullptr,
|
||||
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);
|
||||
driverHandle->setMemoryManager(mockMemoryManager);
|
||||
auto eventPool = EventPool::create(driverHandle.get(), context, 1, &deviceHandle, &eventPoolDesc, result);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
EXPECT_NE(nullptr, eventPool);
|
||||
|
||||
EXPECT_TRUE(eventPool->isDeviceEventPoolAllocation);
|
||||
|
||||
auto allocation = &eventPool->getAllocation();
|
||||
|
||||
EXPECT_EQ(allocation->getAllocationType(), NEO::AllocationType::GPU_TIMESTAMP_DEVICE_BUFFER);
|
||||
|
||||
ze_ipc_event_pool_handle_t ipcHandle = {};
|
||||
ze_result_t res = eventPool->getIpcHandle(&ipcHandle);
|
||||
EXPECT_EQ(res, ZE_RESULT_SUCCESS);
|
||||
|
||||
int handle = -1;
|
||||
memcpy_s(&handle, sizeof(int), ipcHandle.data, sizeof(int));
|
||||
EXPECT_NE(handle, -1);
|
||||
|
||||
uint32_t expectedNumEvents = 0;
|
||||
memcpy_s(&expectedNumEvents, sizeof(expectedNumEvents), ipcHandle.data + sizeof(int), sizeof(expectedNumEvents));
|
||||
EXPECT_EQ(numEvents, expectedNumEvents);
|
||||
|
||||
uint32_t rootDeviceIndex = 0;
|
||||
memcpy_s(&rootDeviceIndex, sizeof(rootDeviceIndex), ipcHandle.data + sizeof(int) + sizeof(size_t), sizeof(rootDeviceIndex));
|
||||
EXPECT_EQ(0u, rootDeviceIndex);
|
||||
|
||||
uint8_t deviceAlloc = 0;
|
||||
memcpy_s(&deviceAlloc, sizeof(deviceAlloc), ipcHandle.data + sizeof(int) + sizeof(size_t) + sizeof(rootDeviceIndex), sizeof(deviceAlloc));
|
||||
EXPECT_EQ(1u, deviceAlloc);
|
||||
|
||||
res = eventPool->destroy();
|
||||
EXPECT_EQ(res, ZE_RESULT_SUCCESS);
|
||||
delete mockMemoryManager;
|
||||
driverHandle->setMemoryManager(curMemoryManager);
|
||||
}
|
||||
|
||||
using EventPoolCreateMultiDevice = Test<MultiDeviceFixture>;
|
||||
|
||||
TEST_F(EventPoolCreateMultiDevice, whenGettingIpcHandleForEventPoolWhenHostShareableMemoryIsFalseThenUnsuportedIsReturned) {
|
||||
@@ -463,55 +414,6 @@ TEST_F(EventPoolIPCHandleTests, whenOpeningIpcHandleForEventPoolThenEventPoolIsC
|
||||
driverHandle->setMemoryManager(curMemoryManager);
|
||||
}
|
||||
|
||||
TEST_F(EventPoolIPCHandleTests, whenOpeningIpcHandleForEventPoolWithDeviceAllocThenEventPoolIsCreatedAsDeviceBufferAndDeviceAllocIsSet) {
|
||||
uint32_t numEvents = 4;
|
||||
ze_event_pool_desc_t eventPoolDesc = {
|
||||
ZE_STRUCTURE_TYPE_EVENT_POOL_DESC,
|
||||
nullptr,
|
||||
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);
|
||||
driverHandle->setMemoryManager(mockMemoryManager);
|
||||
auto eventPool = EventPool::create(driverHandle.get(), context, 1, &deviceHandle, &eventPoolDesc, result);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
EXPECT_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);
|
||||
EXPECT_EQ(res, ZE_RESULT_SUCCESS);
|
||||
|
||||
uint8_t deviceAlloc = 0;
|
||||
memcpy_s(&deviceAlloc, sizeof(deviceAlloc), ipcHandle.data + sizeof(int) + sizeof(size_t) + sizeof(uint32_t), sizeof(deviceAlloc));
|
||||
EXPECT_EQ(1u, deviceAlloc);
|
||||
|
||||
auto ipcEventPool = static_cast<L0::EventPoolImp *>(L0::EventPool::fromHandle(ipcEventPoolHandle));
|
||||
|
||||
EXPECT_TRUE(ipcEventPool->isDeviceEventPoolAllocation);
|
||||
|
||||
auto allocation = &ipcEventPool->getAllocation();
|
||||
|
||||
EXPECT_EQ(allocation->getAllocationType(), NEO::AllocationType::GPU_TIMESTAMP_DEVICE_BUFFER);
|
||||
|
||||
EXPECT_EQ(ipcEventPool->getEventSize(), eventPool->getEventSize());
|
||||
EXPECT_EQ(numEvents, static_cast<uint32_t>(ipcEventPool->getNumEvents()));
|
||||
|
||||
res = ipcEventPool->closeIpcHandle();
|
||||
EXPECT_EQ(res, ZE_RESULT_SUCCESS);
|
||||
|
||||
res = eventPool->destroy();
|
||||
EXPECT_EQ(res, ZE_RESULT_SUCCESS);
|
||||
delete mockMemoryManager;
|
||||
driverHandle->setMemoryManager(curMemoryManager);
|
||||
}
|
||||
|
||||
TEST_F(EventPoolIPCHandleTests, GivenEventPoolWithIPCEventFlagAndDeviceMemoryThenShareableEventMemoryIsTrue) {
|
||||
ze_event_pool_desc_t eventPoolDesc = {
|
||||
ZE_STRUCTURE_TYPE_EVENT_POOL_DESC,
|
||||
|
||||
Reference in New Issue
Block a user