mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-19 06:24:51 +08:00
refactor: add defaultThreadArbitrationPolicy in cmdlist
Signed-off-by: Kamil Kopryk <kamil.kopryk@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
12ab4e5446
commit
44ef4c1ef2
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -203,6 +203,7 @@ HWTEST2_F(CommandListAppendLaunchKernel, givenNotEnoughSpaceInCommandStreamWhenA
|
||||
NEO::additionalKernelLaunchSizeParamNotSet, // additionalSizeParam
|
||||
0, // partitionCount
|
||||
0, // reserveExtraPayloadSpace
|
||||
0, // defaultThreadArbitrationPolicy
|
||||
false, // isIndirect
|
||||
false, // isPredicate
|
||||
false, // isTimestampEvent
|
||||
|
||||
@@ -700,6 +700,7 @@ HWTEST2_F(CommandListAppendLaunchKernel, givenNotEnoughSpaceInCommandStreamWhenA
|
||||
NEO::additionalKernelLaunchSizeParamNotSet, // additionalSizeParam
|
||||
0, // partitionCount
|
||||
0, // reserveExtraPayloadSpace
|
||||
0, // defaultThreadArbitrationPolicy
|
||||
false, // isIndirect
|
||||
false, // isPredicate
|
||||
false, // isTimestampEvent
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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) {}
|
||||
|
||||
@@ -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>;
|
||||
|
||||
@@ -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()));
|
||||
|
||||
@@ -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"
|
||||
@@ -679,3 +680,20 @@ HWTEST2_F(CommandEncoderTests, whenAskingForImplicitScalingValuesThenAlwaysRetur
|
||||
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,6 +57,7 @@ EncodeDispatchKernelArgs CommandEncodeStatesFixture::createDefaultDispatchKernel
|
||||
NEO::additionalKernelLaunchSizeParamNotSet, // additionalSizeParam
|
||||
1, // partitionCount
|
||||
0, // reserveExtraPayloadSpace
|
||||
0, // defaultThreadArbitrationPolicy
|
||||
false, // isIndirect
|
||||
false, // isPredicate
|
||||
false, // isTimestampEvent
|
||||
|
||||
Reference in New Issue
Block a user