Files
compute-runtime/shared/test/common/mocks/mock_usm_memory_pool.h
Compute-Runtime-Validation e2d12e1742 Revert "feature: add pooling of USM global/constant surface"
This reverts commit 68698c9a74.

Signed-off-by: Compute-Runtime-Validation <compute-runtime-validation@intel.com>
2025-09-14 16:26:29 +02:00

50 lines
1.4 KiB
C++

/*
* Copyright (C) 2023-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include "shared/source/memory_manager/unified_memory_pooling.h"
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;
void cleanup() override {
++cleanupCalled;
if (callBaseCleanup) {
UsmMemAllocPool::cleanup();
}
}
uint32_t cleanupCalled = 0u;
bool callBaseCleanup = true;
};
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