diff --git a/level_zero/core/source/cmdlist/cmdlist.h b/level_zero/core/source/cmdlist/cmdlist.h index 756f17e9d1..ccdd6b7d5b 100644 --- a/level_zero/core/source/cmdlist/cmdlist.h +++ b/level_zero/core/source/cmdlist/cmdlist.h @@ -352,6 +352,7 @@ struct CommandList : _ze_command_list_handle_t { bool stateComputeModeTracking = false; bool signalAllEventPackets = false; bool stateBaseAddressTracking = false; + bool doubleSbaWa = false; }; using CommandListAllocatorFn = CommandList *(*)(uint32_t); diff --git a/level_zero/core/source/cmdlist/cmdlist_hw.inl b/level_zero/core/source/cmdlist/cmdlist_hw.inl index f3bbb204f5..a71a0c4cbf 100644 --- a/level_zero/core/source/cmdlist/cmdlist_hw.inl +++ b/level_zero/core/source/cmdlist/cmdlist_hw.inl @@ -151,6 +151,9 @@ ze_result_t CommandListCoreFamily::initialize(Device *device, NEO this->compactL3FlushEventPacket = L0GfxCoreHelper::useCompactL3FlushEventPacket(hwInfo); this->signalAllEventPackets = L0GfxCoreHelper::useSignalAllEventPackets(hwInfo); this->dynamicHeapRequired = NEO::EncodeDispatchKernel::isDshNeeded(device->getDeviceInfo()); + auto &productHelper = rootDeviceEnvironment.getHelper(); + this->doubleSbaWa = productHelper.isAdditionalStateBaseAddressWARequired(hwInfo); + commandContainer.doubleSbaWa = this->doubleSbaWa; if (device->isImplicitScalingCapable() && !this->internalUsage && !isCopyOnly()) { this->partitionCount = static_cast(this->device->getNEODevice()->getDeviceBitfield().count()); @@ -2628,7 +2631,8 @@ void CommandListCoreFamily::programStateBaseAddress(NEO::CommandC statelessMocsIndex, // statelessMocsIndex false, // useGlobalAtomics this->partitionCount > 1, // multiOsContextCapable - isRcs}; // isRcs + isRcs, // isRcs + this->doubleSbaWa}; // doubleSbaWa NEO::EncodeStateBaseAddress::encode(encodeStateBaseAddressArgs); bool sbaTrackingEnabled = NEO::Debugger::isDebugEnabled(this->internalUsage) && device->getL0Debugger(); diff --git a/level_zero/core/source/cmdqueue/cmdqueue.cpp b/level_zero/core/source/cmdqueue/cmdqueue.cpp index 4ab32993d4..670df9bfa2 100644 --- a/level_zero/core/source/cmdqueue/cmdqueue.cpp +++ b/level_zero/core/source/cmdqueue/cmdqueue.cpp @@ -14,9 +14,11 @@ #include "shared/source/command_stream/wait_status.h" #include "shared/source/debug_settings/debug_settings_manager.h" #include "shared/source/debugger/debugger_l0.h" +#include "shared/source/execution_environment/root_device_environment.h" #include "shared/source/helpers/aligned_memory.h" #include "shared/source/memory_manager/allocation_properties.h" #include "shared/source/memory_manager/memory_manager.h" +#include "shared/source/os_interface/hw_info_config.h" #include "shared/source/os_interface/os_context.h" #include "level_zero/core/source/cmdqueue/cmdqueue_imp.h" @@ -86,11 +88,14 @@ ze_result_t CommandQueueImp::initialize(bool copyOnly, bool isInternal) { if (NEO::Debugger::isDebugEnabled(internalUsage) && device->getL0Debugger()) { device->getL0Debugger()->notifyCommandQueueCreated(device->getNEODevice()); } + auto &hwInfo = device->getHwInfo(); auto &rootDeviceEnvironment = device->getNEODevice()->getRootDeviceEnvironment(); this->stateComputeModeTracking = L0GfxCoreHelper::enableStateComputeModeTracking(rootDeviceEnvironment); this->frontEndStateTracking = L0GfxCoreHelper::enableFrontEndStateTracking(rootDeviceEnvironment); this->pipelineSelectStateTracking = L0GfxCoreHelper::enablePipelineSelectStateTracking(rootDeviceEnvironment); this->stateBaseAddressTracking = L0GfxCoreHelper::enableStateBaseAddressTracking(rootDeviceEnvironment); + auto &productHelper = rootDeviceEnvironment.getHelper(); + this->doubleSbaWa = productHelper.isAdditionalStateBaseAddressWARequired(hwInfo); } return returnValue; } diff --git a/level_zero/core/source/cmdqueue/cmdqueue.h b/level_zero/core/source/cmdqueue/cmdqueue.h index 882cfb5e9c..2be4e03521 100644 --- a/level_zero/core/source/cmdqueue/cmdqueue.h +++ b/level_zero/core/source/cmdqueue/cmdqueue.h @@ -77,6 +77,7 @@ struct CommandQueue : _ze_command_queue_handle_t { bool pipelineSelectStateTracking = false; bool stateComputeModeTracking = false; bool stateBaseAddressTracking = false; + bool doubleSbaWa = false; }; using CommandQueueAllocatorFn = CommandQueue *(*)(Device *device, NEO::CommandStreamReceiver *csr, diff --git a/level_zero/core/source/cmdqueue/cmdqueue_hw_base.inl b/level_zero/core/source/cmdqueue/cmdqueue_hw_base.inl index 17cb817cc3..d1e559602e 100644 --- a/level_zero/core/source/cmdqueue/cmdqueue_hw_base.inl +++ b/level_zero/core/source/cmdqueue/cmdqueue_hw_base.inl @@ -27,7 +27,6 @@ template void CommandQueueHw::programStateBaseAddress(uint64_t gsba, bool useLocalMemoryForIndirectHeap, NEO::LinearStream &commandStream, bool cachedMOCSAllowed) { using STATE_BASE_ADDRESS = typename GfxFamily::STATE_BASE_ADDRESS; - const auto &hwInfo = this->device->getHwInfo(); NEO::Device *neoDevice = device->getNEODevice(); bool isRcs = this->getCsr()->isRcs(); auto &rootDeviceEnvironment = neoDevice->getRootDeviceEnvironment(); @@ -59,7 +58,6 @@ void CommandQueueHw::programStateBaseAddress(uint64_t gsba, bool nullptr, // ioh nullptr, // ssh neoDevice->getGmmHelper(), // gmmHelper - &hwInfo, // hwInfo (device->getMOCS(cachedMOCSAllowed, false) >> 1), // statelessMocsIndex NEO::MemoryCompressionState::NotApplicable, // memoryCompressionState true, // setInstructionStateBaseAddress @@ -69,7 +67,8 @@ void CommandQueueHw::programStateBaseAddress(uint64_t gsba, bool false, // useGlobalAtomics false, // areMultipleSubDevicesInContext false, // overrideSurfaceStateBaseAddress - isDebuggerActive // isDebuggerActive + isDebuggerActive, // isDebuggerActive + this->doubleSbaWa // doubleSbaWa }; NEO::StateBaseAddressHelper::programStateBaseAddressIntoCommandStream(stateBaseAddressHelperArgs, commandStream); 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 1e7ab44b31..16478b3894 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 @@ -24,7 +24,6 @@ template void CommandQueueHw::programStateBaseAddress(uint64_t gsba, bool useLocalMemoryForIndirectHeap, NEO::LinearStream &commandStream, bool cachedMOCSAllowed) { using STATE_BASE_ADDRESS = typename GfxFamily::STATE_BASE_ADDRESS; NEO::Device *neoDevice = device->getNEODevice(); - auto &hwInfo = neoDevice->getHardwareInfo(); uint32_t rootDeviceIndex = neoDevice->getRootDeviceIndex(); bool multiOsContextCapable = device->isImplicitScalingCapable(); @@ -54,7 +53,6 @@ void CommandQueueHw::programStateBaseAddress(uint64_t gsba, bool nullptr, // ioh nullptr, // ssh neoDevice->getGmmHelper(), // gmmHelper - &hwInfo, // hwInfo (device->getMOCS(cachedMOCSAllowed, false) >> 1), // statelessMocsIndex NEO::MemoryCompressionState::NotApplicable, // memoryCompressionState true, // setInstructionStateBaseAddress @@ -64,7 +62,8 @@ void CommandQueueHw::programStateBaseAddress(uint64_t gsba, bool false, // useGlobalAtomics false, // areMultipleSubDevicesInContext false, // overrideSurfaceStateBaseAddress - isDebuggerActive // isDebuggerActive + isDebuggerActive, // isDebuggerActive + this->doubleSbaWa // doubleSbaWa }; NEO::StateBaseAddressHelper::programStateBaseAddressIntoCommandStream(stateBaseAddressHelperArgs, commandStream); @@ -87,16 +86,12 @@ template size_t CommandQueueHw::estimateStateBaseAddressCmdSize() { using STATE_BASE_ADDRESS = typename GfxFamily::STATE_BASE_ADDRESS; using _3DSTATE_BINDING_TABLE_POOL_ALLOC = typename GfxFamily::_3DSTATE_BINDING_TABLE_POOL_ALLOC; - - NEO::Device *neoDevice = device->getNEODevice(); - auto &hwInfo = neoDevice->getHardwareInfo(); - auto &productHelper = neoDevice->getProductHelper(); size_t size = 0; if (NEO::ApiSpecificConfig::getBindlessConfiguration()) { size += sizeof(STATE_BASE_ADDRESS) + NEO::MemorySynchronizationCommands::getSizeForSingleBarrier(false) + sizeof(_3DSTATE_BINDING_TABLE_POOL_ALLOC); - if (productHelper.isAdditionalStateBaseAddressWARequired(hwInfo)) { + if (this->doubleSbaWa) { size += sizeof(STATE_BASE_ADDRESS); } } diff --git a/level_zero/core/test/unit_tests/mocks/mock_cmdlist.h b/level_zero/core/test/unit_tests/mocks/mock_cmdlist.h index dfc3c07c5e..97fc8707d9 100644 --- a/level_zero/core/test/unit_tests/mocks/mock_cmdlist.h +++ b/level_zero/core/test/unit_tests/mocks/mock_cmdlist.h @@ -52,6 +52,7 @@ struct WhiteBox<::L0::CommandListCoreFamily> using BaseClass::containsAnyKernel; using BaseClass::containsCooperativeKernelsFlag; using BaseClass::csr; + using BaseClass::doubleSbaWa; using BaseClass::engineGroupType; using BaseClass::estimateBufferSizeMultiTileBarrier; using BaseClass::finalStreamState; @@ -137,6 +138,7 @@ struct WhiteBox> using BaseClass::commandsToPatch; using BaseClass::compactL3FlushEventPacket; using BaseClass::csr; + using BaseClass::doubleSbaWa; using BaseClass::finalStreamState; using BaseClass::frontEndStateTracking; using BaseClass::getDcFlushRequired; @@ -175,6 +177,7 @@ struct WhiteBox<::L0::CommandList> : public ::L0::CommandListImp { using BaseClass::commandContainer; using BaseClass::commandListPreemptionMode; using BaseClass::csr; + using BaseClass::doubleSbaWa; using BaseClass::finalStreamState; using BaseClass::frontEndStateTracking; using BaseClass::getDcFlushRequired; diff --git a/level_zero/core/test/unit_tests/mocks/mock_cmdqueue.h b/level_zero/core/test/unit_tests/mocks/mock_cmdqueue.h index 654074f594..9e5ad05b18 100644 --- a/level_zero/core/test/unit_tests/mocks/mock_cmdqueue.h +++ b/level_zero/core/test/unit_tests/mocks/mock_cmdqueue.h @@ -33,6 +33,7 @@ struct WhiteBox<::L0::CommandQueue> : public ::L0::CommandQueueImp { using BaseClass::synchronizeByPollingForTaskCount; using BaseClass::taskCount; using CommandQueue::activeSubDevices; + using CommandQueue::doubleSbaWa; using CommandQueue::frontEndStateTracking; using CommandQueue::internalUsage; using CommandQueue::partitionCount; @@ -67,6 +68,7 @@ struct MockCommandQueueHw : public L0::CommandQueueHw { using BaseClass::prepareAndSubmitBatchBuffer; using BaseClass::printfKernelContainer; using L0::CommandQueue::activeSubDevices; + using L0::CommandQueue::doubleSbaWa; using L0::CommandQueue::frontEndStateTracking; using L0::CommandQueue::internalUsage; using L0::CommandQueue::partitionCount; diff --git a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_1.cpp b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_1.cpp index 2c152d5a49..8abc0df661 100644 --- a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_1.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_1.cpp @@ -2376,7 +2376,10 @@ HWTEST2_F(CommandListCreate, givenNullEventWhenAppendEventAfterWalkerThenNothing } TEST_F(CommandListCreate, givenCreatedCommandListWhenGettingTrackingFlagsThenDefaultValuseIsHwSupported) { - auto &l0GfxCoreHelper = device->getNEODevice()->getRootDeviceEnvironment().getHelper(); + auto &rootDeviceEnvironment = device->getNEODevice()->getRootDeviceEnvironment(); + + auto &l0GfxCoreHelper = rootDeviceEnvironment.getHelper(); + auto &productHelper = rootDeviceEnvironment.getHelper(); ze_result_t returnValue; std::unique_ptr commandList(whiteboxCast(CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, returnValue))); @@ -2393,6 +2396,9 @@ TEST_F(CommandListCreate, givenCreatedCommandListWhenGettingTrackingFlagsThenDef bool expectedStateBaseAddressTracking = l0GfxCoreHelper.platformSupportsStateBaseAddressTracking(); EXPECT_EQ(expectedStateBaseAddressTracking, commandList->stateBaseAddressTracking); + + bool expectedDoubleSbaWa = productHelper.isAdditionalStateBaseAddressWARequired(device->getHwInfo()); + EXPECT_EQ(expectedDoubleSbaWa, commandList->doubleSbaWa); } } // namespace ult diff --git a/level_zero/core/test/unit_tests/sources/cmdqueue/test_cmdqueue_1.cpp b/level_zero/core/test/unit_tests/sources/cmdqueue/test_cmdqueue_1.cpp index a60078205b..6c1db7853b 100644 --- a/level_zero/core/test/unit_tests/sources/cmdqueue/test_cmdqueue_1.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdqueue/test_cmdqueue_1.cpp @@ -1974,7 +1974,11 @@ TEST_F(CommandQueueCreate, givenOverrideCmdQueueSyncModeToSynchronousWhenCommand } TEST_F(CommandQueueCreate, givenCreatedCommandQueueWhenGettingTrackingFlagsThenDefaultValuseIsHwSupported) { - auto &l0GfxCoreHelper = device->getNEODevice()->getRootDeviceEnvironment().getHelper(); + auto &rootDeviceEnvironment = device->getNEODevice()->getRootDeviceEnvironment(); + + auto &l0GfxCoreHelper = rootDeviceEnvironment.getHelper(); + auto &productHelper = rootDeviceEnvironment.getHelper(); + const ze_command_queue_desc_t desc{}; ze_result_t returnValue; auto commandQueue = whiteboxCast(CommandQueue::create(productFamily, @@ -2000,6 +2004,9 @@ TEST_F(CommandQueueCreate, givenCreatedCommandQueueWhenGettingTrackingFlagsThenD bool expectedStateBaseAddressTracking = l0GfxCoreHelper.platformSupportsStateBaseAddressTracking(); EXPECT_EQ(expectedStateBaseAddressTracking, commandQueue->stateBaseAddressTracking); + bool expectedDoubleSbaWa = productHelper.isAdditionalStateBaseAddressWARequired(device->getHwInfo()); + EXPECT_EQ(expectedDoubleSbaWa, commandQueue->doubleSbaWa); + commandQueue->destroy(); } diff --git a/opencl/test/unit_test/xe_hpg_core/dg2/test_cmds_programming_dg2.cpp b/opencl/test/unit_test/xe_hpg_core/dg2/test_cmds_programming_dg2.cpp index b9bf21d0bb..d39f4db7ae 100644 --- a/opencl/test/unit_test/xe_hpg_core/dg2/test_cmds_programming_dg2.cpp +++ b/opencl/test/unit_test/xe_hpg_core/dg2/test_cmds_programming_dg2.cpp @@ -161,6 +161,8 @@ DG2TEST_F(CmdsProgrammingTestsDg2, givenDG2WithBSteppingWhenFlushingTaskThenAddi hwInfo.platform.usRevId = productHelper.getHwRevIdFromStepping(REVISION_B, hwInfo); auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver(); + commandStreamReceiver.doubleSbaWa = productHelper.isAdditionalStateBaseAddressWARequired(hwInfo); + flushTask(commandStreamReceiver); EXPECT_GT(commandStreamReceiver.commandStream.getUsed(), 0u); diff --git a/shared/source/command_container/cmdcontainer.h b/shared/source/command_container/cmdcontainer.h index cbf0f19597..31c0162719 100644 --- a/shared/source/command_container/cmdcontainer.h +++ b/shared/source/command_container/cmdcontainer.h @@ -165,6 +165,7 @@ class CommandContainer : public NonCopyableOrMovableClass { bool lastPipelineSelectModeRequired = false; bool lastSentUseGlobalAtomics = false; bool systolicModeSupport = false; + bool doubleSbaWa = false; protected: size_t getTotalCmdBufferSize(); diff --git a/shared/source/command_container/command_encoder.h b/shared/source/command_container/command_encoder.h index 5ea0e85919..2a03749145 100644 --- a/shared/source/command_container/command_encoder.h +++ b/shared/source/command_container/command_encoder.h @@ -318,6 +318,7 @@ struct EncodeStateBaseAddressArgs { bool useGlobalAtomics = false; bool multiOsContextCapable = false; bool isRcs = false; + bool doubleSbaWa = false; }; template diff --git a/shared/source/command_container/command_encoder_bdw_and_later.inl b/shared/source/command_container/command_encoder_bdw_and_later.inl index 2c07585564..32343d73d4 100644 --- a/shared/source/command_container/command_encoder_bdw_and_later.inl +++ b/shared/source/command_container/command_encoder_bdw_and_later.inl @@ -208,13 +208,14 @@ void EncodeDispatchKernel::encode(CommandContainer &container, EncodeDis args.requiresUncachedMocs ? (gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED) >> 1) : (gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER) >> 1); EncodeStateBaseAddressArgs encodeStateBaseAddressArgs = { - &container, // container - sba, // sbaCmd - nullptr, // sbaProperties - statelessMocsIndex, // statelessMocsIndex - false, // useGlobalAtomics - false, // multiOsContextCapable - args.isRcs}; // isRcs + &container, // container + sba, // sbaCmd + nullptr, // sbaProperties + statelessMocsIndex, // statelessMocsIndex + false, // useGlobalAtomics + false, // multiOsContextCapable + args.isRcs, // isRcs + container.doubleSbaWa}; // doubleSbaWa EncodeStateBaseAddress::encode(encodeStateBaseAddressArgs); container.setDirtyStateForAllHeaps(false); args.requiresUncachedMocs = false; @@ -419,7 +420,6 @@ void EncodeStateBaseAddress::setSbaAddressesForDebugger(NEO::Debugger::S template void EncodeStateBaseAddress::encode(EncodeStateBaseAddressArgs &args) { auto &device = *args.container->getDevice(); - auto &hwInfo = device.getHardwareInfo(); if (args.container->isAnyHeapDirty()) { EncodeWA::encodeAdditionalPipelineSelect(*args.container->getCommandStream(), {}, true, device.getRootDeviceEnvironment(), args.isRcs); @@ -444,7 +444,6 @@ void EncodeStateBaseAddress::encode(EncodeStateBaseAddressArgs & ioh, // ioh ssh, // ssh gmmHelper, // gmmHelper - &hwInfo, // hwInfo args.statelessMocsIndex, // statelessMocsIndex NEO::MemoryCompressionState::NotApplicable, // memoryCompressionState false, // setInstructionStateBaseAddress @@ -454,7 +453,8 @@ void EncodeStateBaseAddress::encode(EncodeStateBaseAddressArgs & args.useGlobalAtomics, // useGlobalAtomics false, // areMultipleSubDevicesInContext false, // overrideSurfaceStateBaseAddress - isDebuggerActive // isDebuggerActive + isDebuggerActive, // isDebuggerActive + args.doubleSbaWa // doubleSbaWa }; StateBaseAddressHelper::programStateBaseAddressIntoCommandStream(stateBaseAddressHelperArgs, diff --git a/shared/source/command_container/command_encoder_xehp_and_later.inl b/shared/source/command_container/command_encoder_xehp_and_later.inl index 08e065ffa3..a4eaaaf078 100644 --- a/shared/source/command_container/command_encoder_xehp_and_later.inl +++ b/shared/source/command_container/command_encoder_xehp_and_later.inl @@ -238,7 +238,8 @@ void EncodeDispatchKernel::encode(CommandContainer &container, EncodeDis statelessMocsIndex, // statelessMocsIndex args.useGlobalAtomics, // useGlobalAtomics args.partitionCount > 1, // multiOsContextCapable - args.isRcs}; // isRcs + args.isRcs, // isRcs + container.doubleSbaWa}; // doubleSbaWa EncodeStateBaseAddress::encode(encodeStateBaseAddressArgs); container.setDirtyStateForAllHeaps(false); } @@ -541,7 +542,6 @@ void EncodeStateBaseAddress::encode(EncodeStateBaseAddressArgs & ioh, // ioh ssh, // ssh gmmHelper, // gmmHelper - &args.container->getDevice()->getHardwareInfo(), // hwInfo args.statelessMocsIndex, // statelessMocsIndex NEO::MemoryCompressionState::NotApplicable, // memoryCompressionState true, // setInstructionStateBaseAddress @@ -551,7 +551,8 @@ void EncodeStateBaseAddress::encode(EncodeStateBaseAddressArgs & args.useGlobalAtomics, // useGlobalAtomics false, // areMultipleSubDevicesInContext false, // overrideSurfaceStateBaseAddress - isDebuggerActive // isDebuggerActive + isDebuggerActive, // isDebuggerActive + args.doubleSbaWa // doubleSbaWa }; StateBaseAddressHelper::programStateBaseAddressIntoCommandStream(stateBaseAddressHelperArgs, diff --git a/shared/source/command_stream/command_stream_receiver.cpp b/shared/source/command_stream/command_stream_receiver.cpp index 4ac5d304a8..2a3f692f25 100644 --- a/shared/source/command_stream/command_stream_receiver.cpp +++ b/shared/source/command_stream/command_stream_receiver.cpp @@ -93,6 +93,7 @@ CommandStreamReceiver::CommandStreamReceiver(ExecutionEnvironment &executionEnvi productHelper.fillFrontEndPropertiesSupportStructure(feSupportFlags, hwInfo); productHelper.fillPipelineSelectPropertiesSupportStructure(pipelineSupportFlags, hwInfo); productHelper.fillStateBaseAddressPropertiesSupportStructure(sbaSupportFlags); + this->doubleSbaWa = productHelper.isAdditionalStateBaseAddressWARequired(hwInfo); } CommandStreamReceiver::~CommandStreamReceiver() { diff --git a/shared/source/command_stream/command_stream_receiver.h b/shared/source/command_stream/command_stream_receiver.h index e6e81f5720..23226b3346 100644 --- a/shared/source/command_stream/command_stream_receiver.h +++ b/shared/source/command_stream/command_stream_receiver.h @@ -516,6 +516,7 @@ class CommandStreamReceiver { bool dcFlushSupport = false; bool forceSkipResourceCleanupRequired = false; volatile bool resourcesInitialized = false; + bool doubleSbaWa = false; }; typedef CommandStreamReceiver *(*CommandStreamReceiverCreateFunc)(bool withAubDump, 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 2067b116bd..ce86ce2f07 100644 --- a/shared/source/command_stream/command_stream_receiver_hw_base.inl +++ b/shared/source/command_stream/command_stream_receiver_hw_base.inl @@ -507,28 +507,28 @@ CompletionStamp CommandStreamReceiverHw::flushTask( STATE_BASE_ADDRESS stateBaseAddressCmd; StateBaseAddressHelperArgs args = { - newGshBase, // generalStateBaseAddress - indirectObjectStateBaseAddress, // indirectObjectHeapBaseAddress - instructionHeapBaseAddress, // instructionHeapBaseAddress - 0, // globalHeapsBaseAddress - 0, // surfaceStateBaseAddress - &stateBaseAddressCmd, // stateBaseAddressCmd - nullptr, // sbaProperties - dsh, // dsh - ioh, // ioh - ssh, // ssh - device.getGmmHelper(), // gmmHelper - &hwInfo, // hwInfo - this->latestSentStatelessMocsConfig, // statelessMocsIndex - this->lastMemoryCompressionState, // memoryCompressionState - true, // setInstructionStateBaseAddress - true, // setGeneralStateBaseAddress - false, // useGlobalHeapsBaseAddress - isMultiOsContextCapable(), // isMultiOsContextCapable - this->lastSentUseGlobalAtomics, // useGlobalAtomics - dispatchFlags.areMultipleSubDevicesInContext, // areMultipleSubDevicesInContext - false, // overrideSurfaceStateBaseAddress - debuggingEnabled || device.isDebuggerActive() // isDebuggerActive + newGshBase, // generalStateBaseAddress + indirectObjectStateBaseAddress, // indirectObjectHeapBaseAddress + instructionHeapBaseAddress, // instructionHeapBaseAddress + 0, // globalHeapsBaseAddress + 0, // surfaceStateBaseAddress + &stateBaseAddressCmd, // stateBaseAddressCmd + nullptr, // sbaProperties + dsh, // dsh + ioh, // ioh + ssh, // ssh + device.getGmmHelper(), // gmmHelper + this->latestSentStatelessMocsConfig, // statelessMocsIndex + this->lastMemoryCompressionState, // memoryCompressionState + true, // setInstructionStateBaseAddress + true, // setGeneralStateBaseAddress + false, // useGlobalHeapsBaseAddress + isMultiOsContextCapable(), // isMultiOsContextCapable + this->lastSentUseGlobalAtomics, // useGlobalAtomics + dispatchFlags.areMultipleSubDevicesInContext, // areMultipleSubDevicesInContext + false, // overrideSurfaceStateBaseAddress + debuggingEnabled || device.isDebuggerActive(), // isDebuggerActive + this->doubleSbaWa // doubleSbaWa }; StateBaseAddressHelper::programStateBaseAddressIntoCommandStream(args, commandStreamCSR); 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 3fb96d983f..7c18511816 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 @@ -31,9 +31,7 @@ size_t CommandStreamReceiverHw::getRequiredStateBaseAddressSize(const size += sizeof(typename GfxFamily::_3DSTATE_BINDING_TABLE_POOL_ALLOC); size += MemorySynchronizationCommands::getSizeForSingleBarrier(false); - auto &hwInfo = *device.getRootDeviceEnvironment().getHardwareInfo(); - auto &productHelper = getProductHelper(); - if (productHelper.isAdditionalStateBaseAddressWARequired(hwInfo)) { + if (this->doubleSbaWa) { size += sizeof(typename GfxFamily::STATE_BASE_ADDRESS); } diff --git a/shared/source/helpers/state_base_address.h b/shared/source/helpers/state_base_address.h index 626d75a0c2..81b48590d7 100644 --- a/shared/source/helpers/state_base_address.h +++ b/shared/source/helpers/state_base_address.h @@ -39,7 +39,6 @@ struct StateBaseAddressHelperArgs { const IndirectHeap *ioh = nullptr; const IndirectHeap *ssh = nullptr; GmmHelper *gmmHelper = nullptr; - const HardwareInfo *hwInfo = nullptr; uint32_t statelessMocsIndex = 0; MemoryCompressionState memoryCompressionState; @@ -52,6 +51,7 @@ struct StateBaseAddressHelperArgs { bool areMultipleSubDevicesInContext = false; bool overrideSurfaceStateBaseAddress = false; bool isDebuggerActive = false; + bool doubleSbaWa = false; }; template diff --git a/shared/source/helpers/state_base_address_base.inl b/shared/source/helpers/state_base_address_base.inl index b2da084aab..236e46a429 100644 --- a/shared/source/helpers/state_base_address_base.inl +++ b/shared/source/helpers/state_base_address_base.inl @@ -24,8 +24,7 @@ void StateBaseAddressHelper::programStateBaseAddressIntoCommandStream auto cmdSpace = StateBaseAddressHelper::getSpaceForSbaCmd(commandStream); *cmdSpace = *args.stateBaseAddressCmd; - auto &productHelper = args.gmmHelper->getRootDeviceEnvironment().template getHelper(); - if (productHelper.isAdditionalStateBaseAddressWARequired(*args.hwInfo)) { + if (args.doubleSbaWa) { auto cmdSpace = StateBaseAddressHelper::getSpaceForSbaCmd(commandStream); *cmdSpace = *args.stateBaseAddressCmd; } diff --git a/shared/test/common/libult/ult_command_stream_receiver.h b/shared/test/common/libult/ult_command_stream_receiver.h index b7c46553b6..a3c700df9d 100644 --- a/shared/test/common/libult/ult_command_stream_receiver.h +++ b/shared/test/common/libult/ult_command_stream_receiver.h @@ -82,6 +82,7 @@ class UltCommandStreamReceiver : public CommandStreamReceiverHw, publ using BaseClass::CommandStreamReceiver::debugPauseStateAddress; using BaseClass::CommandStreamReceiver::deviceBitfield; using BaseClass::CommandStreamReceiver::dispatchMode; + using BaseClass::CommandStreamReceiver::doubleSbaWa; using BaseClass::CommandStreamReceiver::downloadAllocationImpl; using BaseClass::CommandStreamReceiver::executionEnvironment; using BaseClass::CommandStreamReceiver::experimentalCmdBuffer; diff --git a/shared/test/unit_test/fixtures/command_container_fixture.cpp b/shared/test/unit_test/fixtures/command_container_fixture.cpp index c0c443e260..2005142a04 100644 --- a/shared/test/unit_test/fixtures/command_container_fixture.cpp +++ b/shared/test/unit_test/fixtures/command_container_fixture.cpp @@ -20,6 +20,7 @@ void CommandEncodeStatesFixture::setUp() { const auto &hwInfo = pDevice->getHardwareInfo(); auto &productHelper = pDevice->getProductHelper(); cmdContainer->systolicModeSupport = productHelper.isSystolicModeConfigurable(hwInfo); + cmdContainer->doubleSbaWa = productHelper.isAdditionalStateBaseAddressWARequired(hwInfo); } void CommandEncodeStatesFixture::tearDown() { diff --git a/shared/test/unit_test/fixtures/command_container_fixture.h b/shared/test/unit_test/fixtures/command_container_fixture.h index 554c0684ee..0b0978e485 100644 --- a/shared/test/unit_test/fixtures/command_container_fixture.h +++ b/shared/test/unit_test/fixtures/command_container_fixture.h @@ -41,13 +41,14 @@ class CommandEncodeStatesFixture : public DeviceFixture { typename FamilyType::STATE_BASE_ADDRESS &sbaCmd, uint32_t statelessMocs) { EncodeStateBaseAddressArgs args = { - container, // container - sbaCmd, // sbaCmd - nullptr, // sbaProperties - statelessMocs, // statelessMocsIndex - false, // useGlobalAtomics - false, // multiOsContextCapable - false}; // isRcs + container, // container + sbaCmd, // sbaCmd + nullptr, // sbaProperties + statelessMocs, // statelessMocsIndex + false, // useGlobalAtomics + false, // multiOsContextCapable + false, // isRcs + container->doubleSbaWa}; // doubleSbaWa return args; } diff --git a/shared/test/unit_test/helpers/state_base_address_tests.h b/shared/test/unit_test/helpers/state_base_address_tests.h index 835bc47244..fa0d6b81dd 100644 --- a/shared/test/unit_test/helpers/state_base_address_tests.h +++ b/shared/test/unit_test/helpers/state_base_address_tests.h @@ -30,7 +30,6 @@ StateBaseAddressHelperArgs createSbaHelperArgs(typename FamilyType:: ioh, // ioh ssh, // ssh gmmHelper, // gmmHelper - nullptr, // hwInfo 0, // statelessMocsIndex MemoryCompressionState::NotApplicable, // memoryCompressionState false, // setInstructionStateBaseAddress @@ -39,7 +38,8 @@ StateBaseAddressHelperArgs createSbaHelperArgs(typename FamilyType:: false, // isMultiOsContextCapable false, // useGlobalAtomics false, // areMultipleSubDevicesInContext - false // overrideSurfaceStateBaseAddress + false, // overrideSurfaceStateBaseAddress + false // doubleSbaWa }; return sbaArgs; }