fix: correct alignment of per thread scratch size

Related-To: NEO-5288

Signed-off-by: Zbigniew Zdanowicz <zbigniew.zdanowicz@intel.com>
This commit is contained in:
Zbigniew Zdanowicz
2023-07-11 15:55:01 +00:00
committed by Compute-Runtime-Automation
parent 40af0dddeb
commit 1c0285a156
5 changed files with 47 additions and 37 deletions

View File

@@ -950,7 +950,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, GivenForced32BitAllocationsModeSto
auto scratchAllocation = commandStreamReceiver->getScratchAllocation();
ASSERT_NE(scratchAllocation, nullptr);
commandStreamReceiver->setRequiredScratchSizes(8196, 0); // whatever > first size
commandStreamReceiver->setRequiredScratchSizes(8192, 0); // whatever > first size
flushTask(*commandStreamReceiver); // 2nd flush
@@ -984,7 +984,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, GivenForced32BitAllocationsModeSto
auto scratchAllocation = commandStreamReceiver->getScratchAllocation();
ASSERT_NE(scratchAllocation, nullptr);
commandStreamReceiver->setRequiredScratchSizes(8196, 0); // whatever > first size
commandStreamReceiver->setRequiredScratchSizes(8192, 0); // whatever > first size
flushTask(*commandStreamReceiver); // 2nd flush

View File

@@ -215,19 +215,6 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, CommandStreamReceiverHwTestXeHPAndLater, givenScrat
EXPECT_FALSE(cfeStateDirty);
}
HWCMDTEST_F(IGFX_XE_HP_CORE, CommandStreamReceiverHwTestXeHPAndLater, givenScratchSpaceSurfaceStateEnabledWhenRequiredScratchSpaceIsSetThenPerThreadScratchSizeIsAlignedTo64) {
auto commandStreamReceiver = std::make_unique<MockCsrHw<FamilyType>>(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
auto scratchController = static_cast<MockScratchSpaceControllerXeHPAndLater *>(commandStreamReceiver->getScratchSpaceController());
uint32_t perThreadScratchSize = 1;
uint32_t expectedValue = 1 << 6;
bool stateBaseAddressDirty = false;
bool cfeStateDirty = false;
uint8_t surfaceHeap[1000];
scratchController->setRequiredScratchSpace(surfaceHeap, 0u, perThreadScratchSize, 0u, commandStreamReceiver->taskCount, *pDevice->getDefaultEngine().osContext, stateBaseAddressDirty, cfeStateDirty);
EXPECT_EQ(expectedValue, scratchController->perThreadScratchSize);
}
HWCMDTEST_F(IGFX_XE_HP_CORE, CommandStreamReceiverHwTestXeHPAndLater, givenScratchSpaceSurfaceStateEnabledWhenNewSshProvidedAndScratchAllocationExistsThenSetDirtyBitCopyCurrentState) {
using RENDER_SURFACE_STATE = typename FamilyType::RENDER_SURFACE_STATE;
auto commandStreamReceiver = std::make_unique<MockCsrHw<FamilyType>>(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
@@ -584,25 +571,6 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, CommandStreamReceiverHwTestXeHPAndLater, givenScrat
EXPECT_EQ(32u, scratchController->stateSlotsCount);
}
HWCMDTEST_F(IGFX_XE_HP_CORE, CommandStreamReceiverHwTestXeHPAndLater, givenScratchSpaceSurfaceStateEnabledWhenSizeForPrivateScratchSpaceIsMisalignedThenAlignItTo64) {
using RENDER_SURFACE_STATE = typename FamilyType::RENDER_SURFACE_STATE;
DebugManagerStateRestore restorer;
DebugManager.flags.EnablePrivateScratchSlot1.set(1);
RENDER_SURFACE_STATE surfaceState[4];
MockCsrHw<FamilyType> commandStreamReceiver(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
auto scratchController = static_cast<MockScratchSpaceControllerXeHPAndLater *>(commandStreamReceiver.getScratchSpaceController());
uint32_t misalignedSizeForPrivateScratch = MemoryConstants::pageSize + 1;
bool cfeStateDirty = false;
bool stateBaseAddressDirty = false;
scratchController->setRequiredScratchSpace(surfaceState, 0u, 0u, misalignedSizeForPrivateScratch, 0u,
*pDevice->getDefaultEngine().osContext, stateBaseAddressDirty, cfeStateDirty);
EXPECT_NE(scratchController->privateScratchSizeBytes, misalignedSizeForPrivateScratch * scratchController->computeUnitsUsedForScratch);
EXPECT_EQ(scratchController->privateScratchSizeBytes, alignUp(misalignedSizeForPrivateScratch, 64) * scratchController->computeUnitsUsedForScratch);
EXPECT_EQ(scratchController->privateScratchSizeBytes, scratchController->getPrivateScratchSpaceAllocation()->getUnderlyingBufferSize());
}
HWCMDTEST_F(IGFX_XE_HP_CORE, CommandStreamReceiverHwTestXeHPAndLater, givenDisabledPrivateScratchSpaceWhenSizeForPrivateScratchSpaceIsProvidedThenItIsNotCreated) {
using RENDER_SURFACE_STATE = typename FamilyType::RENDER_SURFACE_STATE;
DebugManagerStateRestore restorer;