refactor: add EncodePostSyncArgs to EncodeDispatchKernelArgs

Refactored various member variables in EncodeDispatchKernel to directly
include EncodePostSync
Changed command encoder and command list to use the modified
EncodeDispatchKernel.

Related-To: NEO-13003
Signed-off-by: Young Jin Yoon <young.jin.yoon@intel.com>
This commit is contained in:
Young Jin Yoon
2025-04-16 17:46:09 +00:00
committed by Compute-Runtime-Automation
parent a2d25ca31f
commit 05c6612386
18 changed files with 193 additions and 170 deletions

View File

@@ -188,13 +188,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendLaunchKernelWithParams(K
auto maxWgCountPerTile = kernel->getMaxWgCountPerTile(this->engineGroupType);
NEO::EncodeDispatchKernelArgs dispatchKernelArgs{
.eventAddress = 0,
.postSyncImmValue = static_cast<uint64_t>(Event::STATE_SIGNALED),
.inOrderCounterValue = 0,
.inOrderIncrementGpuAddress = 0,
.inOrderIncrementValue = 0,
.device = neoDevice,
.inOrderExecInfo = nullptr,
.dispatchInterface = kernel,
.surfaceStateHeap = ssh,
.dynamicStateHeap = dsh,
@@ -205,6 +199,22 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendLaunchKernelWithParams(K
.outImplicitArgsPtr = nullptr,
.additionalCommands = &additionalCommands,
.extendedArgs = nullptr,
.postSyncArgs = {
.eventAddress = 0,
.postSyncImmValue = static_cast<uint64_t>(Event::STATE_SIGNALED),
.inOrderCounterValue = 0,
.inOrderIncrementGpuAddress = 0,
.inOrderIncrementValue = 0,
.device = neoDevice,
.inOrderExecInfo = nullptr,
.isTimestampEvent = false,
.isHostScopeSignalEvent = false,
.isKernelUsingSystemAllocation = false,
.dcFlushEnable = this->dcFlushSupport,
.interruptEvent = false,
.isFlushL3ForExternalAllocationRequired = false,
.isFlushL3ForHostUsmRequired = false,
},
.preemptionMode = commandListPreemptionMode,
.requiredPartitionDim = launchParams.requiredPartitionDim,
.requiredDispatchWalkOrder = launchParams.requiredDispatchWalkOrder,
@@ -215,22 +225,15 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendLaunchKernelWithParams(K
.defaultPipelinedThreadArbitrationPolicy = NEO::ThreadArbitrationPolicy::NotPresent,
.isIndirect = launchParams.isIndirect,
.isPredicate = launchParams.isPredicate,
.isTimestampEvent = false,
.requiresUncachedMocs = uncachedMocsKernel,
.isInternal = internalUsage,
.isCooperative = launchParams.isCooperative,
.isHostScopeSignalEvent = false,
.isKernelUsingSystemAllocation = false,
.isKernelDispatchedFromImmediateCmdList = isImmediateType(),
.isRcs = engineGroupType == NEO::EngineGroupType::renderCompute,
.dcFlushEnable = this->dcFlushSupport,
.isHeaplessModeEnabled = this->heaplessModeEnabled,
.isHeaplessStateInitEnabled = this->heaplessStateInitEnabled,
.interruptEvent = false,
.immediateScratchAddressPatching = !this->scratchAddressPatchingEnabled,
.makeCommandView = false,
.isFlushL3AfterPostSyncForExternalAllocationRequired = false,
.isFlushL3AfterPostSyncForHostUsmRequired = false,
};
NEO::EncodeDispatchKernel<GfxFamily>::encodeCommon(commandContainer, dispatchKernelArgs);

View File

@@ -366,13 +366,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendLaunchKernelWithParams(K
NEO::EncodeKernelArgsExt dispatchKernelArgsExt = {};
NEO::EncodeDispatchKernelArgs dispatchKernelArgs{
.eventAddress = eventAddress,
.postSyncImmValue = static_cast<uint64_t>(Event::STATE_SIGNALED),
.inOrderCounterValue = inOrderCounterValue,
.inOrderIncrementGpuAddress = inOrderIncrementGpuAddress,
.inOrderIncrementValue = inOrderIncrementValue,
.device = neoDevice,
.inOrderExecInfo = inOrderExecInfo,
.dispatchInterface = kernel,
.surfaceStateHeap = ssh,
.dynamicStateHeap = dsh,
@@ -383,6 +377,22 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendLaunchKernelWithParams(K
.outImplicitArgsPtr = nullptr,
.additionalCommands = &additionalCommands,
.extendedArgs = &dispatchKernelArgsExt,
.postSyncArgs = {
.eventAddress = eventAddress,
.postSyncImmValue = static_cast<uint64_t>(Event::STATE_SIGNALED),
.inOrderCounterValue = inOrderCounterValue,
.inOrderIncrementGpuAddress = inOrderIncrementGpuAddress,
.inOrderIncrementValue = inOrderIncrementValue,
.device = neoDevice,
.inOrderExecInfo = inOrderExecInfo,
.isTimestampEvent = isTimestampEvent,
.isHostScopeSignalEvent = isHostSignalScopeEvent,
.isKernelUsingSystemAllocation = isKernelUsingSystemAllocation,
.dcFlushEnable = this->dcFlushSupport,
.interruptEvent = interruptEvent,
.isFlushL3ForExternalAllocationRequired = isFlushL3AfterPostSync && isKernelUsingExternalAllocation,
.isFlushL3ForHostUsmRequired = isFlushL3AfterPostSync && isKernelUsingSystemAllocation,
},
.preemptionMode = kernelPreemptionMode,
.requiredPartitionDim = launchParams.requiredPartitionDim,
.requiredDispatchWalkOrder = launchParams.requiredDispatchWalkOrder,
@@ -393,22 +403,15 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendLaunchKernelWithParams(K
.defaultPipelinedThreadArbitrationPolicy = this->defaultPipelinedThreadArbitrationPolicy,
.isIndirect = launchParams.isIndirect,
.isPredicate = launchParams.isPredicate,
.isTimestampEvent = isTimestampEvent,
.requiresUncachedMocs = uncachedMocsKernel,
.isInternal = internalUsage,
.isCooperative = launchParams.isCooperative,
.isHostScopeSignalEvent = isHostSignalScopeEvent,
.isKernelUsingSystemAllocation = isKernelUsingSystemAllocation,
.isKernelDispatchedFromImmediateCmdList = isImmediateType(),
.isRcs = engineGroupType == NEO::EngineGroupType::renderCompute,
.dcFlushEnable = this->dcFlushSupport,
.isHeaplessModeEnabled = this->heaplessModeEnabled,
.isHeaplessStateInitEnabled = this->heaplessStateInitEnabled,
.interruptEvent = interruptEvent,
.immediateScratchAddressPatching = !this->scratchAddressPatchingEnabled,
.makeCommandView = launchParams.makeKernelCommandView,
.isFlushL3AfterPostSyncForExternalAllocationRequired = isFlushL3AfterPostSync && isKernelUsingExternalAllocation,
.isFlushL3AfterPostSyncForHostUsmRequired = isFlushL3AfterPostSync && isKernelUsingSystemAllocation,
};
setAdditionalDispatchKernelArgsFromLaunchParams(dispatchKernelArgs, launchParams);

View File

@@ -208,7 +208,7 @@ HWTEST2_F(CommandListAppendLaunchKernel, givenNotEnoughSpaceInCommandStreamWhenA
const uint32_t threadGroupDimensions[3] = {1, 1, 1};
auto dispatchKernelArgs = CommandEncodeStatesFixture::createDefaultDispatchKernelArgs(device->getNEODevice(), kernel.get(), threadGroupDimensions, false);
dispatchKernelArgs.dcFlushEnable = commandList->getDcFlushRequired(true);
dispatchKernelArgs.postSyncArgs.dcFlushEnable = commandList->getDcFlushRequired(true);
NEO::EncodeDispatchKernel<FamilyType>::template encode<DefaultWalkerType>(commandContainer, dispatchKernelArgs);

View File

@@ -918,7 +918,7 @@ HWTEST2_F(CommandListAppendLaunchKernel, givenNotEnoughSpaceInCommandStreamWhenA
const uint32_t threadGroupDimensions[3] = {1, 1, 1};
auto dispatchKernelArgs = CommandEncodeStatesFixture::createDefaultDispatchKernelArgs(device->getNEODevice(), kernel.get(), threadGroupDimensions, false);
dispatchKernelArgs.dcFlushEnable = commandList->getDcFlushRequired(true);
dispatchKernelArgs.postSyncArgs.dcFlushEnable = commandList->getDcFlushRequired(true);
EXPECT_THROW(NEO::EncodeDispatchKernel<FamilyType>::template encode<DefaultWalkerType>(commandContainer, dispatchKernelArgs), std::exception);
}