Reserve SSH space for bindless mode

Related-To: NEO-4767

Change-Id: Id7876ea5a5a4fc12ab0b3192548b006fc1eea75c
Signed-off-by: Mateusz Hoppe <mateusz.hoppe@intel.com>
This commit is contained in:
Mateusz Hoppe
2020-07-15 09:10:22 +02:00
committed by sys_ocldev
parent b3813d9a63
commit ca39301ed8
12 changed files with 148 additions and 42 deletions

View File

@@ -13,6 +13,7 @@
#include "shared/source/device/device.h"
#include "shared/source/helpers/debug_helpers.h"
#include "shared/source/helpers/heap_helper.h"
#include "shared/source/helpers/hw_helper.h"
#include "shared/source/indirect_heap/indirect_heap.h"
#include "shared/source/memory_manager/memory_manager.h"
@@ -84,6 +85,8 @@ bool CommandContainer::initialize(Device *device) {
instructionHeapBaseAddress = device->getMemoryManager()->getInternalHeapBaseAddress(device->getRootDeviceIndex(), allocationIndirectHeaps[IndirectHeap::Type::INDIRECT_OBJECT]->isAllocatedInLocalMemoryPool());
reserveBindlessOffsets(*indirectHeaps[IndirectHeap::Type::SURFACE_STATE]);
iddBlock = nullptr;
nextIddInBlock = this->getNumIddPerBlock();
@@ -123,6 +126,8 @@ void CommandContainer::reset() {
indirectHeap->getMaxAvailableSpace());
addToResidencyContainer(indirectHeap->getGraphicsAllocation());
}
reserveBindlessOffsets(*indirectHeaps[HeapType::SURFACE_STATE]);
}
void *CommandContainer::getHeapSpaceAllowGrow(HeapType heapType,
@@ -172,11 +177,15 @@ IndirectHeap *CommandContainer::getHeapWithRequiredSizeAndAlignment(HeapType hea
getDeallocationContainer().push_back(oldAlloc);
setIndirectHeapAllocation(heapType, newAlloc);
setHeapDirty(heapType);
if (heapType == HeapType::SURFACE_STATE) {
reserveBindlessOffsets(*indirectHeap);
}
}
if (alignment) {
indirectHeap->align(alignment);
}
return indirectHeap;
}
@@ -201,4 +210,11 @@ void CommandContainer::allocateNextCommandBuffer() {
addToResidencyContainer(cmdBufferAllocation);
}
void CommandContainer::reserveBindlessOffsets(IndirectHeap &sshHeap) {
UNRECOVERABLE_IF(sshHeap.getUsed() > 0);
auto &helper = HwHelper::get(getDevice()->getHardwareInfo().platform.eRenderCoreFamily);
auto surfaceStateSize = helper.getRenderSurfaceStateSize();
sshHeap.getSpace(surfaceStateSize);
}
} // namespace NEO

View File

@@ -94,6 +94,7 @@ class CommandContainer : public NonCopyableOrMovableClass {
uint32_t getNumIddPerBlock() const { return numIddsPerBlock; }
protected:
void reserveBindlessOffsets(IndirectHeap &sshHeap);
void *iddBlock = nullptr;
Device *device = nullptr;
std::unique_ptr<HeapHelper> heapHelper;