performance: enable l0 usm host pool

disable in sysman ults, pooling breaks in tests that simulate device
error

Related-To: NEO-6893

Signed-off-by: Dominik Dabek <dominik.dabek@intel.com>
This commit is contained in:
Dominik Dabek
2025-06-17 12:11:06 +00:00
committed by Compute-Runtime-Automation
parent de57a3f3dd
commit 00921d0929
11 changed files with 46 additions and 50 deletions

View File

@@ -64,7 +64,7 @@ bool ApiSpecificConfig::isDeviceUsmPoolingEnabled() {
}
bool ApiSpecificConfig::isHostUsmPoolingEnabled() {
return false;
return true;
}
ApiSpecificConfig::ApiType ApiSpecificConfig::getApiType() {

View File

@@ -197,11 +197,12 @@ void MemoryExportImportWSLTest::SetUp() {
}
void MemoryExportImportWSLTest::TearDown() {
// cleanup pool before restoring memory manager
// cleanup pools before restoring memory manager
for (auto device : driverHandle->devices) {
device->getNEODevice()->cleanupUsmAllocationPool();
device->getNEODevice()->resetUsmAllocationPool(nullptr);
}
driverHandle->usmHostMemAllocPool.cleanup();
driverHandle->setMemoryManager(prevMemoryManager);
delete currMemoryManager;
}

View File

@@ -462,6 +462,7 @@ HWTEST_F(CommandQueueIndirectAllocations, givenDebugModeToTreatIndirectAllocatio
device->getDriverHandle()->getSvmAllocsManager()->freeSVMAlloc(deviceAlloc);
commandQueue->destroy();
L0UltHelper::cleanupUsmAllocPools(driverHandle.get());
}
HWTEST_F(CommandQueueIndirectAllocations, givenDeviceThatSupportsSubmittingIndirectAllocationsAsPackWhenIndirectAccessIsUsedThenWholePackIsMadeResident) {

View File

@@ -49,7 +49,7 @@ TEST(ApiSpecificConfigL0Tests, WhenCheckingIfHostDeviceAllocationCacheIsEnabledT
}
TEST(ApiSpecificConfigL0Tests, WhenCheckingIfUsmAllocPoolingIsEnabledThenReturnCorrectValue) {
EXPECT_FALSE(ApiSpecificConfig::isHostUsmPoolingEnabled());
EXPECT_TRUE(ApiSpecificConfig::isHostUsmPoolingEnabled());
EXPECT_TRUE(ApiSpecificConfig::isDeviceUsmPoolingEnabled());
}

View File

@@ -44,7 +44,7 @@ struct AllocUsmPoolMemoryTest : public ::testing::Test {
mockProductHelpers[i]->isDeviceUsmPoolAllocatorSupportedResult = true;
}
}
std::vector<std::unique_ptr<NEO::Device>> devices;
for (auto i = 0u; i < executionEnvironment->rootDeviceEnvironments.size(); i++) {
auto device = std::unique_ptr<NEO::MockDevice>(NEO::MockDevice::createWithExecutionEnvironment<NEO::MockDevice>(NEO::defaultHwInfo.get(),
executionEnvironment, i));
@@ -80,7 +80,6 @@ struct AllocUsmPoolMemoryTest : public ::testing::Test {
std::unique_ptr<Mock<L0::DriverHandleImp>> driverHandle;
const uint32_t numRootDevices = 2u;
L0::ContextImp *context = nullptr;
std::vector<std::unique_ptr<NEO::Device>> devices;
std::vector<MockProductHelper *> mockProductHelpers;
NEO::ExecutionEnvironment *executionEnvironment;
L0::Device *l0Devices[2];
@@ -88,17 +87,30 @@ struct AllocUsmPoolMemoryTest : public ::testing::Test {
};
using AllocUsmHostDefaultMemoryTest = AllocUsmPoolMemoryTest<-1, -1>;
TEST_F(AllocUsmHostDefaultMemoryTest, givenDriverHandleWhenCallinginitHostUsmAllocPoolThenInitIfEnabledForAllDevicesAndNoDebugger) {
driverHandle->usmHostMemAllocPool.cleanup();
mockProductHelpers[0]->isHostUsmPoolAllocatorSupportedResult = false;
mockProductHelpers[1]->isHostUsmPoolAllocatorSupportedResult = false;
driverHandle->initHostUsmAllocPool();
EXPECT_FALSE(driverHandle->usmHostMemAllocPool.isInitialized());
TEST_F(AllocUsmHostDefaultMemoryTest, givenDriverHandleWhenCallingAllocHostMemThenDoNotUsePool) {
driverHandle->usmHostMemAllocPool.cleanup();
mockProductHelpers[0]->isHostUsmPoolAllocatorSupportedResult = true;
mockProductHelpers[1]->isHostUsmPoolAllocatorSupportedResult = false;
driverHandle->initHostUsmAllocPool();
EXPECT_FALSE(driverHandle->usmHostMemAllocPool.isInitialized());
void *ptr = nullptr;
ze_host_mem_alloc_desc_t hostDesc = {};
ze_result_t result = context->allocHostMem(&hostDesc, 1u, 0u, &ptr);
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
EXPECT_NE(nullptr, ptr);
driverHandle->usmHostMemAllocPool.cleanup();
mockProductHelpers[0]->isHostUsmPoolAllocatorSupportedResult = true;
mockProductHelpers[1]->isHostUsmPoolAllocatorSupportedResult = true;
driverHandle->initHostUsmAllocPool();
EXPECT_TRUE(driverHandle->usmHostMemAllocPool.isInitialized());
driverHandle->usmHostMemAllocPool.cleanup();
auto debuggerL0 = DebuggerL0::create(l0Devices[1]->getNEODevice());
executionEnvironment->rootDeviceEnvironments[1]->debugger.reset(debuggerL0.release());
driverHandle->initHostUsmAllocPool();
EXPECT_FALSE(driverHandle->usmHostMemAllocPool.isInitialized());
result = context->freeMem(ptr);
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
}
using AllocUsmHostDisabledMemoryTest = AllocUsmPoolMemoryTest<0, -1>;