mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-24 21:18:24 +08:00
Move residency data from WddmAllocation to GraphicsAllocation
Related-To: NEO-6848 Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
f89c731a11
commit
d935815d74
@@ -29,7 +29,8 @@ GraphicsAllocation::GraphicsAllocation(uint32_t rootDeviceIndex, size_t numGmms,
|
||||
cpuPtr(cpuPtrIn),
|
||||
memoryPool(pool),
|
||||
allocationType(allocationType),
|
||||
usageInfos(maxOsContextCount) {
|
||||
usageInfos(maxOsContextCount),
|
||||
residency(maxOsContextCount) {
|
||||
gmms.resize(numGmms);
|
||||
}
|
||||
|
||||
@@ -41,7 +42,8 @@ GraphicsAllocation::GraphicsAllocation(uint32_t rootDeviceIndex, size_t numGmms,
|
||||
cpuPtr(cpuPtrIn),
|
||||
memoryPool(pool),
|
||||
allocationType(allocationType),
|
||||
usageInfos(maxOsContextCount) {
|
||||
usageInfos(maxOsContextCount),
|
||||
residency(maxOsContextCount) {
|
||||
sharingInfo.sharedHandle = sharedHandleIn;
|
||||
gmms.resize(numGmms);
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include "shared/source/memory_manager/definitions/storage_info.h"
|
||||
#include "shared/source/memory_manager/host_ptr_defines.h"
|
||||
#include "shared/source/memory_manager/memory_pool.h"
|
||||
#include "shared/source/memory_manager/residency.h"
|
||||
#include "shared/source/utilities/idlist.h"
|
||||
#include "shared/source/utilities/stackvec.h"
|
||||
|
||||
@@ -258,6 +259,10 @@ class GraphicsAllocation : public IDNode<GraphicsAllocation> {
|
||||
|
||||
bool isCompressionEnabled() const;
|
||||
|
||||
ResidencyData &getResidencyData() {
|
||||
return residency;
|
||||
}
|
||||
|
||||
OsHandleStorage fragmentsStorage;
|
||||
StorageInfo storageInfo = {};
|
||||
|
||||
@@ -327,5 +332,6 @@ class GraphicsAllocation : public IDNode<GraphicsAllocation> {
|
||||
StackVec<UsageInfo, 32> usageInfos;
|
||||
std::atomic<uint32_t> registeredContextsNum{0};
|
||||
StackVec<Gmm *, EngineLimits::maxHandleCount> gmms;
|
||||
ResidencyData residency;
|
||||
};
|
||||
} // namespace NEO
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
* Copyright (C) 2021-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -64,12 +64,12 @@ void WddmResidencyController::trimResidency(const D3DDDI_TRIMRESIDENCYSET_FLAGS
|
||||
if (wasAllocationUsedSinceLastTrim(wddmAllocation->getResidencyData().getFenceValueForContextId(osContextId))) {
|
||||
break;
|
||||
}
|
||||
DBG_LOG(ResidencyDebugEnable, "Residency:", __FUNCTION__, "allocation: default handle =", wddmAllocation->getDefaultHandle(), "lastFence =", (wddmAllocation)->getResidencyData().getFenceValueForContextId(osContextId));
|
||||
DBG_LOG(ResidencyDebugEnable, "Residency:", __FUNCTION__, "allocation: default handle =", wddmAllocation->getDefaultHandle(), "lastFence =", wddmAllocation->getResidencyData().getFenceValueForContextId(osContextId));
|
||||
|
||||
uint32_t fragmentsToEvict = 0;
|
||||
|
||||
if (wddmAllocation->fragmentsStorage.fragmentCount == 0) {
|
||||
DBG_LOG(ResidencyDebugEnable, "Residency:", __FUNCTION__, "Evict allocation: default handle =", wddmAllocation->getDefaultHandle(), "lastFence =", (wddmAllocation)->getResidencyData().getFenceValueForContextId(osContextId));
|
||||
DBG_LOG(ResidencyDebugEnable, "Residency:", __FUNCTION__, "Evict allocation: default handle =", wddmAllocation->getDefaultHandle(), "lastFence =", wddmAllocation->getResidencyData().getFenceValueForContextId(osContextId));
|
||||
this->wddm.evict(&wddmAllocation->getHandles()[0], wddmAllocation->getNumGmms(), sizeToTrim);
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
#define UMDF_USING_NTSTATUS
|
||||
#include "shared/source/helpers/aligned_memory.h"
|
||||
#include "shared/source/memory_manager/graphics_allocation.h"
|
||||
#include "shared/source/memory_manager/residency.h"
|
||||
#include "shared/source/os_interface/windows/d3dkmthk_wrapper.h"
|
||||
#include "shared/source/os_interface/windows/windows_wrapper.h"
|
||||
|
||||
@@ -31,7 +30,7 @@ class WddmAllocation : public GraphicsAllocation {
|
||||
WddmAllocation(uint32_t rootDeviceIndex, size_t numGmms, AllocationType allocationType, void *cpuPtrIn, size_t sizeIn,
|
||||
void *reservedAddr, MemoryPool::Type pool, uint32_t shareable, size_t maxOsContextCount)
|
||||
: GraphicsAllocation(rootDeviceIndex, numGmms, allocationType, cpuPtrIn, castToUint64(cpuPtrIn), 0llu, sizeIn, pool, maxOsContextCount),
|
||||
shareable(shareable), residency(maxOsContextCount), trimCandidateListPositions(maxOsContextCount, trimListUnusedPosition) {
|
||||
shareable(shareable), trimCandidateListPositions(maxOsContextCount, trimListUnusedPosition) {
|
||||
reservedAddressRangeInfo.addressPtr = reservedAddr;
|
||||
reservedAddressRangeInfo.rangeSize = sizeIn;
|
||||
handles.resize(gmms.size());
|
||||
@@ -43,7 +42,7 @@ class WddmAllocation : public GraphicsAllocation {
|
||||
WddmAllocation(uint32_t rootDeviceIndex, size_t numGmms, AllocationType allocationType, void *cpuPtrIn, size_t sizeIn,
|
||||
osHandle sharedHandle, MemoryPool::Type pool, size_t maxOsContextCount)
|
||||
: GraphicsAllocation(rootDeviceIndex, numGmms, allocationType, cpuPtrIn, sizeIn, sharedHandle, pool, maxOsContextCount),
|
||||
residency(maxOsContextCount), trimCandidateListPositions(maxOsContextCount, trimListUnusedPosition) {
|
||||
trimCandidateListPositions(maxOsContextCount, trimListUnusedPosition) {
|
||||
handles.resize(gmms.size());
|
||||
}
|
||||
|
||||
@@ -55,9 +54,6 @@ class WddmAllocation : public GraphicsAllocation {
|
||||
return alignSizeWholePage(this->cpuPtr, this->size);
|
||||
}
|
||||
|
||||
ResidencyData &getResidencyData() {
|
||||
return residency;
|
||||
}
|
||||
const StackVec<D3DKMT_HANDLE, EngineLimits::maxHandleCount> &getHandles() const { return handles; }
|
||||
D3DKMT_HANDLE &getHandleToModify(uint32_t handleIndex) { return handles[handleIndex]; }
|
||||
D3DKMT_HANDLE getDefaultHandle() const { return handles[0]; }
|
||||
@@ -114,7 +110,6 @@ class WddmAllocation : public GraphicsAllocation {
|
||||
}
|
||||
return ss.str();
|
||||
}
|
||||
ResidencyData residency;
|
||||
std::vector<size_t> trimCandidateListPositions;
|
||||
StackVec<D3DKMT_HANDLE, EngineLimits::maxHandleCount> handles;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user