diff --git a/level_zero/core/source/cmdqueue/cmdqueue_hw.h b/level_zero/core/source/cmdqueue/cmdqueue_hw.h index ae705071d4..fcea41e0b1 100644 --- a/level_zero/core/source/cmdqueue/cmdqueue_hw.h +++ b/level_zero/core/source/cmdqueue/cmdqueue_hw.h @@ -167,7 +167,6 @@ struct CommandQueueHw : public CommandQueueImp { inline void dispatchTaskCountPostSyncByMiFlushDw(bool isDispatchTaskCountPostSyncRequired, NEO::LinearStream &commandStream); NEO::SubmissionStatus prepareAndSubmitBatchBuffer(CommandListExecutionContext &ctx, NEO::LinearStream &innerCommandStream); - inline bool isCleanLeftoverMemoryRequired(); inline void cleanLeftoverMemory(NEO::LinearStream &outerCommandStream, NEO::LinearStream &innerCommandStream); inline void updateTaskCountAndPostSync(bool isDispatchTaskCountPostSyncRequired); inline ze_result_t waitForCommandQueueCompletionAndCleanHeapContainer(); diff --git a/level_zero/core/source/cmdqueue/cmdqueue_hw.inl b/level_zero/core/source/cmdqueue/cmdqueue_hw.inl index c1a54c932e..eed1870bef 100644 --- a/level_zero/core/source/cmdqueue/cmdqueue_hw.inl +++ b/level_zero/core/source/cmdqueue/cmdqueue_hw.inl @@ -1046,7 +1046,7 @@ NEO::SubmissionStatus CommandQueueHw::prepareAndSubmitBatchBuffer *(MI_BATCH_BUFFER_END *)buffer = GfxFamily::cmdInitBatchBufferEnd; } - if (ctx.isNEODebuggerActive(this->device) || NEO::DebugManager.flags.EnableSWTags.get() || isCleanLeftoverMemoryRequired()) { + if (ctx.isNEODebuggerActive(this->device) || NEO::DebugManager.flags.EnableSWTags.get() || csr->getLogicalStateHelper()) { cleanLeftoverMemory(outerCommandStream, innerCommandStream); } else if (this->alignedChildStreamPadding) { void *paddingPtr = innerCommandStream.getSpace(this->alignedChildStreamPadding); @@ -1226,9 +1226,4 @@ void CommandQueueHw::programRequiredStateComputeModeForCommandLis csrState.stateComputeMode.setProperties(cmdListFinal.stateComputeMode); } -template -bool CommandQueueHw::isCleanLeftoverMemoryRequired() { - return false; -} - } // namespace L0 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 776007006f..2db658e679 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 @@ -14,7 +14,6 @@ #include "shared/source/helpers/hw_helper.h" #include "shared/source/helpers/pipe_control_args.h" #include "shared/source/helpers/state_base_address.h" -#include "shared/source/helpers/state_base_address_xehp_and_later.inl" #include "shared/source/os_interface/hw_info_config.h" #include "level_zero/core/source/cmdqueue/cmdqueue_hw.h" 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 5dbd4d4b45..cb75154b27 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 @@ -60,7 +60,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, CommandListTests, whenCommandListIsCreatedThenPCAnd auto cmdSba = genCmdCast(*itor); - if constexpr (FamilyType::supportsSampler) { + if (device->getNEODevice()->getDeviceInfo().imageSupport) { auto dsh = commandContainer.getIndirectHeap(NEO::HeapType::DYNAMIC_STATE); EXPECT_TRUE(cmdSba->getDynamicStateBaseAddressModifyEnable()); EXPECT_TRUE(cmdSba->getDynamicStateBufferSizeModifyEnable()); @@ -129,7 +129,7 @@ HWTEST2_F(CommandListTests, whenCommandListIsCreatedAndProgramExtendedPipeContro ASSERT_NE(cmdList.end(), itor); auto cmdSba = genCmdCast(*itor); - if constexpr (FamilyType::supportsSampler) { + if (device->getNEODevice()->getDeviceInfo().imageSupport) { auto dsh = commandContainer.getIndirectHeap(NEO::HeapType::DYNAMIC_STATE); EXPECT_TRUE(cmdSba->getDynamicStateBaseAddressModifyEnable()); EXPECT_TRUE(cmdSba->getDynamicStateBufferSizeModifyEnable()); diff --git a/opencl/source/helpers/hardware_commands_helper_base.inl b/opencl/source/helpers/hardware_commands_helper_base.inl index 2a9e8d05bc..c78f38fd2c 100644 --- a/opencl/source/helpers/hardware_commands_helper_base.inl +++ b/opencl/source/helpers/hardware_commands_helper_base.inl @@ -152,7 +152,9 @@ size_t HardwareCommandsHelper::sendInterfaceDescriptorData( interfaceDescriptor.setBindingTablePointer(static_cast(bindingTablePointer)); if constexpr (GfxFamily::supportsSampler) { - interfaceDescriptor.setSamplerStatePointer(static_cast(offsetSamplerState)); + if (device.getDeviceInfo().imageSupport) { + interfaceDescriptor.setSamplerStatePointer(static_cast(offsetSamplerState)); + } } EncodeDispatchKernel::adjustBindingTablePrefetch(interfaceDescriptor, numSamplers, bindingTablePrefetchSize); diff --git a/opencl/test/unit_test/command_stream/command_stream_receiver_flush_task_gmock_tests.cpp b/opencl/test/unit_test/command_stream/command_stream_receiver_flush_task_gmock_tests.cpp index 3f41c76a4b..b91e58ace5 100644 --- a/opencl/test/unit_test/command_stream/command_stream_receiver_flush_task_gmock_tests.cpp +++ b/opencl/test/unit_test/command_stream/command_stream_receiver_flush_task_gmock_tests.cpp @@ -233,7 +233,7 @@ HWTEST2_F(CommandStreamReceiverFlushTaskGmockTests, givenMockCsrWhenCollectState uint64_t commandOffset = 0xa; uint64_t generalStateBase = 0xff; - mockCsr->collectStateBaseAddresPatchInfo(baseAddress, commandOffset, &dsh, &ioh, &ssh, generalStateBase); + mockCsr->collectStateBaseAddresPatchInfo(baseAddress, commandOffset, &dsh, &ioh, &ssh, generalStateBase, deviceUsesDsh); ASSERT_EQ(mockHelper->patchInfoDataVector.size(), expectedCallsCount); @@ -242,7 +242,7 @@ HWTEST2_F(CommandStreamReceiverFlushTaskGmockTests, givenMockCsrWhenCollectState EXPECT_EQ(patch.sourceAllocationOffset, 0u); } - //DSH + // DSH if (deviceUsesDsh) { PatchInfoData dshPatch = mockHelper->patchInfoDataVector[dshPatchIndex]; EXPECT_EQ(dshPatch.sourceAllocation, dsh.getGraphicsAllocation()->getGpuAddress()); @@ -250,19 +250,19 @@ HWTEST2_F(CommandStreamReceiverFlushTaskGmockTests, givenMockCsrWhenCollectState } if constexpr (TestTraits::iohInSbaSupported) { - //IOH + // IOH PatchInfoData iohPatch = mockHelper->patchInfoDataVector[iohPatchIndex]; EXPECT_EQ(iohPatch.sourceAllocation, ioh.getGraphicsAllocation()->getGpuAddress()); EXPECT_EQ(iohPatch.targetAllocationOffset, commandOffset + STATE_BASE_ADDRESS::PATCH_CONSTANTS::INDIRECTOBJECTBASEADDRESS_BYTEOFFSET); } - //SSH + // SSH PatchInfoData sshPatch = mockHelper->patchInfoDataVector[sshPatchIndex]; EXPECT_EQ(sshPatch.sourceAllocation, ssh.getGraphicsAllocation()->getGpuAddress()); EXPECT_EQ(sshPatch.targetAllocationOffset, commandOffset + STATE_BASE_ADDRESS::PATCH_CONSTANTS::SURFACESTATEBASEADDRESS_BYTEOFFSET); - //GSH + // GSH PatchInfoData gshPatch = mockHelper->patchInfoDataVector[gshPatchIndex]; EXPECT_EQ(gshPatch.sourceAllocation, generalStateBase); EXPECT_EQ(gshPatch.targetAllocationOffset, commandOffset + STATE_BASE_ADDRESS::PATCH_CONSTANTS::GENERALSTATEBASEADDRESS_BYTEOFFSET); 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 850f1541ba..9d93e02f0f 100644 --- a/shared/source/command_container/command_encoder_xehp_and_later.inl +++ b/shared/source/command_container/command_encoder_xehp_and_later.inl @@ -126,31 +126,33 @@ void EncodeDispatchKernel::encode(CommandContainer &container, EncodeDis PreemptionHelper::programInterfaceDescriptorDataPreemption(&idd, args.preemptionMode); - if constexpr (Family::supportsSampler) { - uint32_t samplerStateOffset = 0; - uint32_t samplerCount = 0; + uint32_t samplerCount = 0; - if (kernelDescriptor.payloadMappings.samplerTable.numSamplers > 0) { - auto heap = ApiSpecificConfig::getBindlessConfiguration() ? args.device->getBindlessHeapsHelper()->getHeap(BindlessHeapsHelper::GLOBAL_DSH) : container.getIndirectHeap(HeapType::DYNAMIC_STATE); - UNRECOVERABLE_IF(!heap); + if (args.device->getDeviceInfo().imageSupport) { + if constexpr (Family::supportsSampler) { + uint32_t samplerStateOffset = 0; - samplerCount = kernelDescriptor.payloadMappings.samplerTable.numSamplers; - samplerStateOffset = EncodeStates::copySamplerState( - heap, kernelDescriptor.payloadMappings.samplerTable.tableOffset, - kernelDescriptor.payloadMappings.samplerTable.numSamplers, kernelDescriptor.payloadMappings.samplerTable.borderColor, - args.dispatchInterface->getDynamicStateHeapData(), - args.device->getBindlessHeapsHelper(), hwInfo); - if (ApiSpecificConfig::getBindlessConfiguration()) { - container.getResidencyContainer().push_back(args.device->getBindlessHeapsHelper()->getHeap(NEO::BindlessHeapsHelper::BindlesHeapType::GLOBAL_DSH)->getGraphicsAllocation()); + if (kernelDescriptor.payloadMappings.samplerTable.numSamplers > 0) { + auto heap = ApiSpecificConfig::getBindlessConfiguration() ? args.device->getBindlessHeapsHelper()->getHeap(BindlessHeapsHelper::GLOBAL_DSH) : container.getIndirectHeap(HeapType::DYNAMIC_STATE); + UNRECOVERABLE_IF(!heap); + + samplerCount = kernelDescriptor.payloadMappings.samplerTable.numSamplers; + samplerStateOffset = EncodeStates::copySamplerState( + heap, kernelDescriptor.payloadMappings.samplerTable.tableOffset, + kernelDescriptor.payloadMappings.samplerTable.numSamplers, kernelDescriptor.payloadMappings.samplerTable.borderColor, + args.dispatchInterface->getDynamicStateHeapData(), + args.device->getBindlessHeapsHelper(), hwInfo); + if (ApiSpecificConfig::getBindlessConfiguration()) { + container.getResidencyContainer().push_back(args.device->getBindlessHeapsHelper()->getHeap(NEO::BindlessHeapsHelper::BindlesHeapType::GLOBAL_DSH)->getGraphicsAllocation()); + } } - } - idd.setSamplerStatePointer(samplerStateOffset); - EncodeDispatchKernel::adjustBindingTablePrefetch(idd, samplerCount, bindingTableStateCount); - } else { - EncodeDispatchKernel::adjustBindingTablePrefetch(idd, 0u, bindingTableStateCount); + idd.setSamplerStatePointer(samplerStateOffset); + } } + EncodeDispatchKernel::adjustBindingTablePrefetch(idd, samplerCount, bindingTableStateCount); + uint64_t offsetThreadData = 0u; const uint32_t inlineDataSize = sizeof(INLINE_DATA); auto crossThreadData = args.dispatchInterface->getCrossThreadData(); diff --git a/shared/source/command_stream/command_stream_receiver_hw.h b/shared/source/command_stream/command_stream_receiver_hw.h index afc6dc7df0..f58087f669 100644 --- a/shared/source/command_stream/command_stream_receiver_hw.h +++ b/shared/source/command_stream/command_stream_receiver_hw.h @@ -86,7 +86,8 @@ class CommandStreamReceiverHw : public CommandStreamReceiver { const LinearStream *dsh, const LinearStream *ioh, const LinearStream *ssh, - uint64_t generalStateBase); + uint64_t generalStateBase, + bool imagesSupported); void collectStateBaseAddresIohPatchInfo(uint64_t commandBufferAddress, uint64_t commandOffset, const LinearStream &ioh); 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 5bc91b34c3..dbc2be35d8 100644 --- a/shared/source/command_stream/command_stream_receiver_hw_base.inl +++ b/shared/source/command_stream/command_stream_receiver_hw_base.inl @@ -444,7 +444,8 @@ CompletionStamp CommandStreamReceiverHw::flushTask( EncodeWA::encodeAdditionalPipelineSelect(commandStreamCSR, dispatchFlags.pipelineSelectArgs, false, hwInfo, isRcs()); if (DebugManager.flags.AddPatchInfoCommentsForAUBDump.get()) { - collectStateBaseAddresPatchInfo(commandStream.getGraphicsAllocation()->getGpuAddress(), stateBaseAddressCmdOffset, dsh, ioh, ssh, newGSHbase); + collectStateBaseAddresPatchInfo(commandStream.getGraphicsAllocation()->getGpuAddress(), stateBaseAddressCmdOffset, dsh, ioh, ssh, newGSHbase, + device.getDeviceInfo().imageSupport); } } @@ -998,10 +999,11 @@ void CommandStreamReceiverHw::collectStateBaseAddresPatchInfo( const LinearStream *dsh, const LinearStream *ioh, const LinearStream *ssh, - uint64_t generalStateBase) { + uint64_t generalStateBase, + bool imagesSupported) { typedef typename GfxFamily::STATE_BASE_ADDRESS STATE_BASE_ADDRESS; - if constexpr (GfxFamily::supportsSampler) { + if (imagesSupported) { PatchInfoData dynamicStatePatchInfo = {dsh->getGraphicsAllocation()->getGpuAddress(), 0u, PatchInfoAllocationType::DynamicStateHeap, baseAddress, commandOffset + STATE_BASE_ADDRESS::PATCH_CONSTANTS::DYNAMICSTATEBASEADDRESS_BYTEOFFSET, PatchInfoAllocationType::Default}; flatBatchBufferHelper->setPatchInfoData(dynamicStatePatchInfo); } diff --git a/shared/test/unit_test/encoders/test_encode_dispatch_kernel_xehp_and_later.cpp b/shared/test/unit_test/encoders/test_encode_dispatch_kernel_xehp_and_later.cpp index 6ef619e765..26b3fa4347 100644 --- a/shared/test/unit_test/encoders/test_encode_dispatch_kernel_xehp_and_later.cpp +++ b/shared/test/unit_test/encoders/test_encode_dispatch_kernel_xehp_and_later.cpp @@ -251,6 +251,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, CommandEncodeStatesTest, giveNumBindingTableZeroWhe EXPECT_EQ(idd.getBindingTablePointer(), 0u); } + struct SamplerSupportedMatcher { template static constexpr bool isMatched() { @@ -265,6 +266,11 @@ HWTEST2_F(CommandEncodeStatesTest, giveNumSamplersOneWhenDispatchKernelThensampl using SAMPLER_STATE = typename FamilyType::SAMPLER_STATE; using INTERFACE_DESCRIPTOR_DATA = typename FamilyType::INTERFACE_DESCRIPTOR_DATA; using WALKER_TYPE = typename FamilyType::WALKER_TYPE; + + if (!pDevice->getDeviceInfo().imageSupport) { + GTEST_SKIP(); + } + uint32_t numSamplers = 1; SAMPLER_STATE samplerState; memset(&samplerState, 2, sizeof(SAMPLER_STATE)); @@ -421,10 +427,12 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, CommandEncodeStatesTest, givenForceBtpPrefetchModeD } if constexpr (FamilyType::supportsSampler) { - if (EncodeSurfaceState::doBindingTablePrefetch()) { - EXPECT_NE(INTERFACE_DESCRIPTOR_DATA::SAMPLER_COUNT_NO_SAMPLERS_USED, idd.getSamplerCount()); - } else { - EXPECT_EQ(INTERFACE_DESCRIPTOR_DATA::SAMPLER_COUNT_NO_SAMPLERS_USED, idd.getSamplerCount()); + if (pDevice->getDeviceInfo().imageSupport) { + if (EncodeSurfaceState::doBindingTablePrefetch()) { + EXPECT_NE(INTERFACE_DESCRIPTOR_DATA::SAMPLER_COUNT_NO_SAMPLERS_USED, idd.getSamplerCount()); + } else { + EXPECT_EQ(INTERFACE_DESCRIPTOR_DATA::SAMPLER_COUNT_NO_SAMPLERS_USED, idd.getSamplerCount()); + } } } } @@ -447,7 +455,9 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, CommandEncodeStatesTest, givenForceBtpPrefetchModeD EXPECT_EQ(0u, idd.getBindingTableEntryCount()); if constexpr (FamilyType::supportsSampler) { - EXPECT_EQ(INTERFACE_DESCRIPTOR_DATA::SAMPLER_COUNT_NO_SAMPLERS_USED, idd.getSamplerCount()); + if (pDevice->getDeviceInfo().imageSupport) { + EXPECT_EQ(INTERFACE_DESCRIPTOR_DATA::SAMPLER_COUNT_NO_SAMPLERS_USED, idd.getSamplerCount()); + } } } @@ -469,7 +479,9 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, CommandEncodeStatesTest, givenForceBtpPrefetchModeD EXPECT_NE(0u, idd.getBindingTableEntryCount()); if constexpr (FamilyType::supportsSampler) { - EXPECT_NE(INTERFACE_DESCRIPTOR_DATA::SAMPLER_COUNT_NO_SAMPLERS_USED, idd.getSamplerCount()); + if (pDevice->getDeviceInfo().imageSupport) { + EXPECT_NE(INTERFACE_DESCRIPTOR_DATA::SAMPLER_COUNT_NO_SAMPLERS_USED, idd.getSamplerCount()); + } } } } diff --git a/shared/test/unit_test/encoders/test_encode_states.cpp b/shared/test/unit_test/encoders/test_encode_states.cpp index bcefd7d3e2..399d5cb803 100644 --- a/shared/test/unit_test/encoders/test_encode_states.cpp +++ b/shared/test/unit_test/encoders/test_encode_states.cpp @@ -316,7 +316,7 @@ HWTEST2_F(CommandEncodeStatesTest, givenCommandContainerWithDirtyHeapsWhenSetSta auto itorCmd = find(commands.begin(), commands.end()); auto pCmd = genCmdCast(*itorCmd); - if constexpr (FamilyType::supportsSampler) { + if (pDevice->getDeviceInfo().imageSupport) { EXPECT_EQ(dsh->getHeapGpuBase(), pCmd->getDynamicStateBaseAddress()); } else { EXPECT_EQ(dsh, nullptr); @@ -356,7 +356,7 @@ HWTEST_F(CommandEncodeStatesTest, givenCommandContainerWhenSetStateBaseAddressCa ASSERT_NE(itorCmd, commands.end()); auto cmd = genCmdCast(*itorCmd); - if constexpr (FamilyType::supportsSampler) { + if (pDevice->getDeviceInfo().imageSupport) { EXPECT_NE(dsh->getHeapGpuBase(), cmd->getDynamicStateBaseAddress()); } else { EXPECT_EQ(dsh, nullptr);