diff --git a/level_zero/core/source/cmdlist/cmdlist_hw_xehp_and_later.inl b/level_zero/core/source/cmdlist/cmdlist_hw_xehp_and_later.inl index a76ee68fce..960c4155a6 100644 --- a/level_zero/core/source/cmdlist/cmdlist_hw_xehp_and_later.inl +++ b/level_zero/core/source/cmdlist/cmdlist_hw_xehp_and_later.inl @@ -36,10 +36,7 @@ namespace L0 { template size_t CommandListCoreFamily::getReserveSshSize() { - using RENDER_SURFACE_STATE = typename GfxFamily::RENDER_SURFACE_STATE; - return 16 /* max ptss steps */ - * 2 * 2 /* two slots and two steps */ - * sizeof(RENDER_SURFACE_STATE); + return 4 * MemoryConstants::pageSize; } template diff --git a/level_zero/core/source/cmdqueue/cmdqueue_xe_hp_core_and_later.inl b/level_zero/core/source/cmdqueue/cmdqueue_xe_hp_core_and_later.inl index 2e143eee11..4d8bc66107 100644 --- a/level_zero/core/source/cmdqueue/cmdqueue_xe_hp_core_and_later.inl +++ b/level_zero/core/source/cmdqueue/cmdqueue_xe_hp_core_and_later.inl @@ -142,8 +142,13 @@ void CommandQueueHw::handleScratchSpace(NEO::HeapContainer &sshHe csr->getOsContext(), gsbaState, frontEndState); } + NEO::Device *neoDevice = device->getNEODevice(); + auto &gfxCoreHelper = neoDevice->getGfxCoreHelper(); + auto &productHelper = neoDevice->getProductHelper(); + if (sshHeaps.size() > 0) { - scratchController->programHeaps(sshHeaps, 0u, perThreadScratchSpaceSlot0Size, perThreadScratchSpaceSlot1Size, + uint32_t offsetIndex = gfxCoreHelper.getMaxPtssIndex(productHelper) * csr->getOsContext().getEngineType() + 1u; + scratchController->programHeaps(sshHeaps, offsetIndex, perThreadScratchSpaceSlot0Size, perThreadScratchSpaceSlot1Size, csr->getOsContext(), gsbaState, frontEndState); } diff --git a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_xehp_and_later.cpp b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_xehp_and_later.cpp index 5d5a10ce5e..4a77d0a6b2 100644 --- a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_xehp_and_later.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_xehp_and_later.cpp @@ -210,11 +210,11 @@ HWTEST2_F(CommandListTests, whenCommandListIsCreatedAndProgramExtendedPipeContro } using CommandListTestsReserveSize = Test; -HWTEST2_F(CommandListTestsReserveSize, givenCommandListWhenGetReserveSshSizeThen16slotSpaceReturned, IsAtLeastXeHpCore) { +HWTEST2_F(CommandListTestsReserveSize, givenCommandListWhenGetReserveSshSizeThen4PagesReturned, IsAtLeastXeHpCore) { L0::CommandListCoreFamily commandList(1u); commandList.initialize(device, NEO::EngineGroupType::compute, 0u); - EXPECT_EQ(commandList.getReserveSshSize(), 16 * 2 * 2 * sizeof(typename FamilyType::RENDER_SURFACE_STATE)); + EXPECT_EQ(commandList.getReserveSshSize(), 4 * MemoryConstants::pageSize); } using CommandListAppendLaunchKernel = Test;