feature: Add heapless mode programming in l0 1/n

Related-To: NEO-7621
Signed-off-by: Kamil Kopryk <kamil.kopryk@intel.com>
This commit is contained in:
Kamil Kopryk
2023-12-01 14:30:28 +00:00
committed by Compute-Runtime-Automation
parent 7a17df93a6
commit aa950a4a96
31 changed files with 295 additions and 175 deletions

View File

@@ -445,6 +445,7 @@ struct CommandList : _ze_command_list_handle_t {
bool dispatchCmdListBatchBufferAsPrimary = false;
bool copyThroughLockedPtrEnabled = false;
bool useOnlyGlobalTimestamps = false;
bool heaplessModeEnabled = false;
};
using CommandListAllocatorFn = CommandList *(*)(uint32_t);

View File

@@ -16,6 +16,7 @@
#include "shared/source/helpers/api_specific_config.h"
#include "shared/source/helpers/blit_commands_helper.h"
#include "shared/source/helpers/blit_properties.h"
#include "shared/source/helpers/compiler_product_helper_base.inl"
#include "shared/source/helpers/definitions/command_encoder_args.h"
#include "shared/source/helpers/gfx_core_helper.h"
#include "shared/source/helpers/hw_info.h"
@@ -210,6 +211,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::initialize(Device *device, NEO
auto &rootDeviceEnvironment = neoDevice->getRootDeviceEnvironment();
auto &productHelper = rootDeviceEnvironment.getHelper<NEO::ProductHelper>();
auto &gfxCoreHelper = neoDevice->getGfxCoreHelper();
auto &compilerProductHelper = neoDevice->getCompilerProductHelper();
auto gmmHelper = rootDeviceEnvironment.getGmmHelper();
this->dcFlushSupport = NEO::MemorySynchronizationCommands<GfxFamily>::getDcFlushEnable(true, rootDeviceEnvironment);
@@ -230,7 +232,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::initialize(Device *device, NEO
this->dispatchCmdListBatchBufferAsPrimary = L0GfxCoreHelper::dispatchCmdListBatchBufferAsPrimary(rootDeviceEnvironment, this->cmdListType == CommandListType::TYPE_REGULAR);
this->useOnlyGlobalTimestamps = gfxCoreHelper.useOnlyGlobalTimestamps();
this->maxFillPaternSizeForCopyEngine = gfxCoreHelper.getMaxFillPaternSizeForCopyEngine();
this->heaplessModeEnabled = compilerProductHelper.isHeaplessModeEnabled();
this->requiredStreamState.initSupport(rootDeviceEnvironment);
this->finalStreamState.initSupport(rootDeviceEnvironment);
@@ -3179,7 +3181,10 @@ void CommandListCoreFamily<gfxCoreFamily>::programStateBaseAddress(NEO::CommandC
false, // useGlobalAtomics
this->partitionCount > 1, // multiOsContextCapable
isRcs, // isRcs
this->doubleSbaWa}; // doubleSbaWa
this->doubleSbaWa, // doubleSbaWa
this->heaplessModeEnabled // heaplessModeEnabled
};
NEO::EncodeStateBaseAddress<GfxFamily>::encode(encodeStateBaseAddressArgs);
bool sbaTrackingEnabled = NEO::Debugger::isDebugEnabled(this->internalUsage) && this->device->getL0Debugger();

View File

@@ -212,10 +212,11 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendLaunchKernelWithParams(K
false, // isKernelUsingSystemAllocation
cmdListType == CommandListType::TYPE_IMMEDIATE, // isKernelDispatchedFromImmediateCmdList
engineGroupType == NEO::EngineGroupType::renderCompute, // isRcs
this->dcFlushSupport // dcFlushEnable
this->dcFlushSupport, // dcFlushEnable
this->heaplessModeEnabled // isHeaplessModeEnabled
};
NEO::EncodeDispatchKernel<GfxFamily>::encode(commandContainer, dispatchKernelArgs);
NEO::EncodeDispatchKernel<GfxFamily>::encodeCommon(commandContainer, dispatchKernelArgs);
if (!this->isFlushTaskSubmissionEnabled) {
this->containsStatelessUncachedResource = dispatchKernelArgs.requiresUncachedMocs;
}

View File

@@ -298,7 +298,8 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendLaunchKernelWithParams(K
isKernelUsingSystemAllocation, // isKernelUsingSystemAllocation
cmdListType == CommandListType::TYPE_IMMEDIATE, // isKernelDispatchedFromImmediateCmdList
engineGroupType == NEO::EngineGroupType::renderCompute, // isRcs
this->dcFlushSupport // dcFlushEnable
this->dcFlushSupport, // dcFlushEnable
this->heaplessModeEnabled // isHeaplessModeEnabled
};
bool inOrderExecSignalRequired = (this->isInOrderExecutionEnabled() && !launchParams.isKernelSplitOperation);
@@ -313,7 +314,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendLaunchKernelWithParams(K
}
}
NEO::EncodeDispatchKernel<GfxFamily>::encode(commandContainer, dispatchKernelArgs);
NEO::EncodeDispatchKernel<GfxFamily>::encodeCommon(commandContainer, dispatchKernelArgs);
if (!this->isFlushTaskSubmissionEnabled) {
this->containsStatelessUncachedResource = dispatchKernelArgs.requiresUncachedMocs;

View File

@@ -161,6 +161,7 @@ HWTEST_F(CommandListAppendLaunchKernel, givenKernelWithThreadArbitrationPolicySe
HWTEST2_F(CommandListAppendLaunchKernel, givenNotEnoughSpaceInCommandStreamWhenAppendingKernelThenBbEndIsAddedAndNewCmdBufferAllocated, IsAtLeastSkl) {
using MI_BATCH_BUFFER_END = typename FamilyType::MI_BATCH_BUFFER_END;
using WALKER_TYPE = typename FamilyType::WALKER_TYPE;
DebugManagerStateRestore restorer;
debugManager.flags.DispatchCmdlistCmdBufferPrimary.set(0);
@@ -207,7 +208,7 @@ HWTEST2_F(CommandListAppendLaunchKernel, givenNotEnoughSpaceInCommandStreamWhenA
false, // isRcs
commandList->getDcFlushRequired(true) // dcFlushEnable
};
NEO::EncodeDispatchKernel<FamilyType>::encode(commandContainer, dispatchKernelArgs);
NEO::EncodeDispatchKernel<FamilyType>::template encode<WALKER_TYPE>(commandContainer, dispatchKernelArgs);
auto usedSpaceAfter = commandContainer.getCommandStream()->getUsed();
ASSERT_GT(usedSpaceAfter, 0u);

View File

@@ -616,6 +616,8 @@ HWTEST2_F(CommandListAppendLaunchKernel, givenNotEnoughSpaceInCommandStreamWhenA
DebugManagerStateRestore restorer;
NEO::debugManager.flags.EnableFlushTaskSubmission.set(0);
using MI_BATCH_BUFFER_END = typename FamilyType::MI_BATCH_BUFFER_END;
using WALKER_TYPE = typename FamilyType::WALKER_TYPE;
createKernel();
ze_result_t returnValue;
@@ -657,7 +659,7 @@ HWTEST2_F(CommandListAppendLaunchKernel, givenNotEnoughSpaceInCommandStreamWhenA
false, // isRcs
commandList->getDcFlushRequired(true) // dcFlushEnable
};
EXPECT_THROW(NEO::EncodeDispatchKernel<FamilyType>::encode(commandContainer, dispatchKernelArgs), std::exception);
EXPECT_THROW(NEO::EncodeDispatchKernel<FamilyType>::template encode<WALKER_TYPE>(commandContainer, dispatchKernelArgs), std::exception);
}
HWTEST_F(CommandListAppendLaunchKernel, givenInvalidKernelWhenAppendingThenReturnErrorInvalidArgument) {