Files
compute-runtime/shared/test/common/mocks/mock_bindless_heaps_helper.h
Mateusz Hoppe 00de13939d feature: bindless addressing allocator - reuse of bindless slots
- introduce 2 reuse pools to bindlessHeapHelper
- one pool stores slots for reuse, second pool stores released slots
- stateCacheDirty flags keep track of state cache - when pools are
switched - flags are set indicating flushing caches is needed after
old slots have been reused for new allocations

Related-To: NEO-7063

Signed-off-by: Mateusz Hoppe <mateusz.hoppe@intel.com>
2023-08-29 09:51:36 +02:00

54 lines
1.9 KiB
C++

/*
* Copyright (C) 2021-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include "shared/source/helpers/bindless_heaps_helper.h"
using namespace NEO;
class MockBindlesHeapsHelper : public BindlessHeapsHelper {
public:
using BaseClass = BindlessHeapsHelper;
MockBindlesHeapsHelper(MemoryManager *memManager, bool isMultiOsContextCapable, const uint32_t rootDeviceIndex, DeviceBitfield deviceBitfield) : BaseClass(memManager, isMultiOsContextCapable, rootDeviceIndex, deviceBitfield) {
globalSsh = surfaceStateHeaps[BindlesHeapType::GLOBAL_SSH].get();
specialSsh = surfaceStateHeaps[BindlesHeapType::SPECIAL_SSH].get();
scratchSsh = surfaceStateHeaps[BindlesHeapType::SPECIAL_SSH].get();
globalDsh = surfaceStateHeaps[BindlesHeapType::SPECIAL_SSH].get();
}
SurfaceStateInHeapInfo allocateSSInHeap(size_t ssSize, GraphicsAllocation *surfaceAllocation, BindlesHeapType heapType) override {
if (failAllocateSS) {
return SurfaceStateInHeapInfo{};
}
return BaseClass::allocateSSInHeap(ssSize, surfaceAllocation, heapType);
}
using BindlesHeapType = BindlessHeapsHelper::BindlesHeapType;
using BaseClass::allocateFromReusePool;
using BaseClass::allocatePoolIndex;
using BaseClass::borderColorStates;
using BaseClass::globalBindlessDsh;
using BaseClass::growHeap;
using BaseClass::isMultiOsContextCapable;
using BaseClass::memManager;
using BaseClass::releasePoolIndex;
using BaseClass::reuseSlotCountThreshold;
using BaseClass::rootDeviceIndex;
using BaseClass::ssHeapsAllocations;
using BaseClass::stateCacheDirtyForContext;
using BaseClass::surfaceStateHeaps;
using BaseClass::surfaceStateInHeapVectorReuse;
using BaseClass::surfaceStateSize;
IndirectHeap *specialSsh;
IndirectHeap *globalSsh;
IndirectHeap *scratchSsh;
IndirectHeap *globalDsh;
bool failAllocateSS = false;
};