Add multitile arch. code in drm getLocalMemorySize

Signed-off-by: Szymon Morek <szymon.morek@intel.com>
This commit is contained in:
Szymon Morek
2021-09-13 10:04:37 +00:00
committed by Compute-Runtime-Automation
parent ebcbf29a85
commit efd66a32c2
7 changed files with 42 additions and 14 deletions

View File

@@ -1045,4 +1045,25 @@ std::unique_ptr<MemoryManager> DrmMemoryManager::create(ExecutionEnvironment &ex
executionEnvironment);
}
uint64_t DrmMemoryManager::getLocalMemorySize(uint32_t rootDeviceIndex, uint32_t deviceBitfield) {
auto memoryInfo = getDrm(rootDeviceIndex).getMemoryInfo();
if (!memoryInfo) {
return 0;
}
auto hwInfo = executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->getHardwareInfo();
uint32_t subDevicesCount = HwHelper::getSubDevicesCount(hwInfo);
size_t size = 0;
for (uint32_t i = 0; i < subDevicesCount; i++) {
auto memoryBank = (1 << i);
if (deviceBitfield & memoryBank) {
size += memoryInfo->getMemoryRegionSize(memoryBank);
}
}
return size;
}
} // namespace NEO

View File

@@ -65,7 +65,4 @@ bool DrmMemoryManager::copyMemoryToAllocation(GraphicsAllocation *graphicsAlloca
return MemoryManager::copyMemoryToAllocation(graphicsAllocation, destinationOffset, memoryToCopy, sizeToCopy);
}
uint64_t DrmMemoryManager::getLocalMemorySize(uint32_t rootDeviceIndex, uint32_t deviceBitfield) {
return 0 * GB;
}
} // namespace NEO

View File

@@ -349,12 +349,4 @@ bool DrmMemoryManager::copyMemoryToAllocation(GraphicsAllocation *graphicsAlloca
return true;
}
uint64_t DrmMemoryManager::getLocalMemorySize(uint32_t rootDeviceIndex, uint32_t deviceBitfield) {
auto memoryInfo = static_cast<MemoryInfoImpl *>(getDrm(rootDeviceIndex).getMemoryInfo());
if (!memoryInfo) {
return 0;
}
return memoryInfo->getMemoryRegionSize(MemoryBanks::getBankForLocalMemory(0));
}
} // namespace NEO

View File

@@ -6,6 +6,8 @@
*/
#pragma once
#include <cstddef>
#include <cstdint>
namespace NEO {
@@ -13,6 +15,7 @@ class MemoryInfo {
public:
MemoryInfo() = default;
virtual ~MemoryInfo() = 0;
virtual size_t getMemoryRegionSize(uint32_t memoryBank) = 0;
};
inline MemoryInfo::~MemoryInfo(){};

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020 Intel Corporation
* Copyright (C) 2020-2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -14,7 +14,6 @@
#include "drm/i915_drm.h"
#include <cstddef>
#include <cstdint>
#include <vector>
namespace NEO {
@@ -33,7 +32,7 @@ struct MemoryInfoImpl : public MemoryInfo {
return {invalidMemoryRegion(), invalidMemoryRegion()};
}
size_t getMemoryRegionSize(uint32_t memoryBank) {
size_t getMemoryRegionSize(uint32_t memoryBank) override {
auto index = (memoryBank > 0) ? Math::log2(memoryBank) + 1 : 0;
if (index < regions.size()) {
return regions[index].probed_size;