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 reserveSpace(size_t size, void **ptr) override;
ze_result_t reset() override; ze_result_t reset() override;
ze_result_t executeCommandListImmediate(bool performMigration) override; ze_result_t executeCommandListImmediate(bool performMigration) override;
size_t getReserveSshSize();
protected: protected:
MOCKABLE_VIRTUAL ze_result_t appendMemoryCopyKernelWithGA(void *dstPtr, NEO::GraphicsAllocation *dstPtrAlloc, 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->commandListPreemptionMode = device->getDevicePreemptionMode();
this->engineGroupType = engineGroupType; this->engineGroupType = engineGroupType;
commandContainer.setReservedSshSize(getReserveSshSize());
auto returnValue = commandContainer.initialize(static_cast<DeviceImp *>(device)->neoDevice); auto returnValue = commandContainer.initialize(static_cast<DeviceImp *>(device)->neoDevice);
ze_result_t returnType = parseErrorCode(returnValue); ze_result_t returnType = parseErrorCode(returnValue);
if (returnType == ZE_RESULT_SUCCESS) { if (returnType == ZE_RESULT_SUCCESS) {

View File

@ -23,6 +23,12 @@
namespace L0 { namespace L0 {
struct DeviceImp; 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> template <GFXCORE_FAMILY gfxCoreFamily>
ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendLaunchKernelWithParams(ze_kernel_handle_t hKernel, ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendLaunchKernelWithParams(ze_kernel_handle_t hKernel,
const ze_group_count_t *pThreadGroupDimensions, const ze_group_count_t *pThreadGroupDimensions,

View File

@ -929,5 +929,13 @@ HWTEST2_F(CommandListCreate, givenCopyCommandListWhenTimestampPassedToMemoryCopy
EXPECT_EQ(cmdList.end(), itor); 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 ult
} // namespace L0 } // namespace L0

View File

@ -93,7 +93,7 @@ ErrorCode CommandContainer::initialize(Device *device) {
instructionHeapBaseAddress = device->getMemoryManager()->getInternalHeapBaseAddress(device->getRootDeviceIndex(), !hwHelper.useSystemMemoryPlacementForISA(getDevice()->getHardwareInfo())); 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; iddBlock = nullptr;
nextIddInBlock = this->getNumIddPerBlock(); nextIddInBlock = this->getNumIddPerBlock();
@ -135,7 +135,7 @@ void CommandContainer::reset() {
addToResidencyContainer(indirectHeap->getGraphicsAllocation()); addToResidencyContainer(indirectHeap->getGraphicsAllocation());
} }
indirectHeaps[IndirectHeap::Type::SURFACE_STATE]->getSpace(4 * MemoryConstants::pageSize); indirectHeaps[IndirectHeap::Type::SURFACE_STATE]->getSpace(reservedSshSize);
iddBlock = nullptr; iddBlock = nullptr;
nextIddInBlock = this->getNumIddPerBlock(); nextIddInBlock = this->getNumIddPerBlock();
@ -190,7 +190,7 @@ IndirectHeap *CommandContainer::getHeapWithRequiredSizeAndAlignment(HeapType hea
setIndirectHeapAllocation(heapType, newAlloc); setIndirectHeapAllocation(heapType, newAlloc);
setHeapDirty(heapType); setHeapDirty(heapType);
if (heapType == HeapType::SURFACE_STATE) { 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 setIddBlock(void *iddBlock) { this->iddBlock = iddBlock; }
void *getIddBlock() { return iddBlock; } void *getIddBlock() { return iddBlock; }
uint32_t getNumIddPerBlock() const { return numIddsPerBlock; } uint32_t getNumIddPerBlock() const { return numIddsPerBlock; }
void setReservedSshSize(size_t reserveSize) {
reservedSshSize = reserveSize;
}
protected: protected:
void *iddBlock = nullptr; void *iddBlock = nullptr;
@ -112,6 +115,7 @@ class CommandContainer : public NonCopyableOrMovableClass {
uint64_t indirectObjectHeapBaseAddress = 0u; uint64_t indirectObjectHeapBaseAddress = 0u;
uint32_t dirtyHeaps = std::numeric_limits<uint32_t>::max(); uint32_t dirtyHeaps = std::numeric_limits<uint32_t>::max();
uint32_t numIddsPerBlock = 64; uint32_t numIddsPerBlock = 64;
size_t reservedSshSize = 0;
std::unique_ptr<LinearStream> commandStream; std::unique_ptr<LinearStream> commandStream;
std::unique_ptr<IndirectHeap> indirectHeaps[HeapType::NUM_TYPES]; std::unique_ptr<IndirectHeap> indirectHeaps[HeapType::NUM_TYPES];

View File

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