refactor: add defaultThreadArbitrationPolicy in cmdlist

Signed-off-by: Kamil Kopryk <kamil.kopryk@intel.com>
This commit is contained in:
Kamil Kopryk
2024-05-15 10:25:49 +00:00
committed by Compute-Runtime-Automation
parent 12ab4e5446
commit 44ef4c1ef2
12 changed files with 43 additions and 1 deletions

View File

@@ -431,6 +431,7 @@ struct CommandList : _ze_command_list_handle_t {
CommandListType cmdListType = CommandListType::typeRegular;
uint32_t partitionCount = 1;
uint32_t defaultMocsIndex = 0;
int32_t defaultThreadArbitrationPolicy = 0;
bool isFlushTaskSubmissionEnabled = false;
bool isSyncModeQueue = false;

View File

@@ -248,6 +248,10 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::initialize(Device *device, NEO
this->inOrderAtomicSignalingEnabled = gfxCoreHelper.inOrderAtomicSignallingEnabled(rootDeviceEnvironment);
this->scratchAddressPatchingEnabled = (this->heaplessModeEnabled && !isImmediateType());
this->copyOperationFenceSupported = isCopyOnly() && productHelper.isDeviceToHostCopySignalingFenceRequired();
this->defaultThreadArbitrationPolicy = gfxCoreHelper.getDefaultThreadArbitrationPolicy();
if (NEO::debugManager.flags.OverrideThreadArbitrationPolicy.get() != -1) {
this->defaultThreadArbitrationPolicy = NEO::debugManager.flags.OverrideThreadArbitrationPolicy.get();
}
this->commandContainer.doubleSbaWaRef() = this->doubleSbaWa;
this->commandContainer.l1CachePolicyDataRef() = &this->l1CachePolicyData;

View File

@@ -208,6 +208,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendLaunchKernelWithParams(K
launchParams.additionalSizeParam, // additionalSizeParam
0, // partitionCount
launchParams.reserveExtraPayloadSpace, // reserveExtraPayloadSpace
0, // defaultThreadArbitrationPolicy
launchParams.isIndirect, // isIndirect
launchParams.isPredicate, // isPredicate
false, // isTimestampEvent

View File

@@ -335,6 +335,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendLaunchKernelWithParams(K
launchParams.additionalSizeParam, // additionalSizeParam
this->partitionCount, // partitionCount
launchParams.reserveExtraPayloadSpace, // reserveExtraPayloadSpace
this->defaultThreadArbitrationPolicy, // defaultThreadArbitrationPolicy
launchParams.isIndirect, // isIndirect
launchParams.isPredicate, // isPredicate
isTimestampEvent, // isTimestampEvent

View File

@@ -203,6 +203,7 @@ HWTEST2_F(CommandListAppendLaunchKernel, givenNotEnoughSpaceInCommandStreamWhenA
NEO::additionalKernelLaunchSizeParamNotSet, // additionalSizeParam
0, // partitionCount
0, // reserveExtraPayloadSpace
0, // defaultThreadArbitrationPolicy
false, // isIndirect
false, // isPredicate
false, // isTimestampEvent

View File

@@ -700,6 +700,7 @@ HWTEST2_F(CommandListAppendLaunchKernel, givenNotEnoughSpaceInCommandStreamWhenA
NEO::additionalKernelLaunchSizeParamNotSet, // additionalSizeParam
0, // partitionCount
0, // reserveExtraPayloadSpace
0, // defaultThreadArbitrationPolicy
false, // isIndirect
false, // isPredicate
false, // isTimestampEvent

View File

@@ -62,6 +62,7 @@ struct EncodeDispatchKernelArgs {
uint32_t additionalSizeParam = NEO::additionalKernelLaunchSizeParamNotSet;
uint32_t partitionCount = 0u;
uint32_t reserveExtraPayloadSpace = 0;
int32_t defaultThreadArbitrationPolicy = 0;
bool isIndirect = false;
bool isPredicate = false;
bool isTimestampEvent = false;
@@ -125,6 +126,9 @@ struct EncodeDispatchKernel {
static void appendAdditionalIDDFields(InterfaceDescriptorType *pInterfaceDescriptor, const RootDeviceEnvironment &rootDeviceEnvironment,
const uint32_t threadsPerThreadGroup, uint32_t slmTotalSize, SlmPolicy slmPolicy);
template <typename InterfaceDescriptorType>
static void encodeEuSchedulingPolicy(InterfaceDescriptorType *pInterfaceDescriptor, const KernelDescriptor &kernelDesc, int32_t defaultThreadArbitrationPolicy);
template <typename WalkerType>
static void encodeThreadData(WalkerType &walkerCmd,
const uint32_t *startWorkGroup,

View File

@@ -589,6 +589,11 @@ bool EncodeDispatchKernel<Family>::inlineDataProgrammingRequired(const KernelDes
return false;
}
template <typename Family>
template <typename InterfaceDescriptorType>
void EncodeDispatchKernel<Family>::encodeEuSchedulingPolicy(InterfaceDescriptorType *pInterfaceDescriptor, const KernelDescriptor &kernelDesc, int32_t defaultThreadArbitrationPolicy) {
}
template <typename Family>
template <typename WalkerType>
void EncodeDispatchKernel<Family>::adjustTimestampPacket(WalkerType &walkerCmd, const EncodeDispatchKernelArgs &args) {}

View File

@@ -25,6 +25,7 @@ template void NEO::EncodeDispatchKernel<Family>::programBarrierEnable<Family::IN
template void NEO::EncodeDispatchKernel<Family>::setScratchAddress<false>(uint64_t &scratchAddress, uint32_t requiredScratchSlot0Size, uint32_t requiredScratchSlot1Size, IndirectHeap *ssh, CommandStreamReceiver &csr);
template void NEO::EncodeDispatchKernel<Family>::setScratchAddress<true>(uint64_t &scratchAddress, uint32_t requiredScratchSlot0Size, uint32_t requiredScratchSlot1Size, IndirectHeap *ssh, CommandStreamReceiver &csr);
template void NEO::EncodeDispatchKernel<Family>::programInlineDataHeapless<false>(uint8_t *inlineDataPtr, EncodeDispatchKernelArgs &args, CommandContainer &container, uint64_t offsetThreadData);
template void NEO::EncodeDispatchKernel<Family>::encodeEuSchedulingPolicy<Family::INTERFACE_DESCRIPTOR_DATA>(Family::INTERFACE_DESCRIPTOR_DATA *pInterfaceDescriptor, const KernelDescriptor &kernelDesc, int32_t defaultThreadArbitrationPolicy);
template struct NEO::EncodeStates<Family>;
template struct NEO::EncodeMath<Family>;

View File

@@ -115,6 +115,10 @@ void EncodeDispatchKernel<Family>::encode(CommandContainer &container, EncodeDis
kernelDescriptor.kernelAttributes.barrierCount,
hwInfo);
if (args.isHeaplessStateInitEnabled) {
EncodeDispatchKernel<Family>::encodeEuSchedulingPolicy(&idd, kernelDescriptor, args.defaultThreadArbitrationPolicy);
}
auto &gfxCoreHelper = args.device->getGfxCoreHelper();
auto slmSize = static_cast<uint32_t>(
gfxCoreHelper.computeSlmValues(hwInfo, args.dispatchInterface->getSlmTotalSize()));

View File

@@ -15,6 +15,7 @@
#include "shared/source/helpers/gfx_core_helper.h"
#include "shared/source/helpers/in_order_cmd_helpers.h"
#include "shared/source/helpers/pipe_control_args.h"
#include "shared/source/kernel/kernel_descriptor.h"
#include "shared/source/memory_manager/graphics_allocation.h"
#include "shared/source/memory_manager/memory_manager.h"
#include "shared/source/os_interface/product_helper.h"
@@ -678,4 +679,21 @@ HWTEST2_F(CommandEncoderTests, whenAskingForImplicitScalingValuesThenAlwaysRetur
EXPECT_EQ(static_cast<uint32_t>(GfxCoreHelperHw<FamilyType>::getSingleTimestampPacketSizeHw()), ImplicitScalingDispatch<FamilyType>::getTimeStampPostSyncOffset());
EXPECT_FALSE(ImplicitScalingDispatch<FamilyType>::platformSupportsImplicitScaling(*rootExecEnv));
}
}
HWTEST_F(CommandEncoderTests, givenInterfaceDescriptorWhenEncodeEuSchedulingPolicyIsCalledThenNothingIsChanged) {
using INTERFACE_DESCRIPTOR_DATA = typename FamilyType::INTERFACE_DESCRIPTOR_DATA;
INTERFACE_DESCRIPTOR_DATA idd = FamilyType::cmdInitInterfaceDescriptorData;
auto expectedIdd = idd;
KernelDescriptor kernelDescriptor;
kernelDescriptor.kernelAttributes.threadArbitrationPolicy = ThreadArbitrationPolicy::AgeBased;
int32_t defaultThreadArbitrationPolicy = ThreadArbitrationPolicy::RoundRobin;
EncodeDispatchKernel<FamilyType>::encodeEuSchedulingPolicy(&idd, kernelDescriptor, defaultThreadArbitrationPolicy);
constexpr uint32_t iddSizeInDW = 8;
for (uint32_t i = 0u; i < iddSizeInDW; i++) {
EXPECT_EQ(expectedIdd.getRawData(i), idd.getRawData(i));
}
}

View File

@@ -57,6 +57,7 @@ EncodeDispatchKernelArgs CommandEncodeStatesFixture::createDefaultDispatchKernel
NEO::additionalKernelLaunchSizeParamNotSet, // additionalSizeParam
1, // partitionCount
0, // reserveExtraPayloadSpace
0, // defaultThreadArbitrationPolicy
false, // isIndirect
false, // isPredicate
false, // isTimestampEvent