Skip to content

Commit 8d1d7c7

Browse files
fix: initialize libnuma only when flag is set
Modified in memory_info.cpp to initialize libnuma only when EnableHostAllocationMemPolicy is set. Related-To: NEO-8276 Signed-off-by: Yoon, Young Jin <[email protected]> Source: cbe35d7
1 parent ced8a68 commit 8d1d7c7

File tree

2 files changed

+4
-18
lines changed

2 files changed

+4
-18
lines changed

shared/source/os_interface/linux/memory_info.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@ MemoryInfo::MemoryInfo(const RegionContainer &regionInfo, const Drm &inputDrm)
3131
return (memoryRegionInfo.region.memoryClass == memoryClassDevice);
3232
});
3333

34-
memPolicySupported = Linux::NumaLibrary::init() && debugManager.flags.EnableHostAllocationMemPolicy.get();
34+
memPolicySupported = false;
35+
if (debugManager.flags.EnableHostAllocationMemPolicy.get()) {
36+
memPolicySupported = Linux::NumaLibrary::init();
37+
}
3538
memPolicyMode = debugManager.flags.OverrideHostAllocationMemPolicyMode.get();
3639
}
3740

shared/test/unit_test/os_interface/linux/drm_memory_info_prelim_tests.cpp

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -713,26 +713,9 @@ TEST(MemoryInfo, givenMemoryInfoWithMemoryPolicyDisabledAndValidOsLibraryWhenCal
713713
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
714714
auto drm = std::make_unique<DrmQueryMock>(*executionEnvironment->rootDeviceEnvironments[0]);
715715

716-
// setup numa library in MemoryInfo
717-
WhiteBoxNumaLibrary::GetMemPolicyPtr memPolicyHandler =
718-
[](int *, unsigned long[], unsigned long, void *, unsigned long) -> long { return -1; };
719-
WhiteBoxNumaLibrary::NumaAvailablePtr numaAvailableHandler =
720-
[](void) -> int { return 0; };
721-
WhiteBoxNumaLibrary::NumaMaxNodePtr numaMaxNodeHandler =
722-
[](void) -> int { return 4; };
723-
MockOsLibrary::loadLibraryNewObject = new MockOsLibraryCustom(nullptr, true);
724-
MockOsLibraryCustom *osLibrary = static_cast<MockOsLibraryCustom *>(MockOsLibrary::loadLibraryNewObject);
725-
// register proc pointers
726-
osLibrary->procMap[std::string(WhiteBoxNumaLibrary::procGetMemPolicyStr)] = reinterpret_cast<void *>(memPolicyHandler);
727-
osLibrary->procMap[std::string(WhiteBoxNumaLibrary::procNumaAvailableStr)] = reinterpret_cast<void *>(numaAvailableHandler);
728-
osLibrary->procMap[std::string(WhiteBoxNumaLibrary::procNumaMaxNodeStr)] = reinterpret_cast<void *>(numaMaxNodeHandler);
729-
WhiteBoxNumaLibrary::osLibraryLoadFunction = MockOsLibraryCustom::load;
730716
auto memoryInfo = std::make_unique<MemoryInfo>(regionInfo, *drm);
731717
ASSERT_NE(nullptr, memoryInfo);
732718
ASSERT_FALSE(memoryInfo->isMemPolicySupported());
733-
734-
MockOsLibrary::loadLibraryNewObject = nullptr;
735-
WhiteBoxNumaLibrary::osLibrary.reset();
736719
}
737720
TEST(MemoryInfo, givenMemoryInfoWithRegionsWhenCreatingGemExtWithChunkingButSizeLessThanAllowedThenExceptionIsThrown) {
738721
DebugManagerStateRestore restorer;

0 commit comments

Comments
 (0)