fix: set single localMemBanksCount when no MemoryInfo

Support legacy case.

Related-To: NEO-9754
Signed-off-by: Maciej Bielski <maciej.bielski@intel.com>
This commit is contained in:
Maciej Bielski
2024-05-16 12:57:46 +00:00
committed by Compute-Runtime-Automation
parent 90df4b298b
commit d79c952d2b
4 changed files with 17 additions and 5 deletions

View File

@@ -144,9 +144,9 @@ void DrmMemoryManager::initialize(GemCloseWorkerMode mode) {
}
void DrmMemoryManager::setLocalMemBanksCount(uint32_t rootDeviceIndex) {
const auto &drm = getDrm(rootDeviceIndex);
if (localMemorySupported[rootDeviceIndex] && drm.getMemoryInfo()) {
localMemBanksCount[rootDeviceIndex] = drm.getMemoryInfo()->getLocalMemoryRegions().size();
const auto *memoryInfo = getDrm(rootDeviceIndex).getMemoryInfo();
if (localMemorySupported[rootDeviceIndex]) {
localMemBanksCount[rootDeviceIndex] = (memoryInfo ? memoryInfo->getLocalMemoryRegions().size() : 1u);
}
};

View File

@@ -60,6 +60,7 @@ class TestedDrmMemoryManager : public MemoryManagerCreate<DrmMemoryManager> {
using DrmMemoryManager::getUserptrAlignment;
using DrmMemoryManager::gfxPartitions;
using DrmMemoryManager::handleFenceCompletion;
using DrmMemoryManager::localMemBanksCount;
using DrmMemoryManager::lockBufferObject;
using DrmMemoryManager::lockResourceImpl;
using DrmMemoryManager::mapPhysicalToVirtualMemory;

View File

@@ -275,6 +275,11 @@ TEST_F(DrmMemoryManagerLocalMemoryPrelimTest, givenMultiRootDeviceEnvironmentAnd
}
auto memoryManager = std::make_unique<TestedDrmMemoryManager>(true, false, false, *executionEnvironment);
for (uint32_t i = 0; i < rootDevicesNumber; i++) {
auto isLocalMemorySupported = executionEnvironment->rootDeviceEnvironments[i]->getHelper<GfxCoreHelper>().getEnableLocalMemory(*defaultHwInfo);
EXPECT_EQ(memoryManager->localMemBanksCount[i], (isLocalMemorySupported ? 1u : 0u));
}
size_t size = 4096u;
AllocationProperties properties(rootDeviceIndex, true, size, AllocationType::bufferHostMemory, false, {});

View File

@@ -290,11 +290,13 @@ TEST_F(DrmMemoryManagerLocalMemoryTest, givenMultiRootDeviceEnvironmentAndNoMemo
MultiGraphicsAllocation multiGraphics(rootDevicesNumber);
RootDeviceIndicesContainer rootDeviceIndices;
auto osInterface = executionEnvironment->rootDeviceEnvironments[0]->osInterface.release();
auto hwInfo = *defaultHwInfo;
hwInfo.featureTable.flags.ftrLocalMemory = true;
executionEnvironment->prepareRootDeviceEnvironments(rootDevicesNumber);
for (uint32_t i = 0; i < rootDevicesNumber; i++) {
executionEnvironment->rootDeviceEnvironments[i]->setHwInfoAndInitHelpers(defaultHwInfo.get());
auto mock = new DrmTipMock(*executionEnvironment->rootDeviceEnvironments[i]);
executionEnvironment->rootDeviceEnvironments[i]->setHwInfoAndInitHelpers(&hwInfo);
auto mock = new DrmTipMock(*executionEnvironment->rootDeviceEnvironments[i], &hwInfo);
mock->memoryInfo.reset(nullptr);
mock->ioctlCallsCount = 0;
@@ -308,6 +310,10 @@ TEST_F(DrmMemoryManagerLocalMemoryTest, givenMultiRootDeviceEnvironmentAndNoMemo
}
auto memoryManager = std::make_unique<TestedDrmMemoryManager>(true, false, false, *executionEnvironment);
for (uint32_t i = 0; i < rootDevicesNumber; i++) {
auto isLocalMemorySupported = executionEnvironment->rootDeviceEnvironments[i]->getHelper<GfxCoreHelper>().getEnableLocalMemory(hwInfo);
EXPECT_EQ(memoryManager->localMemBanksCount[i], (isLocalMemorySupported ? 1u : 0u));
}
size_t size = 4096u;
AllocationProperties properties(rootDeviceIndex, true, size, AllocationType::bufferHostMemory, false, {});