From 09044dfbaae72889b022158fb3f8a57067533d84 Mon Sep 17 00:00:00 2001 From: Mateusz Jablonski Date: Wed, 27 Sep 2023 12:04:09 +0000 Subject: [PATCH] refactor: remove not needed code Related-To: NEO-7527 Signed-off-by: Mateusz Jablonski --- level_zero/core/source/cmdqueue/cmdqueue_hw.h | 1 - .../core/source/cmdqueue/cmdqueue_hw.inl | 10 --- .../sources/debugger/test_l0_debugger_1.cpp | 15 ++--- .../sources/debugger/test_l0_debugger_2.cpp | 51 ++------------ .../gfx_core_helper_tests_xe_hpc_core.cpp | 5 -- .../command_stream_receiver_hw.h | 2 +- .../command_stream_receiver_hw_base.inl | 20 +++--- ...mand_stream_receiver_hw_xehp_and_later.inl | 3 +- shared/source/command_stream/preemption.h | 3 - shared/source/command_stream/preemption.inl | 3 - .../preemption_xehp_and_later.inl | 67 +++---------------- shared/source/gen11/preemption_gen11.cpp | 1 - shared/source/gen12lp/preemption_gen12lp.cpp | 1 - shared/source/gen8/preemption_gen8.cpp | 1 - shared/source/gen9/preemption_gen9.cpp | 1 - shared/source/helpers/gfx_core_helper.h | 3 - .../source/helpers/gfx_core_helper_base.inl | 5 -- .../direct_submission_tests_1.cpp | 4 +- .../direct_submission_tests_2.cpp | 10 +-- .../helpers/gfx_core_helper_tests.cpp | 7 +- .../gfx_core_helper_tests_xe_hpg_core.cpp | 8 +-- 21 files changed, 43 insertions(+), 178 deletions(-) diff --git a/level_zero/core/source/cmdqueue/cmdqueue_hw.h b/level_zero/core/source/cmdqueue/cmdqueue_hw.h index 885dcbd936..bd2f108012 100644 --- a/level_zero/core/source/cmdqueue/cmdqueue_hw.h +++ b/level_zero/core/source/cmdqueue/cmdqueue_hw.h @@ -172,7 +172,6 @@ struct CommandQueueHw : public CommandQueueImp { inline void collectPrintfContentsFromCommandsList(CommandList *commandList); inline void migrateSharedAllocationsIfRequested(bool isMigrationRequested, CommandList *commandList); inline void prefetchMemoryToDeviceAssociatedWithCmdList(CommandList *commandList); - inline void programStateSipEndWA(bool isStateSipRequired, NEO::LinearStream &commandStream); inline void assignCsrTaskCountToFenceIfAvailable(ze_fence_handle_t hFence); inline void dispatchTaskCountPostSyncRegular(bool isDispatchTaskCountPostSyncRequired, NEO::LinearStream &commandStream); inline void dispatchTaskCountPostSyncByMiFlushDw(bool isDispatchTaskCountPostSyncRequired, NEO::LinearStream &commandStream); diff --git a/level_zero/core/source/cmdqueue/cmdqueue_hw.inl b/level_zero/core/source/cmdqueue/cmdqueue_hw.inl index 974f5040e7..b99aa113b0 100644 --- a/level_zero/core/source/cmdqueue/cmdqueue_hw.inl +++ b/level_zero/core/source/cmdqueue/cmdqueue_hw.inl @@ -221,7 +221,6 @@ ze_result_t CommandQueueHw::executeCommandListsRegular( this->migrateSharedAllocationsIfRequested(ctx.isMigrationRequested, ctx.firstCommandList); this->programLastCommandListReturnBbStart(child, ctx); - this->programStateSipEndWA(ctx.stateSipRequired, child); this->assignCsrTaskCountToFenceIfAvailable(hFence); this->dispatchTaskCountPostSyncRegular(ctx.isDispatchTaskCountPostSyncRequired, child); @@ -866,15 +865,6 @@ void CommandQueueHw::programStateSip(bool isStateSipRequired, NEO this->csr->setSipSentFlag(true); } -template -void CommandQueueHw::programStateSipEndWA(bool isStateSipRequired, NEO::LinearStream &cmdStream) { - if (!isStateSipRequired) { - return; - } - NEO::Device *neoDevice = this->device->getNEODevice(); - NEO::PreemptionHelper::programStateSipEndWa(cmdStream, neoDevice->getRootDeviceEnvironment()); -} - template void CommandQueueHw::updateOneCmdListPreemptionModeAndCtxStatePreemption( NEO::LinearStream &cmdStream, diff --git a/level_zero/core/test/unit_tests/sources/debugger/test_l0_debugger_1.cpp b/level_zero/core/test/unit_tests/sources/debugger/test_l0_debugger_1.cpp index 2b8aadf989..378a931e86 100644 --- a/level_zero/core/test/unit_tests/sources/debugger/test_l0_debugger_1.cpp +++ b/level_zero/core/test/unit_tests/sources/debugger/test_l0_debugger_1.cpp @@ -128,17 +128,14 @@ HWTEST_F(L0DebuggerPerContextAddressSpaceTest, givenDebuggingEnabledWhenCommandL EXPECT_EQ(0u, debugModeRegisterCount); EXPECT_EQ(0u, tdDebugControlRegisterCount); - auto &gfxCoreHelper = device->getGfxCoreHelper(); - if (!gfxCoreHelper.isSipWANeeded(hwInfo)) { - auto stateSipCmds = findAll(cmdList.begin(), cmdList.end()); - ASSERT_EQ(1u, stateSipCmds.size()); + auto stateSipCmds = findAll(cmdList.begin(), cmdList.end()); + ASSERT_EQ(1u, stateSipCmds.size()); - STATE_SIP *stateSip = genCmdCast(*stateSipCmds[0]); + STATE_SIP *stateSip = genCmdCast(*stateSipCmds[0]); - auto systemRoutine = SipKernel::getSipKernel(*neoDevice, nullptr).getSipAllocation(); - ASSERT_NE(nullptr, systemRoutine); - EXPECT_EQ(systemRoutine->getGpuAddressToPatch(), stateSip->getSystemInstructionPointer()); - } + auto systemRoutine = SipKernel::getSipKernel(*neoDevice, nullptr).getSipAllocation(); + ASSERT_NE(nullptr, systemRoutine); + EXPECT_EQ(systemRoutine->getGpuAddressToPatch(), stateSip->getSystemInstructionPointer()); for (auto i = 0u; i < numCommandLists; i++) { auto commandList = CommandList::fromHandle(commandLists[i]); diff --git a/level_zero/core/test/unit_tests/sources/debugger/test_l0_debugger_2.cpp b/level_zero/core/test/unit_tests/sources/debugger/test_l0_debugger_2.cpp index 3c54c4bc9e..00f8090d09 100644 --- a/level_zero/core/test/unit_tests/sources/debugger/test_l0_debugger_2.cpp +++ b/level_zero/core/test/unit_tests/sources/debugger/test_l0_debugger_2.cpp @@ -196,25 +196,8 @@ HWTEST2_P(L0DebuggerWithBlitterTest, givenImmediateCommandListWhenExecutingWithF ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer( cmdList, commandList->csr->getCS().getCpuBase(), commandList->csr->getCS().getUsed())); - auto &gfxCoreHelper = device->getGfxCoreHelper(); - if (gfxCoreHelper.isSipWANeeded(hwInfo)) { - - auto miLoadImm = findAll(cmdList.begin(), cmdList.end()); - - auto globalSipFound = 0u; - for (size_t i = 0; i < miLoadImm.size(); i++) { - MI_LOAD_REGISTER_IMM *miLoad = genCmdCast(*miLoadImm[i]); - ASSERT_NE(nullptr, miLoad); - - if (miLoad->getRegisterOffset() == NEO::GlobalSipRegister::registerOffset) { - globalSipFound++; - } - } - EXPECT_NE(0u, globalSipFound); - } else { - auto sipItor = find(cmdList.begin(), cmdList.end()); - ASSERT_NE(cmdList.end(), sipItor); - } + auto sipItor = find(cmdList.begin(), cmdList.end()); + ASSERT_NE(cmdList.end(), sipItor); commandList->destroy(); } @@ -258,25 +241,8 @@ HWTEST2_P(L0DebuggerWithBlitterTest, givenImmediateFlushTaskWhenExecutingKernelT ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer( cmdList, commandList->csr->getCS().getCpuBase(), commandList->csr->getCS().getUsed())); - auto &gfxCoreHelper = device->getGfxCoreHelper(); - if (gfxCoreHelper.isSipWANeeded(hwInfo)) { - - auto miLoadImm = findAll(cmdList.begin(), cmdList.end()); - - auto globalSipFound = 0u; - for (size_t i = 0; i < miLoadImm.size(); i++) { - MI_LOAD_REGISTER_IMM *miLoad = genCmdCast(*miLoadImm[i]); - ASSERT_NE(nullptr, miLoad); - - if (miLoad->getRegisterOffset() == NEO::GlobalSipRegister::registerOffset) { - globalSipFound++; - } - } - EXPECT_NE(0u, globalSipFound); - } else { - auto sipItor = find(cmdList.begin(), cmdList.end()); - ASSERT_NE(cmdList.end(), sipItor); - } + auto sipItor = find(cmdList.begin(), cmdList.end()); + ASSERT_NE(cmdList.end(), sipItor); commandList->destroy(); } @@ -607,13 +573,10 @@ HWTEST_P(L0DebuggerWithBlitterTest, givenDebuggingEnabledWhenCommandListIsExecut EXPECT_EQ(0u, tdDebugControlRegisterCount); EXPECT_EQ(0u, globalSipFound); - auto &gfxCoreHelper = device->getGfxCoreHelper(); - if (!gfxCoreHelper.isSipWANeeded(hwInfo)) { - auto stateSipCmds = findAll(cmdList.begin(), cmdList.end()); + auto stateSipCmds = findAll(cmdList.begin(), cmdList.end()); - if (device->getDevicePreemptionMode() != PreemptionMode::MidThread) { - ASSERT_EQ(0u, stateSipCmds.size()); - } + if (device->getDevicePreemptionMode() != PreemptionMode::MidThread) { + ASSERT_EQ(0u, stateSipCmds.size()); } for (auto i = 0u; i < numCommandLists; i++) { diff --git a/opencl/test/unit_test/xe_hpc_core/gfx_core_helper_tests_xe_hpc_core.cpp b/opencl/test/unit_test/xe_hpc_core/gfx_core_helper_tests_xe_hpc_core.cpp index 5ac3f51e46..edff9df376 100644 --- a/opencl/test/unit_test/xe_hpc_core/gfx_core_helper_tests_xe_hpc_core.cpp +++ b/opencl/test/unit_test/xe_hpc_core/gfx_core_helper_tests_xe_hpc_core.cpp @@ -710,11 +710,6 @@ XE_HPC_CORETEST_F(LriHelperTestsXeHpcCore, whenProgrammingLriCommandThenExpectMm EXPECT_TRUE(memcmp(lri, &expectedLri, sizeof(MI_LOAD_REGISTER_IMM)) == 0); } -XE_HPC_CORETEST_F(GfxCoreHelperTestsXeHpcCore, WhenCheckingSipWAThenFalseIsReturned) { - auto &gfxCoreHelper = getHelper(); - EXPECT_FALSE(gfxCoreHelper.isSipWANeeded(*defaultHwInfo)); -} - XE_HPC_CORETEST_F(GfxCoreHelperTestsXeHpcCore, givenBdA0WhenBcsSubDeviceSupportIsCheckedThenReturnFalse) { DebugManagerStateRestore restore; diff --git a/shared/source/command_stream/command_stream_receiver_hw.h b/shared/source/command_stream/command_stream_receiver_hw.h index 44fb9cf66c..9fdf076c36 100644 --- a/shared/source/command_stream/command_stream_receiver_hw.h +++ b/shared/source/command_stream/command_stream_receiver_hw.h @@ -70,7 +70,7 @@ class CommandStreamReceiverHw : public CommandStreamReceiver { size_t getCmdsSizeForHardwareContext() const override; static void addBatchBufferEnd(LinearStream &commandStream, void **patchLocation); - void programEndingCmd(LinearStream &commandStream, void **patchLocation, bool directSubmissionEnabled, bool hasRelaxedOrderingDependencies, bool sipWaAllowed); + void programEndingCmd(LinearStream &commandStream, void **patchLocation, bool directSubmissionEnabled, bool hasRelaxedOrderingDependencies); void addBatchBufferStart(MI_BATCH_BUFFER_START *commandBufferMemory, uint64_t startAddress, bool secondary); size_t getRequiredStateBaseAddressSize(const Device &device) const; diff --git a/shared/source/command_stream/command_stream_receiver_hw_base.inl b/shared/source/command_stream/command_stream_receiver_hw_base.inl index a62e3da836..a11e0233a6 100644 --- a/shared/source/command_stream/command_stream_receiver_hw_base.inl +++ b/shared/source/command_stream/command_stream_receiver_hw_base.inl @@ -106,7 +106,7 @@ inline void CommandStreamReceiverHw::addBatchBufferEnd(LinearStream & template inline void CommandStreamReceiverHw::programEndingCmd(LinearStream &commandStream, void **patchLocation, bool directSubmissionEnabled, - bool hasRelaxedOrderingDependencies, bool sipWaAllowed) { + bool hasRelaxedOrderingDependencies) { if (directSubmissionEnabled) { uint64_t startAddress = commandStream.getGraphicsAllocation()->getGpuAddress() + commandStream.getUsed(); if (DebugManager.flags.BatchBufferStartPrepatchingWaEnabled.get() == 0) { @@ -133,10 +133,6 @@ inline void CommandStreamReceiverHw::programEndingCmd(LinearStream &c NEO::EncodeBatchBufferStartOrEnd::programBatchBufferStart(&commandStream, startAddress, false, indirect, false); } else { - if (sipWaAllowed) { - auto &rootDeviceEnvironment = peekRootDeviceEnvironment(); - PreemptionHelper::programStateSipEndWa(commandStream, rootDeviceEnvironment); - } this->addBatchBufferEnd(commandStream, patchLocation); } } @@ -220,7 +216,7 @@ CompletionStamp CommandStreamReceiverHw::flushBcsTask(LinearStream &c bool submitCSR = (commandStreamStartCSR != commandStreamCSR.getUsed()); void *bbEndLocation = nullptr; - programEndingCmd(commandStreamTask, &bbEndLocation, isBlitterDirectSubmissionEnabled(), dispatchBcsFlags.hasRelaxedOrderingDependencies, false); + programEndingCmd(commandStreamTask, &bbEndLocation, isBlitterDirectSubmissionEnabled(), dispatchBcsFlags.hasRelaxedOrderingDependencies); EncodeNoop::alignToCacheLine(commandStreamTask); if (submitCSR) { @@ -605,7 +601,7 @@ CompletionStamp CommandStreamReceiverHw::flushTask( GraphicsAllocation *chainedBatchBuffer = nullptr; bool directSubmissionEnabled = isDirectSubmissionEnabled(); if (submitTask) { - programEndingCmd(commandStreamTask, &bbEndLocation, directSubmissionEnabled, dispatchFlags.hasRelaxedOrderingDependencies, true); + programEndingCmd(commandStreamTask, &bbEndLocation, directSubmissionEnabled, dispatchFlags.hasRelaxedOrderingDependencies); EncodeNoop::emitNoop(commandStreamTask, bbEndPaddingSize); EncodeNoop::alignToCacheLine(commandStreamTask); @@ -636,7 +632,7 @@ CompletionStamp CommandStreamReceiverHw::flushTask( this->programEpilogue(commandStreamCSR, device, &bbEndLocation, dispatchFlags); } else if (submitCSR) { - programEndingCmd(commandStreamCSR, &bbEndLocation, directSubmissionEnabled, dispatchFlags.hasRelaxedOrderingDependencies, true); + programEndingCmd(commandStreamCSR, &bbEndLocation, directSubmissionEnabled, dispatchFlags.hasRelaxedOrderingDependencies); EncodeNoop::emitNoop(commandStreamCSR, bbEndPaddingSize); EncodeNoop::alignToCacheLine(commandStreamCSR); DEBUG_BREAK_IF(commandStreamCSR.getUsed() > commandStreamCSR.getMaxAvailableSpace()); @@ -1234,7 +1230,7 @@ TaskCountType CommandStreamReceiverHw::flushBcsTask(const BlitPropert } void *endingCmdPtr = nullptr; - programEndingCmd(commandStream, &endingCmdPtr, blitterDirectSubmission, isRelaxedOrderingDispatch, false); + programEndingCmd(commandStream, &endingCmdPtr, blitterDirectSubmission, isRelaxedOrderingDispatch); EncodeNoop::alignToCacheLine(commandStream); @@ -1353,7 +1349,7 @@ SubmissionStatus CommandStreamReceiverHw::flushSmallTask(LinearStream using MI_BATCH_BUFFER_END = typename GfxFamily::MI_BATCH_BUFFER_END; void *endingCmdPtr = nullptr; - programEndingCmd(commandStreamTask, &endingCmdPtr, isAnyDirectSubmissionEnabled(), false, false); + programEndingCmd(commandStreamTask, &endingCmdPtr, isAnyDirectSubmissionEnabled(), false); auto bytesToPad = EncodeBatchBufferStartOrEnd::getBatchBufferStartSize() - EncodeBatchBufferStartOrEnd::getBatchBufferEndSize(); @@ -1441,7 +1437,7 @@ inline void CommandStreamReceiverHw::programEpilogue(LinearStream &cs addBatchBufferStart(reinterpret_cast(*batchBufferEndLocation), gpuAddress, false); this->programEpliogueCommands(csr, dispatchFlags); - programEndingCmd(csr, batchBufferEndLocation, isDirectSubmissionEnabled(), false, !EngineHelpers::isBcs(osContext->getEngineType())); + programEndingCmd(csr, batchBufferEndLocation, isDirectSubmissionEnabled(), false); EncodeNoop::alignToCacheLine(csr); } } @@ -2153,7 +2149,7 @@ void CommandStreamReceiverHw::dispatchImmediateFlushClientBufferComma makeResident(*immediateCommandStream.getGraphicsAllocation()); - programEndingCmd(immediateCommandStream, &flushData.endPtr, isDirectSubmissionEnabled(), dispatchFlags.hasRelaxedOrderingDependencies, true); + programEndingCmd(immediateCommandStream, &flushData.endPtr, isDirectSubmissionEnabled(), dispatchFlags.hasRelaxedOrderingDependencies); EncodeNoop::alignToCacheLine(immediateCommandStream); } diff --git a/shared/source/command_stream/command_stream_receiver_hw_xehp_and_later.inl b/shared/source/command_stream/command_stream_receiver_hw_xehp_and_later.inl index 8f0945d995..4ec90831ac 100644 --- a/shared/source/command_stream/command_stream_receiver_hw_xehp_and_later.inl +++ b/shared/source/command_stream/command_stream_receiver_hw_xehp_and_later.inl @@ -135,7 +135,6 @@ inline void CommandStreamReceiverHw::programActivePartitionConfig(Lin template inline void CommandStreamReceiverHw::addPipeControlBeforeStateSip(LinearStream &commandStream, Device &device) { auto &hwInfo = peekHwInfo(); - auto &gfxCoreHelper = getGfxCoreHelper(); auto &productHelper = getProductHelper(); auto *releaseHelper = getReleaseHelper(); bool debuggingEnabled = device.getDebugger() != nullptr; @@ -144,7 +143,7 @@ inline void CommandStreamReceiverHw::addPipeControlBeforeStateSip(Lin const auto &[isBasicWARequired, isExtendedWARequired] = productHelper.isPipeControlPriorToNonPipelinedStateCommandsWARequired(hwInfo, isRcs(), releaseHelper); std::ignore = isExtendedWARequired; - if (isBasicWARequired && debuggingEnabled && !gfxCoreHelper.isSipWANeeded(hwInfo)) { + if (isBasicWARequired && debuggingEnabled) { NEO::EncodeWA::addPipeControlPriorToNonPipelinedStateCommand(commandStream, args, this->peekRootDeviceEnvironment(), isRcs()); } } diff --git a/shared/source/command_stream/preemption.h b/shared/source/command_stream/preemption.h index 708a799833..67388e3ec0 100644 --- a/shared/source/command_stream/preemption.h +++ b/shared/source/command_stream/preemption.h @@ -60,9 +60,6 @@ class PreemptionHelper { template static void programStateSip(LinearStream &preambleCmdStream, Device &device, OsContext *context); - template - static void programStateSipEndWa(LinearStream &cmdStream, const RootDeviceEnvironment &rootDeviceEnvironment); - template static size_t getRequiredCmdStreamSize(PreemptionMode newPreemptionMode, PreemptionMode oldPreemptionMode); diff --git a/shared/source/command_stream/preemption.inl b/shared/source/command_stream/preemption.inl index ed66a6f376..1f0da694c7 100644 --- a/shared/source/command_stream/preemption.inl +++ b/shared/source/command_stream/preemption.inl @@ -59,9 +59,6 @@ void PreemptionHelper::programStateSipCmd(LinearStream &preambleCmdStream, Graph *sip = cmd; } -template -void PreemptionHelper::programStateSipEndWa(LinearStream &cmdStream, const RootDeviceEnvironment &rootDeviceEnvironment) {} - template void PreemptionHelper::programCmdStream(LinearStream &cmdStream, PreemptionMode newPreemptionMode, PreemptionMode oldPreemptionMode, GraphicsAllocation *preemptionCsr) { diff --git a/shared/source/command_stream/preemption_xehp_and_later.inl b/shared/source/command_stream/preemption_xehp_and_later.inl index ba3c1ba6a4..40f785a860 100644 --- a/shared/source/command_stream/preemption_xehp_and_later.inl +++ b/shared/source/command_stream/preemption_xehp_and_later.inl @@ -14,54 +14,15 @@ void PreemptionHelper::programStateSip(LinearStream &preambleCmdStrea using STATE_SIP = typename GfxFamily::STATE_SIP; using MI_LOAD_REGISTER_IMM = typename GfxFamily::MI_LOAD_REGISTER_IMM; - auto &hwInfo = device.getHardwareInfo(); bool debuggingEnabled = device.getDebugger() != nullptr; if (debuggingEnabled) { - auto &gfxCoreHelper = device.getGfxCoreHelper(); - GraphicsAllocation *sipAllocation = SipKernel::getSipKernel(device, context).getSipAllocation(); - if (gfxCoreHelper.isSipWANeeded(hwInfo)) { - auto mmio = reinterpret_cast(preambleCmdStream.getSpace(sizeof(MI_LOAD_REGISTER_IMM))); - MI_LOAD_REGISTER_IMM cmd = GfxFamily::cmdInitLoadRegisterImm; - - UNRECOVERABLE_IF((sipAllocation->getGpuAddressToPatch() & uint64_t(0xffffffff00000000)) != 0); - - uint32_t globalSip = static_cast(sipAllocation->getGpuAddressToPatch() & uint32_t(-1)); - globalSip &= 0xfffffff8; - globalSip |= 1; - cmd.setDataDword(globalSip); - cmd.setRegisterOffset(GlobalSipRegister::registerOffset); - *mmio = cmd; - } else { - auto sip = reinterpret_cast(preambleCmdStream.getSpace(sizeof(STATE_SIP))); - STATE_SIP cmd = GfxFamily::cmdInitStateSip; - cmd.setSystemInstructionPointer(sipAllocation->getGpuAddressToPatch()); - *sip = cmd; - } - } -} - -template <> -void PreemptionHelper::programStateSipEndWa(LinearStream &cmdStream, const RootDeviceEnvironment &rootDeviceEnvironment) { - using MI_LOAD_REGISTER_IMM = typename GfxFamily::MI_LOAD_REGISTER_IMM; - - if (rootDeviceEnvironment.debugger) { - auto &gfxCoreHelper = rootDeviceEnvironment.getHelper(); - auto &hwInfo = *rootDeviceEnvironment.getHardwareInfo(); - if (gfxCoreHelper.isSipWANeeded(hwInfo)) { - - NEO::PipeControlArgs args; - NEO::MemorySynchronizationCommands::addSingleBarrier(cmdStream, args); - - auto mmio = reinterpret_cast(cmdStream.getSpace(sizeof(MI_LOAD_REGISTER_IMM))); - MI_LOAD_REGISTER_IMM cmd = GfxFamily::cmdInitLoadRegisterImm; - uint32_t globalSip = 0; - cmd.setDataDword(globalSip); - cmd.setRegisterOffset(GlobalSipRegister::registerOffset); - *mmio = cmd; - } + auto sip = reinterpret_cast(preambleCmdStream.getSpace(sizeof(STATE_SIP))); + STATE_SIP cmd = GfxFamily::cmdInitStateSip; + cmd.setSystemInstructionPointer(sipAllocation->getGpuAddressToPatch()); + *sip = cmd; } } @@ -77,22 +38,16 @@ size_t PreemptionHelper::getRequiredStateSipCmdSize(Device &device, b auto &hwInfo = device.getHardwareInfo(); if (debuggingEnabled) { - auto &gfxCoreHelper = device.getGfxCoreHelper(); - if (gfxCoreHelper.isSipWANeeded(hwInfo)) { + auto &productHelper = device.getProductHelper(); + auto *releaseHelper = device.getReleaseHelper(); + const auto &[isBasicWARequired, isExtendedWARequired] = productHelper.isPipeControlPriorToNonPipelinedStateCommandsWARequired(hwInfo, isRcs, releaseHelper); + const auto isWARequired = isBasicWARequired || isExtendedWARequired; + + if (isWARequired) { size += MemorySynchronizationCommands::getSizeForSingleBarrier(false); - size += 2 * sizeof(typename GfxFamily::MI_LOAD_REGISTER_IMM); - } else { - auto &productHelper = device.getProductHelper(); - auto *releaseHelper = device.getReleaseHelper(); - const auto &[isBasicWARequired, isExtendedWARequired] = productHelper.isPipeControlPriorToNonPipelinedStateCommandsWARequired(hwInfo, isRcs, releaseHelper); - const auto isWARequired = isBasicWARequired || isExtendedWARequired; - - if (isWARequired) { - size += MemorySynchronizationCommands::getSizeForSingleBarrier(false); - } - size += sizeof(typename GfxFamily::STATE_SIP); } + size += sizeof(typename GfxFamily::STATE_SIP); } return size; } diff --git a/shared/source/gen11/preemption_gen11.cpp b/shared/source/gen11/preemption_gen11.cpp index c8437df381..4f2ba4a327 100644 --- a/shared/source/gen11/preemption_gen11.cpp +++ b/shared/source/gen11/preemption_gen11.cpp @@ -26,6 +26,5 @@ template size_t PreemptionHelper::getPreemptionWaCsSize(const Device template void PreemptionHelper::applyPreemptionWaCmdsBegin(LinearStream *pCommandStream, const Device &device); template void PreemptionHelper::applyPreemptionWaCmdsEnd(LinearStream *pCommandStream, const Device &device); template void PreemptionHelper::programInterfaceDescriptorDataPreemption(INTERFACE_DESCRIPTOR_DATA *idd, PreemptionMode preemptionMode); -template void PreemptionHelper::programStateSipEndWa(LinearStream &cmdStream, const RootDeviceEnvironment &rootDeviceEnvironment); } // namespace NEO diff --git a/shared/source/gen12lp/preemption_gen12lp.cpp b/shared/source/gen12lp/preemption_gen12lp.cpp index 3c07a944b5..aed2727078 100644 --- a/shared/source/gen12lp/preemption_gen12lp.cpp +++ b/shared/source/gen12lp/preemption_gen12lp.cpp @@ -26,5 +26,4 @@ template size_t PreemptionHelper::getPreemptionWaCsSize(const Device template void PreemptionHelper::applyPreemptionWaCmdsBegin(LinearStream *pCommandStream, const Device &device); template void PreemptionHelper::applyPreemptionWaCmdsEnd(LinearStream *pCommandStream, const Device &device); template void PreemptionHelper::programInterfaceDescriptorDataPreemption(INTERFACE_DESCRIPTOR_DATA *idd, PreemptionMode preemptionMode); -template void PreemptionHelper::programStateSipEndWa(LinearStream &cmdStream, const RootDeviceEnvironment &rootDeviceEnvironment); } // namespace NEO diff --git a/shared/source/gen8/preemption_gen8.cpp b/shared/source/gen8/preemption_gen8.cpp index 8f56ac0c1c..4d833311e7 100644 --- a/shared/source/gen8/preemption_gen8.cpp +++ b/shared/source/gen8/preemption_gen8.cpp @@ -119,5 +119,4 @@ void PreemptionHelper::programInterfaceDescriptorDataPreemption(INTER } template size_t PreemptionHelper::getRequiredCmdStreamSize(PreemptionMode newPreemptionMode, PreemptionMode oldPreemptionMode); -template void PreemptionHelper::programStateSipEndWa(LinearStream &cmdStream, const RootDeviceEnvironment &rootDeviceEnvironment); } // namespace NEO diff --git a/shared/source/gen9/preemption_gen9.cpp b/shared/source/gen9/preemption_gen9.cpp index ea56c52911..db53170572 100644 --- a/shared/source/gen9/preemption_gen9.cpp +++ b/shared/source/gen9/preemption_gen9.cpp @@ -77,6 +77,5 @@ template void PreemptionHelper::programStateSip(LinearStream &preambl template void PreemptionHelper::programStateSipCmd(LinearStream &preambleCmdStream, GraphicsAllocation *sipAllocation); template size_t PreemptionHelper::getRequiredStateSipCmdSize(Device &device, bool isRcs); template size_t PreemptionHelper::getRequiredCmdStreamSize(PreemptionMode newPreemptionMode, PreemptionMode oldPreemptionMode); -template void PreemptionHelper::programStateSipEndWa(LinearStream &cmdStream, const RootDeviceEnvironment &rootDeviceEnvironment); } // namespace NEO diff --git a/shared/source/helpers/gfx_core_helper.h b/shared/source/helpers/gfx_core_helper.h index 86056f1371..9d3309ee84 100644 --- a/shared/source/helpers/gfx_core_helper.h +++ b/shared/source/helpers/gfx_core_helper.h @@ -123,7 +123,6 @@ class GfxCoreHelper { virtual uint32_t adjustMaxWorkGroupSize(const uint32_t numGrf, const uint32_t simd, bool isHwLocalGeneration, const uint32_t defaultMaxGroupSize) const = 0; virtual size_t getMaxFillPaternSizeForCopyEngine() const = 0; virtual size_t getSipKernelMaxDbgSurfaceSize(const HardwareInfo &hwInfo) const = 0; - virtual bool isSipWANeeded(const HardwareInfo &hwInfo) const = 0; virtual bool isCpuImageTransferPreferred(const HardwareInfo &hwInfo) const = 0; virtual aub_stream::MMIOList getExtraMmioList(const HardwareInfo &hwInfo, const GmmHelper &gmmHelper) const = 0; virtual uint32_t getNumCacheRegions() const = 0; @@ -328,8 +327,6 @@ class GfxCoreHelperHw : public GfxCoreHelper { size_t getSipKernelMaxDbgSurfaceSize(const HardwareInfo &hwInfo) const override; - bool isSipWANeeded(const HardwareInfo &hwInfo) const override; - bool isCpuImageTransferPreferred(const HardwareInfo &hwInfo) const override; aub_stream::MMIOList getExtraMmioList(const HardwareInfo &hwInfo, const GmmHelper &gmmHelper) const override; diff --git a/shared/source/helpers/gfx_core_helper_base.inl b/shared/source/helpers/gfx_core_helper_base.inl index 4fdad78a1e..23bf3d3667 100644 --- a/shared/source/helpers/gfx_core_helper_base.inl +++ b/shared/source/helpers/gfx_core_helper_base.inl @@ -564,11 +564,6 @@ bool MemorySynchronizationCommands::isBarrierPriorToPipelineSelectWaR return false; } -template -bool GfxCoreHelperHw::isSipWANeeded(const HardwareInfo &hwInfo) const { - return false; -} - template bool GfxCoreHelperHw::isAdditionalFeatureFlagRequired(const FeatureTable *featureTable) const { return false; diff --git a/shared/test/unit_test/direct_submission/direct_submission_tests_1.cpp b/shared/test/unit_test/direct_submission/direct_submission_tests_1.cpp index ffb8d3b1a9..2a723071f9 100644 --- a/shared/test/unit_test/direct_submission/direct_submission_tests_1.cpp +++ b/shared/test/unit_test/direct_submission/direct_submission_tests_1.cpp @@ -742,7 +742,7 @@ HWTEST_F(DirectSubmissionTest, givenDirectSubmissionAvailableWhenProgrammingEndi uint8_t buffer[128]; mockCsr->commandStream.replaceBuffer(&buffer[0], 128u); mockCsr->commandStream.replaceGraphicsAllocation(&mockAllocation); - mockCsr->programEndingCmd(mockCsr->commandStream, &location, ret, false, true); + mockCsr->programEndingCmd(mockCsr->commandStream, &location, ret, false); EXPECT_EQ(sizeof(MI_BATCH_BUFFER_START), mockCsr->commandStream.getUsed()); DispatchFlags dispatchFlags = DispatchFlagsHelper::createDefaultDispatchFlags(); @@ -786,7 +786,7 @@ HWTEST_F(DirectSubmissionTest, givenDebugFlagSetWhenProgrammingEndingCommandThen auto currectBbStartCmd = reinterpret_cast(cmdStream.getSpace(0)); uint64_t expectedGpuVa = cmdStream.getGraphicsAllocation()->getGpuAddress() + cmdStream.getUsed(); - mockCsr->programEndingCmd(cmdStream, &location, ret, false, true); + mockCsr->programEndingCmd(cmdStream, &location, ret, false); EncodeNoop::alignToCacheLine(cmdStream); if (value == 0) { diff --git a/shared/test/unit_test/direct_submission/direct_submission_tests_2.cpp b/shared/test/unit_test/direct_submission/direct_submission_tests_2.cpp index 3349b0d009..4c03a942d1 100644 --- a/shared/test/unit_test/direct_submission/direct_submission_tests_2.cpp +++ b/shared/test/unit_test/direct_submission/direct_submission_tests_2.cpp @@ -2161,7 +2161,7 @@ HWTEST2_F(DirectSubmissionRelaxedOrderingTests, givenBcsRelaxedOrderingEnabledWh auto endingPtr = commandStream.getSpace(0); - ultCsr->programEndingCmd(commandStream, &endingPtr, true, true, false); + ultCsr->programEndingCmd(commandStream, &endingPtr, true, true); auto lrrCmd = reinterpret_cast(commandStream.getCpuBase()); EXPECT_EQ(lrrCmd->getSourceRegisterAddress(), CS_GPR_R3); @@ -2194,7 +2194,7 @@ HWTEST2_F(DirectSubmissionRelaxedOrderingTests, givenBcsRelaxedOrderingDisabledW auto endingPtr = commandStream.getSpace(0); - ultCsr->programEndingCmd(commandStream, &endingPtr, true, false, false); + ultCsr->programEndingCmd(commandStream, &endingPtr, true, false); auto bbStartCmd = genCmdCast(commandStream.getCpuBase()); ASSERT_NE(nullptr, bbStartCmd); @@ -2217,7 +2217,7 @@ HWTEST2_F(DirectSubmissionRelaxedOrderingTests, whenProgrammingEndingCmdsThenSet auto endingPtr = commandStream.getSpace(0); - ultCsr->programEndingCmd(commandStream, &endingPtr, true, true, false); + ultCsr->programEndingCmd(commandStream, &endingPtr, true, true); auto lrrCmd = reinterpret_cast(commandStream.getCpuBase()); EXPECT_EQ(lrrCmd->getSourceRegisterAddress(), CS_GPR_R3); @@ -2246,7 +2246,7 @@ HWTEST2_F(DirectSubmissionRelaxedOrderingTests, givenBbWithoutRelaxedOrderingDep auto endingPtr = commandStream.getSpace(0); - ultCsr->programEndingCmd(commandStream, &endingPtr, true, false, false); + ultCsr->programEndingCmd(commandStream, &endingPtr, true, false); auto bbStartCmd = genCmdCast(commandStream.getCpuBase()); ASSERT_NE(nullptr, bbStartCmd); @@ -2730,4 +2730,4 @@ HWTEST2_F(DirectSubmissionRelaxedOrderingTests, givenNumClientsWhenAskingIfRelax ultCsr->registerClient(&client4); EXPECT_EQ(4u, ultCsr->getNumClients()); EXPECT_TRUE(NEO::RelaxedOrderingHelper::isRelaxedOrderingDispatchAllowed(*ultCsr, 1)); -} \ No newline at end of file +} diff --git a/shared/test/unit_test/helpers/gfx_core_helper_tests.cpp b/shared/test/unit_test/helpers/gfx_core_helper_tests.cpp index 61423d471c..a56a0b60ce 100644 --- a/shared/test/unit_test/helpers/gfx_core_helper_tests.cpp +++ b/shared/test/unit_test/helpers/gfx_core_helper_tests.cpp @@ -1153,11 +1153,6 @@ HWTEST_F(GfxCoreHelperTest, GivenZeroSlmSizeWhenComputeSlmSizeIsCalledThenCorrec EXPECT_EQ(SHARED_LOCAL_MEMORY_SIZE::SHARED_LOCAL_MEMORY_SIZE_ENCODES_0K, receivedSlmSize); } -HWTEST2_F(GfxCoreHelperTest, givenGfxCoreHelperWhenCheckingSipWaThenFalseIsReturned, isTglLpOrBelow) { - auto &gfxCoreHelper = getHelper(); - - EXPECT_FALSE(gfxCoreHelper.isSipWANeeded(*defaultHwInfo)); -} HWCMDTEST_F(IGFX_GEN8_CORE, GfxCoreHelperTest, givenGfxCoreHelperWhenGettingPlanarYuvHeightThenHelperReturnsCorrectValue) { auto &gfxCoreHelper = getHelper(); EXPECT_EQ(gfxCoreHelper.getPlanarYuvMaxHeight(), 16352u); @@ -1592,4 +1587,4 @@ HWTEST_F(GfxCoreHelperTest, givenFlagRemoveRestrictionsOnNumberOfThreadsInGpgpuT for (auto &[simtSize, totalWgSize, grfsize, isHwLocalIdGeneration, expectedNumThreadsPerThreadGroup] : values) { EXPECT_EQ(expectedNumThreadsPerThreadGroup, gfxCoreHelper.calculateNumThreadsPerThreadGroup(simtSize, totalWgSize, grfsize, isHwLocalIdGeneration)); } -} \ No newline at end of file +} diff --git a/shared/test/unit_test/xe_hpg_core/gfx_core_helper_tests_xe_hpg_core.cpp b/shared/test/unit_test/xe_hpg_core/gfx_core_helper_tests_xe_hpg_core.cpp index 4ba529928a..3e271c86f8 100644 --- a/shared/test/unit_test/xe_hpg_core/gfx_core_helper_tests_xe_hpg_core.cpp +++ b/shared/test/unit_test/xe_hpg_core/gfx_core_helper_tests_xe_hpg_core.cpp @@ -153,12 +153,6 @@ XE_HPG_CORETEST_F(GfxCoreHelperTestXeHpgCore, givenGfxCoreHelperWhenGettingThrea EXPECT_EQ(8U, configs[1]); } -XE_HPG_CORETEST_F(GfxCoreHelperTestXeHpgCore, WhenCheckingSipWAThenFalseIsReturned) { - auto &gfxCoreHelper = getHelper(); - - EXPECT_FALSE(gfxCoreHelper.isSipWANeeded(pDevice->getHardwareInfo())); -} - XE_HPG_CORETEST_F(ProductHelperTestXeHpgCore, givenProductHelperWhenCheckDummyBlitWaRequiredThenReturnTrue) { auto &productHelper = getHelper(); EXPECT_TRUE(productHelper.isDummyBlitWaRequired()); @@ -344,4 +338,4 @@ XE_HPG_CORETEST_F(GfxCoreHelperTestXeHpgCore, GivenVariousValuesWhenComputeSlmSi for (auto &testInput : computeSlmValuesXeHpgTestsInput) { EXPECT_EQ(testInput.expected, gfxCoreHelper.computeSlmValues(hardwareInfo, testInput.slmSize)); } -} \ No newline at end of file +}