Remove isCleanLeftoverMemoryRequired() + refactor sampler support path

Signed-off-by: Dunajski, Bartosz <bartosz.dunajski@intel.com>
This commit is contained in:
Dunajski, Bartosz 2022-09-30 13:20:48 +00:00 committed by Compute-Runtime-Automation
parent 6073702941
commit 52b63be026
11 changed files with 59 additions and 47 deletions

View File

@ -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();

View File

@ -1046,7 +1046,7 @@ NEO::SubmissionStatus CommandQueueHw<gfxCoreFamily>::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<gfxCoreFamily>::programRequiredStateComputeModeForCommandLis
csrState.stateComputeMode.setProperties(cmdListFinal.stateComputeMode);
}
template <GFXCORE_FAMILY gfxCoreFamily>
bool CommandQueueHw<gfxCoreFamily>::isCleanLeftoverMemoryRequired() {
return false;
}
} // namespace L0

View File

@ -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"

View File

@ -60,7 +60,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, CommandListTests, whenCommandListIsCreatedThenPCAnd
auto cmdSba = genCmdCast<STATE_BASE_ADDRESS *>(*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<STATE_BASE_ADDRESS *>(*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());

View File

@ -152,8 +152,10 @@ size_t HardwareCommandsHelper<GfxFamily>::sendInterfaceDescriptorData(
interfaceDescriptor.setBindingTablePointer(static_cast<uint32_t>(bindingTablePointer));
if constexpr (GfxFamily::supportsSampler) {
if (device.getDeviceInfo().imageSupport) {
interfaceDescriptor.setSamplerStatePointer(static_cast<uint32_t>(offsetSamplerState));
}
}
EncodeDispatchKernel<GfxFamily>::adjustBindingTablePrefetch(interfaceDescriptor, numSamplers, bindingTablePrefetchSize);

View File

@ -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<gfxCoreFamily>::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);

View File

@ -126,9 +126,11 @@ void EncodeDispatchKernel<Family>::encode(CommandContainer &container, EncodeDis
PreemptionHelper::programInterfaceDescriptorDataPreemption<Family>(&idd, args.preemptionMode);
uint32_t samplerCount = 0;
if (args.device->getDeviceInfo().imageSupport) {
if constexpr (Family::supportsSampler) {
uint32_t samplerStateOffset = 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);
@ -146,10 +148,10 @@ void EncodeDispatchKernel<Family>::encode(CommandContainer &container, EncodeDis
}
idd.setSamplerStatePointer(samplerStateOffset);
EncodeDispatchKernel<Family>::adjustBindingTablePrefetch(idd, samplerCount, bindingTableStateCount);
} else {
EncodeDispatchKernel<Family>::adjustBindingTablePrefetch(idd, 0u, bindingTableStateCount);
}
}
EncodeDispatchKernel<Family>::adjustBindingTablePrefetch(idd, samplerCount, bindingTableStateCount);
uint64_t offsetThreadData = 0u;
const uint32_t inlineDataSize = sizeof(INLINE_DATA);

View File

@ -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);

View File

@ -444,7 +444,8 @@ CompletionStamp CommandStreamReceiverHw<GfxFamily>::flushTask(
EncodeWA<GfxFamily>::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<GfxFamily>::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);
}

View File

@ -251,6 +251,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, CommandEncodeStatesTest, giveNumBindingTableZeroWhe
EXPECT_EQ(idd.getBindingTablePointer(), 0u);
}
struct SamplerSupportedMatcher {
template <PRODUCT_FAMILY productFamily>
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,6 +427,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, CommandEncodeStatesTest, givenForceBtpPrefetchModeD
}
if constexpr (FamilyType::supportsSampler) {
if (pDevice->getDeviceInfo().imageSupport) {
if (EncodeSurfaceState<FamilyType>::doBindingTablePrefetch()) {
EXPECT_NE(INTERFACE_DESCRIPTOR_DATA::SAMPLER_COUNT_NO_SAMPLERS_USED, idd.getSamplerCount());
} else {
@ -428,6 +435,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, CommandEncodeStatesTest, givenForceBtpPrefetchModeD
}
}
}
}
{
DebugManager.flags.ForceBtpPrefetchMode.set(0);
@ -447,9 +455,11 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, CommandEncodeStatesTest, givenForceBtpPrefetchModeD
EXPECT_EQ(0u, idd.getBindingTableEntryCount());
if constexpr (FamilyType::supportsSampler) {
if (pDevice->getDeviceInfo().imageSupport) {
EXPECT_EQ(INTERFACE_DESCRIPTOR_DATA::SAMPLER_COUNT_NO_SAMPLERS_USED, idd.getSamplerCount());
}
}
}
{
DebugManager.flags.ForceBtpPrefetchMode.set(1);
@ -469,9 +479,11 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, CommandEncodeStatesTest, givenForceBtpPrefetchModeD
EXPECT_NE(0u, idd.getBindingTableEntryCount());
if constexpr (FamilyType::supportsSampler) {
if (pDevice->getDeviceInfo().imageSupport) {
EXPECT_NE(INTERFACE_DESCRIPTOR_DATA::SAMPLER_COUNT_NO_SAMPLERS_USED, idd.getSamplerCount());
}
}
}
}
HWCMDTEST_F(IGFX_XE_HP_CORE, CommandEncodeStatesTest, givenDispatchInterfaceWhenNumRequiredGrfIsNotDefaultThenStateComputeModeCommandAdded) {

View File

@ -316,7 +316,7 @@ HWTEST2_F(CommandEncodeStatesTest, givenCommandContainerWithDirtyHeapsWhenSetSta
auto itorCmd = find<STATE_BASE_ADDRESS *>(commands.begin(), commands.end());
auto pCmd = genCmdCast<STATE_BASE_ADDRESS *>(*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<STATE_BASE_ADDRESS *>(*itorCmd);
if constexpr (FamilyType::supportsSampler) {
if (pDevice->getDeviceInfo().imageSupport) {
EXPECT_NE(dsh->getHeapGpuBase(), cmd->getDynamicStateBaseAddress());
} else {
EXPECT_EQ(dsh, nullptr);