mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-24 12:23:05 +08:00
refactor: move memory tracking to memory manager
- remove wddm specific code - improve total size reported to be in decimal Signed-off-by: Michal Mrozek <michal.mrozek@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
c0d9cb4d84
commit
dd631610b3
@@ -150,6 +150,16 @@ HeapIndex MemoryManager::selectExternalHeap(bool useLocalMemory) {
|
||||
return useLocalMemory ? HeapIndex::heapExternalDeviceMemory : HeapIndex::heapExternal;
|
||||
}
|
||||
|
||||
inline MemoryManager::AllocationStatus MemoryManager::registerSysMemAlloc(GraphicsAllocation *allocation) {
|
||||
this->sysMemAllocsSize += allocation->getUnderlyingBufferSize();
|
||||
return AllocationStatus::Success;
|
||||
}
|
||||
|
||||
inline MemoryManager::AllocationStatus MemoryManager::registerLocalMemAlloc(GraphicsAllocation *allocation, uint32_t rootDeviceIndex) {
|
||||
this->localMemAllocsSize[rootDeviceIndex] += allocation->getUnderlyingBufferSize();
|
||||
return AllocationStatus::Success;
|
||||
}
|
||||
|
||||
void MemoryManager::zeroCpuMemoryIfRequested(const AllocationData &allocationData, void *cpuPtr, size_t size) {
|
||||
if (allocationData.flags.zeroMemory) {
|
||||
memset(cpuPtr, 0, size);
|
||||
|
||||
@@ -262,8 +262,8 @@ class MemoryManager {
|
||||
virtual bool isCpuCopyRequired(const void *ptr) { return false; }
|
||||
virtual bool isWCMemory(const void *ptr) { return false; }
|
||||
|
||||
virtual AllocationStatus registerSysMemAlloc(GraphicsAllocation *allocation) { return AllocationStatus::Success; };
|
||||
virtual AllocationStatus registerLocalMemAlloc(GraphicsAllocation *allocation, uint32_t rootDeviceIndex) { return AllocationStatus::Success; };
|
||||
virtual AllocationStatus registerSysMemAlloc(GraphicsAllocation *allocation);
|
||||
virtual AllocationStatus registerLocalMemAlloc(GraphicsAllocation *allocation, uint32_t rootDeviceIndex);
|
||||
|
||||
virtual bool setMemAdvise(GraphicsAllocation *gfxAllocation, MemAdviseFlags flags, uint32_t rootDeviceIndex) { return true; }
|
||||
virtual bool setMemPrefetch(GraphicsAllocation *gfxAllocation, SubDeviceIdsVec &subDeviceIds, uint32_t rootDeviceIndex) { return true; }
|
||||
|
||||
@@ -955,16 +955,6 @@ double WddmMemoryManager::getPercentOfGlobalMemoryAvailable(uint32_t rootDeviceI
|
||||
return 0.94;
|
||||
}
|
||||
|
||||
AllocationStatus WddmMemoryManager::registerSysMemAlloc(GraphicsAllocation *allocation) {
|
||||
this->sysMemAllocsSize += allocation->getUnderlyingBufferSize();
|
||||
return AllocationStatus::Success;
|
||||
}
|
||||
|
||||
AllocationStatus WddmMemoryManager::registerLocalMemAlloc(GraphicsAllocation *allocation, uint32_t rootDeviceIndex) {
|
||||
this->localMemAllocsSize[rootDeviceIndex] += allocation->getUnderlyingBufferSize();
|
||||
return AllocationStatus::Success;
|
||||
}
|
||||
|
||||
AlignedMallocRestrictions *WddmMemoryManager::getAlignedMallocRestrictions() {
|
||||
return &mallocRestrictions;
|
||||
}
|
||||
|
||||
@@ -50,8 +50,6 @@ class WddmMemoryManager : public MemoryManager {
|
||||
uint64_t getSystemSharedMemory(uint32_t rootDeviceIndex) override;
|
||||
uint64_t getLocalMemorySize(uint32_t rootDeviceIndex, uint32_t deviceBitfield) override;
|
||||
double getPercentOfGlobalMemoryAvailable(uint32_t rootDeviceIndex) override;
|
||||
AllocationStatus registerSysMemAlloc(GraphicsAllocation *allocation) override;
|
||||
AllocationStatus registerLocalMemAlloc(GraphicsAllocation *allocation, uint32_t rootDeviceIndex) override;
|
||||
|
||||
bool tryDeferDeletions(const D3DKMT_HANDLE *handles, uint32_t allocationCount, D3DKMT_HANDLE resourceHandle, uint32_t rootDeviceIndex);
|
||||
|
||||
|
||||
@@ -118,8 +118,8 @@ void FileLogger<debugLevel>::logAllocation(GraphicsAllocation const *graphicsAll
|
||||
ss << graphicsAllocation->getPatIndexInfoString();
|
||||
|
||||
if (memoryManager) {
|
||||
ss << " Total sys mem allocated: " << memoryManager->getUsedSystemMemorySize();
|
||||
ss << " Total lmem allocated: " << memoryManager->getUsedLocalMemorySize(graphicsAllocation->getRootDeviceIndex());
|
||||
ss << " Total sys mem allocated: " << std::dec << memoryManager->getUsedSystemMemorySize();
|
||||
ss << " Total lmem allocated: " << std::dec << memoryManager->getUsedLocalMemorySize(graphicsAllocation->getRootDeviceIndex());
|
||||
}
|
||||
|
||||
ss << std::endl;
|
||||
|
||||
Reference in New Issue
Block a user