Fix reservation size

Change-Id: I1cc3d4405b00365908c5915c9d2a1c512d572530
This commit is contained in:
Kamil Diedrich
2020-10-07 14:32:23 +02:00
committed by sys_ocldev
parent a9d0ead3c5
commit 960860e4cb
7 changed files with 25 additions and 3 deletions

View File

@@ -133,6 +133,7 @@ struct CommandListCoreFamily : CommandListImp {
ze_result_t reserveSpace(size_t size, void **ptr) override;
ze_result_t reset() override;
ze_result_t executeCommandListImmediate(bool performMigration) override;
size_t getReserveSshSize();
protected:
MOCKABLE_VIRTUAL ze_result_t appendMemoryCopyKernelWithGA(void *dstPtr, NEO::GraphicsAllocation *dstPtrAlloc,

View File

@@ -57,6 +57,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::initialize(Device *device, NEO
this->commandListPreemptionMode = device->getDevicePreemptionMode();
this->engineGroupType = engineGroupType;
commandContainer.setReservedSshSize(getReserveSshSize());
auto returnValue = commandContainer.initialize(static_cast<DeviceImp *>(device)->neoDevice);
ze_result_t returnType = parseErrorCode(returnValue);
if (returnType == ZE_RESULT_SUCCESS) {

View File

@@ -23,6 +23,12 @@
namespace L0 {
struct DeviceImp;
template <GFXCORE_FAMILY gfxCoreFamily>
size_t CommandListCoreFamily<gfxCoreFamily>::getReserveSshSize() {
auto &helper = NEO::HwHelper::get(device->getHwInfo().platform.eRenderCoreFamily);
return helper.getRenderSurfaceStateSize();
}
template <GFXCORE_FAMILY gfxCoreFamily>
ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendLaunchKernelWithParams(ze_kernel_handle_t hKernel,
const ze_group_count_t *pThreadGroupDimensions,

View File

@@ -929,5 +929,13 @@ HWTEST2_F(CommandListCreate, givenCopyCommandListWhenTimestampPassedToMemoryCopy
EXPECT_EQ(cmdList.end(), itor);
}
using SupportedPlatforms = IsWithinProducts<IGFX_SKYLAKE, IGFX_DG1>;
HWTEST2_F(CommandListCreate, givenCommandList, SupportedPlatforms) {
MockCommandListHw<gfxCoreFamily> commandList;
commandList.initialize(device, NEO::EngineGroupType::Compute);
auto &helper = NEO::HwHelper::get(commandList.device->getHwInfo().platform.eRenderCoreFamily);
auto size = helper.getRenderSurfaceStateSize();
EXPECT_EQ(commandList.getReserveSshSize(), size);
}
} // namespace ult
} // namespace L0

View File

@@ -93,7 +93,7 @@ ErrorCode CommandContainer::initialize(Device *device) {
instructionHeapBaseAddress = device->getMemoryManager()->getInternalHeapBaseAddress(device->getRootDeviceIndex(), !hwHelper.useSystemMemoryPlacementForISA(getDevice()->getHardwareInfo()));
indirectHeaps[IndirectHeap::Type::SURFACE_STATE]->getSpace(4 * MemoryConstants::pageSize);
indirectHeaps[IndirectHeap::Type::SURFACE_STATE]->getSpace(reservedSshSize);
iddBlock = nullptr;
nextIddInBlock = this->getNumIddPerBlock();
@@ -135,7 +135,7 @@ void CommandContainer::reset() {
addToResidencyContainer(indirectHeap->getGraphicsAllocation());
}
indirectHeaps[IndirectHeap::Type::SURFACE_STATE]->getSpace(4 * MemoryConstants::pageSize);
indirectHeaps[IndirectHeap::Type::SURFACE_STATE]->getSpace(reservedSshSize);
iddBlock = nullptr;
nextIddInBlock = this->getNumIddPerBlock();
@@ -190,7 +190,7 @@ IndirectHeap *CommandContainer::getHeapWithRequiredSizeAndAlignment(HeapType hea
setIndirectHeapAllocation(heapType, newAlloc);
setHeapDirty(heapType);
if (heapType == HeapType::SURFACE_STATE) {
indirectHeap->getSpace(4 * MemoryConstants::pageSize);
indirectHeap->getSpace(reservedSshSize);
}
}

View File

@@ -100,6 +100,9 @@ class CommandContainer : public NonCopyableOrMovableClass {
void setIddBlock(void *iddBlock) { this->iddBlock = iddBlock; }
void *getIddBlock() { return iddBlock; }
uint32_t getNumIddPerBlock() const { return numIddsPerBlock; }
void setReservedSshSize(size_t reserveSize) {
reservedSshSize = reserveSize;
}
protected:
void *iddBlock = nullptr;
@@ -112,6 +115,7 @@ class CommandContainer : public NonCopyableOrMovableClass {
uint64_t indirectObjectHeapBaseAddress = 0u;
uint32_t dirtyHeaps = std::numeric_limits<uint32_t>::max();
uint32_t numIddsPerBlock = 64;
size_t reservedSshSize = 0;
std::unique_ptr<LinearStream> commandStream;
std::unique_ptr<IndirectHeap> indirectHeaps[HeapType::NUM_TYPES];

View File

@@ -209,6 +209,7 @@ TEST_F(CommandContainerTest, givenCommandContainerWhenWantToAddAlreadyAddedAlloc
HWTEST_F(CommandContainerTest, givenCmdContainerWhenInitializeCalledThenSSHHeapHasBindlessOffsetReserved) {
using RENDER_SURFACE_STATE = typename FamilyType::RENDER_SURFACE_STATE;
std::unique_ptr<CommandContainer> cmdContainer(new CommandContainer);
cmdContainer->setReservedSshSize(4 * MemoryConstants::pageSize);
cmdContainer->initialize(pDevice);
cmdContainer->setDirtyStateForAllHeaps(false);
@@ -221,6 +222,7 @@ HWTEST_F(CommandContainerTest, givenCmdContainerWhenInitializeCalledThenSSHHeapH
HWTEST_F(CommandContainerTest, givenNotEnoughSpaceInSSHWhenGettingHeapWithRequiredSizeAndAlignmentThenSSHHeapHasBindlessOffsetReserved) {
using RENDER_SURFACE_STATE = typename FamilyType::RENDER_SURFACE_STATE;
std::unique_ptr<CommandContainer> cmdContainer(new CommandContainer);
cmdContainer->setReservedSshSize(4 * MemoryConstants::pageSize);
cmdContainer->initialize(pDevice);
cmdContainer->setDirtyStateForAllHeaps(false);