mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 14:55:24 +08:00
performance: redesign usm alloc reuse mechanism
Dedicated pools for different allocations size ranges. Additional reused allocations will create their own pools. Do not reuse allocations >256MB. Related-To: NEO-6893, NEO-12299, NEO-12349 Signed-off-by: Dominik Dabek <dominik.dabek@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
dfbad8029b
commit
b2fc7345cf
@@ -172,6 +172,9 @@ GraphicsAllocation *MockMemoryManager::allocateGraphicsMemoryInDevicePool(const
|
||||
}
|
||||
|
||||
GraphicsAllocation *MockMemoryManager::allocateGraphicsMemoryWithAlignment(const AllocationData &allocationData) {
|
||||
if (returnMockGAFromHostPool) {
|
||||
return mockGa;
|
||||
}
|
||||
if (failInAllocateWithSizeAndAlignment) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -58,6 +58,7 @@ class MockMemoryManager : public MemoryManagerCreate<OsAgnosticMemoryManager> {
|
||||
using MemoryManager::isAllocationTypeToCapture;
|
||||
using MemoryManager::isCopyRequired;
|
||||
using MemoryManager::latestContextId;
|
||||
using MemoryManager::localMemAllocsSize;
|
||||
using MemoryManager::localMemorySupported;
|
||||
using MemoryManager::reservedMemory;
|
||||
using MemoryManager::secondaryEngines;
|
||||
@@ -279,6 +280,7 @@ class MockMemoryManager : public MemoryManagerCreate<OsAgnosticMemoryManager> {
|
||||
bool callBaseAllocateGraphicsMemoryForNonSvmHostPtr = true;
|
||||
bool failMapPhysicalToVirtualMemory = false;
|
||||
bool returnMockGAFromDevicePool = false;
|
||||
bool returnMockGAFromHostPool = false;
|
||||
std::unique_ptr<MockExecutionEnvironment> mockExecutionEnvironment;
|
||||
DeviceBitfield recentlyPassedDeviceBitfield{};
|
||||
std::unique_ptr<MultiGraphicsAllocation> waitAllocations = nullptr;
|
||||
|
||||
@@ -23,5 +23,6 @@ struct MockProductHelper : ProductHelperHw<IGFX_UNKNOWN> {
|
||||
ADDMETHOD_CONST_NOBASE(isBlitCopyRequiredForLocalMemory, bool, true, (const RootDeviceEnvironment &rootDeviceEnvironment, const GraphicsAllocation &allocation));
|
||||
ADDMETHOD_CONST_NOBASE(isDeviceUsmAllocationReuseSupported, bool, false, ());
|
||||
ADDMETHOD_CONST_NOBASE(isHostUsmAllocationReuseSupported, bool, false, ());
|
||||
ADDMETHOD_CONST_NOBASE(isUsmPoolAllocatorSupported, bool, false, ());
|
||||
};
|
||||
} // namespace NEO
|
||||
|
||||
@@ -12,9 +12,30 @@ namespace NEO {
|
||||
class MockUsmMemAllocPool : public UsmMemAllocPool {
|
||||
public:
|
||||
using UsmMemAllocPool::allocations;
|
||||
using UsmMemAllocPool::maxServicedSize;
|
||||
using UsmMemAllocPool::minServicedSize;
|
||||
using UsmMemAllocPool::pool;
|
||||
using UsmMemAllocPool::poolEnd;
|
||||
using UsmMemAllocPool::poolMemoryType;
|
||||
using UsmMemAllocPool::poolSize;
|
||||
};
|
||||
|
||||
class MockUsmMemAllocPoolsManager : public UsmMemAllocPoolsManager {
|
||||
public:
|
||||
using UsmMemAllocPoolsManager::canBePooled;
|
||||
using UsmMemAllocPoolsManager::device;
|
||||
using UsmMemAllocPoolsManager::getPoolContainingAlloc;
|
||||
using UsmMemAllocPoolsManager::memoryManager;
|
||||
using UsmMemAllocPoolsManager::pools;
|
||||
using UsmMemAllocPoolsManager::totalSize;
|
||||
using UsmMemAllocPoolsManager::UsmMemAllocPoolsManager;
|
||||
uint64_t getFreeMemory() override {
|
||||
if (callBaseGetFreeMemory) {
|
||||
return UsmMemAllocPoolsManager::getFreeMemory();
|
||||
}
|
||||
return mockFreeMemory;
|
||||
}
|
||||
uint64_t mockFreeMemory = 0u;
|
||||
bool callBaseGetFreeMemory = false;
|
||||
};
|
||||
} // namespace NEO
|
||||
@@ -625,4 +625,5 @@ DeferStateInitSubmissionToFirstRegularUsage = -1
|
||||
WaitForPagingFenceInController = -1
|
||||
DirectSubmissionPrintSemaphoreUsage = -1
|
||||
ForceNonCoherentModeForTimestamps = 0
|
||||
ExperimentalUSMAllocationReuseVersion = -1
|
||||
# Please don't edit below this line
|
||||
|
||||
Reference in New Issue
Block a user