mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-20 08:53:55 +08:00
Allocate all event pools in local memory
Currently event pools are allocated in system memory if HOST_VISIBLE flag is being set. With this change such event pool will be allocated in device memory if DC flush is not allowed. Related-To: NEO-7302 Signed-off-by: Szymon Morek <szymon.morek@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
50f9564a18
commit
3bb12ad10a
@@ -76,6 +76,8 @@ ze_result_t EventPoolImp::initialize(DriverHandle *driver, Context *context, uin
|
||||
|
||||
auto &hwHelper = devices[0]->getHwHelper();
|
||||
|
||||
useDeviceAlloc |= !NEO::HwInfoConfig::get(devices[0]->getHwInfo().platform.eProductFamily)->isDcFlushAllowed();
|
||||
|
||||
eventAlignment = static_cast<uint32_t>(hwHelper.getTimestampPacketAllocatorAlignment());
|
||||
eventSize = static_cast<uint32_t>(alignUp(EventPacketsCount::eventPackets * hwHelper.getSingleTimestampPacketSize(), eventAlignment));
|
||||
|
||||
|
||||
@@ -272,6 +272,11 @@ TEST_F(EventPoolCreate, GivenDeviceThenEventPoolIsCreated) {
|
||||
auto eventPool = EventPool::create(driverHandle.get(), context, 1, &deviceHandle, &eventPoolDesc, result);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
ASSERT_NE(nullptr, eventPool);
|
||||
if (NEO::HwInfoConfig::get(device->getHwInfo().platform.eProductFamily)->isDcFlushAllowed()) {
|
||||
EXPECT_EQ(NEO::AllocationType::BUFFER_HOST_MEMORY, eventPool->getAllocation().getAllocationType());
|
||||
} else {
|
||||
EXPECT_EQ(NEO::AllocationType::GPU_TIMESTAMP_DEVICE_BUFFER, eventPool->getAllocation().getAllocationType());
|
||||
}
|
||||
eventPool->destroy();
|
||||
}
|
||||
|
||||
@@ -284,12 +289,6 @@ class MemoryManagerEventPoolIPCMock : public NEO::MockMemoryManager {
|
||||
multiGraphicsAllocation.addAllocation(alloc);
|
||||
return reinterpret_cast<void *>(alloc->getUnderlyingBuffer());
|
||||
};
|
||||
void freeGraphicsMemoryImpl(NEO::GraphicsAllocation *gfxAllocation) override {
|
||||
delete gfxAllocation;
|
||||
};
|
||||
void freeGraphicsMemoryImpl(GraphicsAllocation *gfxAllocation, bool isImportedAllocation) override {
|
||||
delete gfxAllocation;
|
||||
};
|
||||
char buffer[64];
|
||||
NEO::MockGraphicsAllocation *alloc;
|
||||
};
|
||||
@@ -331,7 +330,9 @@ TEST_F(EventPoolIPCHandleTests, whenGettingIpcHandleForEventPoolThenHandleAndNum
|
||||
driverHandle->setMemoryManager(curMemoryManager);
|
||||
}
|
||||
|
||||
TEST_F(EventPoolIPCHandleTests, whenGettingIpcHandleForEventPoolWhenHostShareableMemoryIsFalseThenUnsuportedIsReturned) {
|
||||
using EventPoolCreateMultiDevice = Test<MultiDeviceFixture>;
|
||||
|
||||
TEST_F(EventPoolCreateMultiDevice, whenGettingIpcHandleForEventPoolWhenHostShareableMemoryIsFalseThenUnsuportedIsReturned) {
|
||||
uint32_t numEvents = 4;
|
||||
ze_event_pool_desc_t eventPoolDesc = {
|
||||
ZE_STRUCTURE_TYPE_EVENT_POOL_DESC,
|
||||
@@ -339,9 +340,16 @@ TEST_F(EventPoolIPCHandleTests, whenGettingIpcHandleForEventPoolWhenHostShareabl
|
||||
ZE_EVENT_POOL_FLAG_HOST_VISIBLE | ZE_EVENT_POOL_FLAG_IPC,
|
||||
numEvents};
|
||||
|
||||
auto deviceHandle = device->toHandle();
|
||||
ze_result_t result = ZE_RESULT_SUCCESS;
|
||||
auto eventPool = EventPool::create(driverHandle.get(), context, 1, &deviceHandle, &eventPoolDesc, result);
|
||||
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);
|
||||
|
||||
auto eventPool = EventPool::create(driverHandle.get(), context, deviceCount, devices, &eventPoolDesc, result);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
EXPECT_NE(nullptr, eventPool);
|
||||
|
||||
@@ -351,6 +359,7 @@ TEST_F(EventPoolIPCHandleTests, whenGettingIpcHandleForEventPoolWhenHostShareabl
|
||||
|
||||
res = eventPool->destroy();
|
||||
EXPECT_EQ(res, ZE_RESULT_SUCCESS);
|
||||
delete[] devices;
|
||||
}
|
||||
|
||||
TEST_F(EventPoolIPCHandleTests, whenOpeningIpcHandleForEventPoolThenEventPoolIsCreatedAndEventSizesAreTheSame) {
|
||||
@@ -1191,11 +1200,15 @@ TEST_F(TimestampEventCreate, givenSingleTimestampEventThenAllocationSizeCreatedF
|
||||
minTimestampEventAllocation);
|
||||
}
|
||||
|
||||
TEST_F(TimestampEventCreate, givenTimestampEventThenAllocationsIsOfPacketTagBufferType) {
|
||||
TEST_F(TimestampEventCreate, givenTimestampEventThenAllocationsIsDependentOfDcFlushAllowed) {
|
||||
auto allocation = &eventPool->getAllocation();
|
||||
ASSERT_NE(nullptr, allocation);
|
||||
|
||||
EXPECT_EQ(NEO::AllocationType::TIMESTAMP_PACKET_TAG_BUFFER, allocation->getAllocationType());
|
||||
if (NEO::HwInfoConfig::get(device->getHwInfo().platform.eProductFamily)->isDcFlushAllowed()) {
|
||||
EXPECT_EQ(NEO::AllocationType::TIMESTAMP_PACKET_TAG_BUFFER, allocation->getAllocationType());
|
||||
} else {
|
||||
EXPECT_EQ(NEO::AllocationType::GPU_TIMESTAMP_DEVICE_BUFFER, allocation->getAllocationType());
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(TimestampEventCreate, givenEventTimestampWhenPacketCountIsSetThenCorrectOffsetIsReturned) {
|
||||
@@ -1583,8 +1596,6 @@ TEST_F(TimestampEventCreate, givenEventWhenQueryKernelTimestampThenNotReadyRetur
|
||||
EXPECT_EQ(0u, resultTimestamp.global.kernelEnd);
|
||||
}
|
||||
|
||||
using EventPoolCreateMultiDevice = Test<MultiDeviceFixture>;
|
||||
|
||||
TEST_F(EventPoolCreateMultiDevice, givenReturnSubDevicesAsApiDevicesWhenCallZeGetDevicesThenSubDevicesAreReturnedAsSeparateDevices) {
|
||||
DebugManagerStateRestore restorer;
|
||||
NEO::DebugManager.flags.ReturnSubDevicesAsApiDevices.set(1);
|
||||
@@ -1722,6 +1733,7 @@ TEST_F(EventPoolCreateMultiDevice, whenCreatingEventPoolWithNoDevicesThenEventPo
|
||||
EXPECT_NE(nullptr, allocation);
|
||||
|
||||
EXPECT_EQ(allocation->getGraphicsAllocations().size(), numRootDevices);
|
||||
EXPECT_EQ(NEO::AllocationType::BUFFER_HOST_MEMORY, allocation->getAllocationType());
|
||||
}
|
||||
|
||||
using EventPoolCreateSingleDevice = Test<DeviceFixture>;
|
||||
|
||||
Reference in New Issue
Block a user