mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-24 20:39:56 +08:00
Add multitile arch. code in drm getLocalMemorySize
Signed-off-by: Szymon Morek <szymon.morek@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
ebcbf29a85
commit
efd66a32c2
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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(){};
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user