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>
This commit is contained in:
Mateusz Hoppe
2023-08-25 14:28:27 +00:00
committed by Compute-Runtime-Automation
parent edd5523f82
commit 00de13939d
5 changed files with 310 additions and 25 deletions

View File

@@ -10,6 +10,7 @@
#include "shared/source/helpers/heap_helper.h"
#include "shared/source/memory_manager/graphics_allocation.h"
#include <array>
#include <memory>
#include <mutex>
#include <unordered_map>
@@ -18,7 +19,6 @@
namespace NEO {
class IndirectHeap;
class BindlessHeapsHelper {
public:
enum BindlesHeapType {
@@ -41,7 +41,7 @@ class BindlessHeapsHelper {
uint32_t getDefaultBorderColorOffset();
uint32_t getAlphaBorderColorOffset();
IndirectHeap *getHeap(BindlesHeapType heapType);
void placeSSAllocationInReuseVectorOnFreeMemory(GraphicsAllocation *gfxAllocation);
void releaseSSToReusePool(const SurfaceStateInHeapInfo &surfStateInfo);
bool isGlobalDshSupported() {
return globalBindlessDsh;
}
@@ -55,6 +55,8 @@ class BindlessHeapsHelper {
}
return index;
}
bool getStateDirtyForContext(uint32_t osContextId);
void clearStateDirtyForContext(uint32_t osContextId);
protected:
const size_t surfaceStateSize;
@@ -65,7 +67,14 @@ class BindlessHeapsHelper {
std::unique_ptr<IndirectHeap> surfaceStateHeaps[BindlesHeapType::NUM_HEAP_TYPES];
GraphicsAllocation *borderColorStates;
std::vector<GraphicsAllocation *> ssHeapsAllocations;
std::vector<SurfaceStateInHeapInfo> surfaceStateInHeapVectorReuse[2];
size_t reuseSlotCountThreshold = 512;
uint32_t allocatePoolIndex = 0;
uint32_t releasePoolIndex = 0;
bool allocateFromReusePool = false;
std::array<std::vector<SurfaceStateInHeapInfo>, 2> surfaceStateInHeapVectorReuse[2];
std::bitset<64> stateCacheDirtyForContext;
std::mutex mtx;
DeviceBitfield deviceBitfield;
bool globalBindlessDsh = false;