Move isRelaxedOrderingDispatchAllowed to common helper

Signed-off-by: Dunajski, Bartosz <bartosz.dunajski@intel.com>
This commit is contained in:
Dunajski, Bartosz
2023-03-09 13:22:23 +00:00
committed by Compute-Runtime-Automation
parent 37768a15d3
commit d7aba6747c
9 changed files with 80 additions and 66 deletions

View File

@@ -169,7 +169,6 @@ struct CommandListCoreFamilyImmediate : public CommandListCoreFamily<gfxCoreFami
protected: protected:
void printKernelsPrintfOutput(bool hangDetected); void printKernelsPrintfOutput(bool hangDetected);
bool isRelaxedOrderingDispatchAllowed(uint32_t numWaitEvents) const;
std::atomic<bool> dependenciesPresent{false}; std::atomic<bool> dependenciesPresent{false};
}; };

View File

@@ -12,6 +12,7 @@
#include "shared/source/command_stream/scratch_space_controller.h" #include "shared/source/command_stream/scratch_space_controller.h"
#include "shared/source/command_stream/wait_status.h" #include "shared/source/command_stream/wait_status.h"
#include "shared/source/debugger/debugger_l0.h" #include "shared/source/debugger/debugger_l0.h"
#include "shared/source/direct_submission/relaxed_ordering_helper.h"
#include "shared/source/helpers/bindless_heaps_helper.h" #include "shared/source/helpers/bindless_heaps_helper.h"
#include "shared/source/helpers/completion_stamp.h" #include "shared/source/helpers/completion_stamp.h"
#include "shared/source/helpers/hw_info.h" #include "shared/source/helpers/hw_info.h"
@@ -321,27 +322,13 @@ bool CommandListCoreFamilyImmediate<gfxCoreFamily>::waitForEventsFromHost() {
return true; return true;
} }
template <GFXCORE_FAMILY gfxCoreFamily>
bool CommandListCoreFamilyImmediate<gfxCoreFamily>::isRelaxedOrderingDispatchAllowed(uint32_t numWaitEvents) const {
if (numWaitEvents == 0u) {
return false;
}
uint32_t minimalNumberOfClients = 2;
if (NEO::DebugManager.flags.DirectSubmissionRelaxedOrderingMinNumberOfClients.get() != -1) {
minimalNumberOfClients = static_cast<uint32_t>(NEO::DebugManager.flags.DirectSubmissionRelaxedOrderingMinNumberOfClients.get());
}
return (this->csr->getNumClients() >= minimalNumberOfClients && this->csr->directSubmissionRelaxedOrderingEnabled());
}
template <GFXCORE_FAMILY gfxCoreFamily> template <GFXCORE_FAMILY gfxCoreFamily>
ze_result_t CommandListCoreFamilyImmediate<gfxCoreFamily>::appendLaunchKernel( ze_result_t CommandListCoreFamilyImmediate<gfxCoreFamily>::appendLaunchKernel(
ze_kernel_handle_t kernelHandle, const ze_group_count_t *threadGroupDimensions, ze_kernel_handle_t kernelHandle, const ze_group_count_t *threadGroupDimensions,
ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t *phWaitEvents, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t *phWaitEvents,
const CmdListKernelLaunchParams &launchParams, bool relaxedOrderingDispatch) { const CmdListKernelLaunchParams &launchParams, bool relaxedOrderingDispatch) {
relaxedOrderingDispatch = isRelaxedOrderingDispatchAllowed(numWaitEvents); relaxedOrderingDispatch = NEO::RelaxedOrderingHelper::isRelaxedOrderingDispatchAllowed(*this->csr, numWaitEvents);
if (this->isFlushTaskSubmissionEnabled) { if (this->isFlushTaskSubmissionEnabled) {
checkAvailableSpace(numWaitEvents, relaxedOrderingDispatch); checkAvailableSpace(numWaitEvents, relaxedOrderingDispatch);
@@ -365,7 +352,7 @@ template <GFXCORE_FAMILY gfxCoreFamily>
ze_result_t CommandListCoreFamilyImmediate<gfxCoreFamily>::appendLaunchKernelIndirect( ze_result_t CommandListCoreFamilyImmediate<gfxCoreFamily>::appendLaunchKernelIndirect(
ze_kernel_handle_t kernelHandle, const ze_group_count_t *pDispatchArgumentsBuffer, ze_kernel_handle_t kernelHandle, const ze_group_count_t *pDispatchArgumentsBuffer,
ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t *phWaitEvents, bool relaxedOrderingDispatch) { ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t *phWaitEvents, bool relaxedOrderingDispatch) {
relaxedOrderingDispatch = isRelaxedOrderingDispatchAllowed(numWaitEvents); relaxedOrderingDispatch = NEO::RelaxedOrderingHelper::isRelaxedOrderingDispatchAllowed(*this->csr, numWaitEvents);
if (this->isFlushTaskSubmissionEnabled) { if (this->isFlushTaskSubmissionEnabled) {
checkAvailableSpace(numWaitEvents, relaxedOrderingDispatch); checkAvailableSpace(numWaitEvents, relaxedOrderingDispatch);
@@ -402,7 +389,7 @@ ze_result_t CommandListCoreFamilyImmediate<gfxCoreFamily>::appendMemoryCopy(
ze_event_handle_t hSignalEvent, ze_event_handle_t hSignalEvent,
uint32_t numWaitEvents, uint32_t numWaitEvents,
ze_event_handle_t *phWaitEvents, bool relaxedOrderingDispatch) { ze_event_handle_t *phWaitEvents, bool relaxedOrderingDispatch) {
relaxedOrderingDispatch = isRelaxedOrderingDispatchAllowed(numWaitEvents); relaxedOrderingDispatch = NEO::RelaxedOrderingHelper::isRelaxedOrderingDispatchAllowed(*this->csr, numWaitEvents);
if (this->isFlushTaskSubmissionEnabled) { if (this->isFlushTaskSubmissionEnabled) {
checkAvailableSpace(numWaitEvents, relaxedOrderingDispatch); checkAvailableSpace(numWaitEvents, relaxedOrderingDispatch);
@@ -423,7 +410,7 @@ ze_result_t CommandListCoreFamilyImmediate<gfxCoreFamily>::appendMemoryCopy(
NEO::TransferDirection direction; NEO::TransferDirection direction;
auto isSplitNeeded = this->isAppendSplitNeeded(dstptr, srcptr, size, direction); auto isSplitNeeded = this->isAppendSplitNeeded(dstptr, srcptr, size, direction);
if (isSplitNeeded) { if (isSplitNeeded) {
relaxedOrderingDispatch = isRelaxedOrderingDispatchAllowed(1); // split generates more than 1 event relaxedOrderingDispatch = NEO::RelaxedOrderingHelper::isRelaxedOrderingDispatchAllowed(*this->csr, 1); // split generates more than 1 event
ret = static_cast<DeviceImp *>(this->device)->bcsSplit.appendSplitCall<gfxCoreFamily, void *, const void *>(this, dstptr, srcptr, size, hSignalEvent, numWaitEvents, phWaitEvents, true, relaxedOrderingDispatch, direction, [&](void *dstptrParam, const void *srcptrParam, size_t sizeParam, ze_event_handle_t hSignalEventParam) { ret = static_cast<DeviceImp *>(this->device)->bcsSplit.appendSplitCall<gfxCoreFamily, void *, const void *>(this, dstptr, srcptr, size, hSignalEvent, numWaitEvents, phWaitEvents, true, relaxedOrderingDispatch, direction, [&](void *dstptrParam, const void *srcptrParam, size_t sizeParam, ze_event_handle_t hSignalEventParam) {
return CommandListCoreFamily<gfxCoreFamily>::appendMemoryCopy(dstptrParam, srcptrParam, sizeParam, hSignalEventParam, 0u, nullptr, relaxedOrderingDispatch); return CommandListCoreFamily<gfxCoreFamily>::appendMemoryCopy(dstptrParam, srcptrParam, sizeParam, hSignalEventParam, 0u, nullptr, relaxedOrderingDispatch);
}); });
@@ -447,7 +434,7 @@ ze_result_t CommandListCoreFamilyImmediate<gfxCoreFamily>::appendMemoryCopyRegio
ze_event_handle_t hSignalEvent, ze_event_handle_t hSignalEvent,
uint32_t numWaitEvents, uint32_t numWaitEvents,
ze_event_handle_t *phWaitEvents, bool relaxedOrderingDispatch) { ze_event_handle_t *phWaitEvents, bool relaxedOrderingDispatch) {
relaxedOrderingDispatch = isRelaxedOrderingDispatchAllowed(numWaitEvents); relaxedOrderingDispatch = NEO::RelaxedOrderingHelper::isRelaxedOrderingDispatchAllowed(*this->csr, numWaitEvents);
if (this->isFlushTaskSubmissionEnabled) { if (this->isFlushTaskSubmissionEnabled) {
checkAvailableSpace(numWaitEvents, relaxedOrderingDispatch); checkAvailableSpace(numWaitEvents, relaxedOrderingDispatch);
@@ -459,7 +446,7 @@ ze_result_t CommandListCoreFamilyImmediate<gfxCoreFamily>::appendMemoryCopyRegio
NEO::TransferDirection direction; NEO::TransferDirection direction;
auto isSplitNeeded = this->isAppendSplitNeeded(dstPtr, srcPtr, this->getTotalSizeForCopyRegion(dstRegion, dstPitch, dstSlicePitch), direction); auto isSplitNeeded = this->isAppendSplitNeeded(dstPtr, srcPtr, this->getTotalSizeForCopyRegion(dstRegion, dstPitch, dstSlicePitch), direction);
if (isSplitNeeded) { if (isSplitNeeded) {
relaxedOrderingDispatch = isRelaxedOrderingDispatchAllowed(1); // split generates more than 1 event relaxedOrderingDispatch = NEO::RelaxedOrderingHelper::isRelaxedOrderingDispatchAllowed(*this->csr, 1); // split generates more than 1 event
ret = static_cast<DeviceImp *>(this->device)->bcsSplit.appendSplitCall<gfxCoreFamily, uint32_t, uint32_t>(this, dstRegion->originX, srcRegion->originX, dstRegion->width, hSignalEvent, numWaitEvents, phWaitEvents, true, relaxedOrderingDispatch, direction, [&](uint32_t dstOriginXParam, uint32_t srcOriginXParam, size_t sizeParam, ze_event_handle_t hSignalEventParam) { ret = static_cast<DeviceImp *>(this->device)->bcsSplit.appendSplitCall<gfxCoreFamily, uint32_t, uint32_t>(this, dstRegion->originX, srcRegion->originX, dstRegion->width, hSignalEvent, numWaitEvents, phWaitEvents, true, relaxedOrderingDispatch, direction, [&](uint32_t dstOriginXParam, uint32_t srcOriginXParam, size_t sizeParam, ze_event_handle_t hSignalEventParam) {
ze_copy_region_t dstRegionLocal = {}; ze_copy_region_t dstRegionLocal = {};
ze_copy_region_t srcRegionLocal = {}; ze_copy_region_t srcRegionLocal = {};
@@ -488,7 +475,7 @@ ze_result_t CommandListCoreFamilyImmediate<gfxCoreFamily>::appendMemoryFill(void
ze_event_handle_t hSignalEvent, ze_event_handle_t hSignalEvent,
uint32_t numWaitEvents, uint32_t numWaitEvents,
ze_event_handle_t *phWaitEvents, bool relaxedOrderingDispatch) { ze_event_handle_t *phWaitEvents, bool relaxedOrderingDispatch) {
relaxedOrderingDispatch = isRelaxedOrderingDispatchAllowed(numWaitEvents); relaxedOrderingDispatch = NEO::RelaxedOrderingHelper::isRelaxedOrderingDispatchAllowed(*this->csr, numWaitEvents);
if (this->isFlushTaskSubmissionEnabled) { if (this->isFlushTaskSubmissionEnabled) {
checkAvailableSpace(numWaitEvents, relaxedOrderingDispatch); checkAvailableSpace(numWaitEvents, relaxedOrderingDispatch);
@@ -541,7 +528,7 @@ ze_result_t CommandListCoreFamilyImmediate<gfxCoreFamily>::appendPageFaultCopy(N
bool relaxedOrdering = false; bool relaxedOrdering = false;
if (isSplitNeeded) { if (isSplitNeeded) {
relaxedOrdering = isRelaxedOrderingDispatchAllowed(1); // split generates more than 1 event relaxedOrdering = NEO::RelaxedOrderingHelper::isRelaxedOrderingDispatchAllowed(*this->csr, 1); // split generates more than 1 event
uintptr_t dstAddress = static_cast<uintptr_t>(dstAllocation->getGpuAddress()); uintptr_t dstAddress = static_cast<uintptr_t>(dstAllocation->getGpuAddress());
uintptr_t srcAddress = static_cast<uintptr_t>(srcAllocation->getGpuAddress()); uintptr_t srcAddress = static_cast<uintptr_t>(srcAllocation->getGpuAddress());
ret = static_cast<DeviceImp *>(this->device)->bcsSplit.appendSplitCall<gfxCoreFamily, uintptr_t, uintptr_t>(this, dstAddress, srcAddress, size, nullptr, 0u, nullptr, false, relaxedOrdering, direction, [&](uintptr_t dstAddressParam, uintptr_t srcAddressParam, size_t sizeParam, ze_event_handle_t hSignalEventParam) { ret = static_cast<DeviceImp *>(this->device)->bcsSplit.appendSplitCall<gfxCoreFamily, uintptr_t, uintptr_t>(this, dstAddress, srcAddress, size, nullptr, 0u, nullptr, false, relaxedOrdering, direction, [&](uintptr_t dstAddressParam, uintptr_t srcAddressParam, size_t sizeParam, ze_event_handle_t hSignalEventParam) {
@@ -615,7 +602,7 @@ ze_result_t CommandListCoreFamilyImmediate<gfxCoreFamily>::appendImageCopyRegion
ze_event_handle_t hSignalEvent, ze_event_handle_t hSignalEvent,
uint32_t numWaitEvents, uint32_t numWaitEvents,
ze_event_handle_t *phWaitEvents, bool relaxedOrderingDispatch) { ze_event_handle_t *phWaitEvents, bool relaxedOrderingDispatch) {
relaxedOrderingDispatch = isRelaxedOrderingDispatchAllowed(numWaitEvents); relaxedOrderingDispatch = NEO::RelaxedOrderingHelper::isRelaxedOrderingDispatchAllowed(*this->csr, numWaitEvents);
if (this->isFlushTaskSubmissionEnabled) { if (this->isFlushTaskSubmissionEnabled) {
checkAvailableSpace(numWaitEvents, relaxedOrderingDispatch); checkAvailableSpace(numWaitEvents, relaxedOrderingDispatch);
@@ -635,7 +622,7 @@ ze_result_t CommandListCoreFamilyImmediate<gfxCoreFamily>::appendImageCopyFromMe
ze_event_handle_t hSignalEvent, ze_event_handle_t hSignalEvent,
uint32_t numWaitEvents, uint32_t numWaitEvents,
ze_event_handle_t *phWaitEvents, bool relaxedOrderingDispatch) { ze_event_handle_t *phWaitEvents, bool relaxedOrderingDispatch) {
relaxedOrderingDispatch = isRelaxedOrderingDispatchAllowed(numWaitEvents); relaxedOrderingDispatch = NEO::RelaxedOrderingHelper::isRelaxedOrderingDispatchAllowed(*this->csr, numWaitEvents);
if (this->isFlushTaskSubmissionEnabled) { if (this->isFlushTaskSubmissionEnabled) {
checkAvailableSpace(numWaitEvents, relaxedOrderingDispatch); checkAvailableSpace(numWaitEvents, relaxedOrderingDispatch);
@@ -656,7 +643,7 @@ ze_result_t CommandListCoreFamilyImmediate<gfxCoreFamily>::appendImageCopyToMemo
ze_event_handle_t hSignalEvent, ze_event_handle_t hSignalEvent,
uint32_t numWaitEvents, uint32_t numWaitEvents,
ze_event_handle_t *phWaitEvents, bool relaxedOrderingDispatch) { ze_event_handle_t *phWaitEvents, bool relaxedOrderingDispatch) {
relaxedOrderingDispatch = isRelaxedOrderingDispatchAllowed(numWaitEvents); relaxedOrderingDispatch = NEO::RelaxedOrderingHelper::isRelaxedOrderingDispatchAllowed(*this->csr, numWaitEvents);
if (this->isFlushTaskSubmissionEnabled) { if (this->isFlushTaskSubmissionEnabled) {
checkAvailableSpace(numWaitEvents, relaxedOrderingDispatch); checkAvailableSpace(numWaitEvents, relaxedOrderingDispatch);
@@ -690,7 +677,7 @@ ze_result_t CommandListCoreFamilyImmediate<gfxCoreFamily>::appendLaunchCooperati
ze_event_handle_t hSignalEvent, ze_event_handle_t hSignalEvent,
uint32_t numWaitEvents, uint32_t numWaitEvents,
ze_event_handle_t *waitEventHandles, bool relaxedOrderingDispatch) { ze_event_handle_t *waitEventHandles, bool relaxedOrderingDispatch) {
relaxedOrderingDispatch = isRelaxedOrderingDispatchAllowed(numWaitEvents); relaxedOrderingDispatch = NEO::RelaxedOrderingHelper::isRelaxedOrderingDispatchAllowed(*this->csr, numWaitEvents);
if (this->isFlushTaskSubmissionEnabled) { if (this->isFlushTaskSubmissionEnabled) {
checkAvailableSpace(numWaitEvents, relaxedOrderingDispatch); checkAvailableSpace(numWaitEvents, relaxedOrderingDispatch);

View File

@@ -156,7 +156,6 @@ struct WhiteBox<L0::CommandListCoreFamilyImmediate<gfxCoreFamily>>
using BaseClass::getHostPtrAlloc; using BaseClass::getHostPtrAlloc;
using BaseClass::immediateCmdListHeapSharing; using BaseClass::immediateCmdListHeapSharing;
using BaseClass::isFlushTaskSubmissionEnabled; using BaseClass::isFlushTaskSubmissionEnabled;
using BaseClass::isRelaxedOrderingDispatchAllowed;
using BaseClass::isSyncModeQueue; using BaseClass::isSyncModeQueue;
using BaseClass::isTbxMode; using BaseClass::isTbxMode;
using BaseClass::partitionCount; using BaseClass::partitionCount;

View File

@@ -6,6 +6,7 @@
*/ */
#include "shared/source/command_container/encode_surface_state.h" #include "shared/source/command_container/encode_surface_state.h"
#include "shared/source/direct_submission/relaxed_ordering_helper.h"
#include "shared/source/helpers/aligned_memory.h" #include "shared/source/helpers/aligned_memory.h"
#include "shared/source/memory_manager/internal_allocation_storage.h" #include "shared/source/memory_manager/internal_allocation_storage.h"
#include "shared/test/common/cmd_parse/gen_cmd_parse.h" #include "shared/test/common/cmd_parse/gen_cmd_parse.h"
@@ -1334,42 +1335,6 @@ HWTEST2_F(CommandListCreate, whenGettingCommandsToPatchThenCorrectValuesAreRetur
EXPECT_EQ(&commandList->commandsToPatch, &commandList->getCommandsToPatch()); EXPECT_EQ(&commandList->commandsToPatch, &commandList->getCommandsToPatch());
} }
HWTEST2_F(CommandListCreate, givenNumClientsWhenAskingIfRelaxedOrderingEnabledThenReturnCorrectValue, IsAtLeastXeHpcCore) {
DebugManagerStateRestore restore;
DebugManager.flags.DirectSubmissionRelaxedOrdering.set(1);
auto commandList = std::make_unique<WhiteBox<L0::CommandListCoreFamilyImmediate<gfxCoreFamily>>>();
commandList->csr = device->getNEODevice()->getDefaultEngine().commandStreamReceiver;
auto ultCsr = static_cast<NEO::UltCommandStreamReceiver<FamilyType> *>(commandList->csr);
ultCsr->registerClient();
ultCsr->recordFlusheBatchBuffer = true;
auto directSubmission = new NEO::MockDirectSubmissionHw<FamilyType, RenderDispatcher<FamilyType>>(*ultCsr);
ultCsr->directSubmission.reset(directSubmission);
EXPECT_EQ(1u, ultCsr->getNumClients());
EXPECT_FALSE(commandList->isRelaxedOrderingDispatchAllowed(1));
ultCsr->registerClient();
EXPECT_EQ(2u, ultCsr->getNumClients());
EXPECT_TRUE(commandList->isRelaxedOrderingDispatchAllowed(1));
DebugManager.flags.DirectSubmissionRelaxedOrderingMinNumberOfClients.set(4);
EXPECT_EQ(2u, ultCsr->getNumClients());
EXPECT_FALSE(commandList->isRelaxedOrderingDispatchAllowed(1));
ultCsr->registerClient();
EXPECT_EQ(3u, ultCsr->getNumClients());
EXPECT_FALSE(commandList->isRelaxedOrderingDispatchAllowed(1));
ultCsr->registerClient();
EXPECT_EQ(4u, ultCsr->getNumClients());
EXPECT_TRUE(commandList->isRelaxedOrderingDispatchAllowed(1));
}
HWTEST2_F(CommandListCreate, givenNonEmptyCommandsToPatchWhenClearCommandsToPatchIsCalledThenCommandsAreCorrectlyCleared, IsAtLeastSkl) { HWTEST2_F(CommandListCreate, givenNonEmptyCommandsToPatchWhenClearCommandsToPatchIsCalledThenCommandsAreCorrectlyCleared, IsAtLeastSkl) {
using VFE_STATE_TYPE = typename FamilyType::VFE_STATE_TYPE; using VFE_STATE_TYPE = typename FamilyType::VFE_STATE_TYPE;

View File

@@ -373,7 +373,7 @@ class CommandStreamReceiver {
virtual SubmissionStatus initializeDeviceWithFirstSubmission() = 0; virtual SubmissionStatus initializeDeviceWithFirstSubmission() = 0;
uint32_t getNumClients() { uint32_t getNumClients() const {
return this->numClients.load(); return this->numClients.load();
} }
uint32_t registerClient() { uint32_t registerClient() {

View File

@@ -1,5 +1,5 @@
# #
# Copyright (C) 2020-2022 Intel Corporation # Copyright (C) 2020-2023 Intel Corporation
# #
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
# #
@@ -17,6 +17,7 @@ set(NEO_CORE_DIRECT_SUBMISSION
${CMAKE_CURRENT_SOURCE_DIR}/direct_submission_hw_diagnostic_mode.cpp ${CMAKE_CURRENT_SOURCE_DIR}/direct_submission_hw_diagnostic_mode.cpp
${CMAKE_CURRENT_SOURCE_DIR}/direct_submission_hw_diagnostic_mode.h ${CMAKE_CURRENT_SOURCE_DIR}/direct_submission_hw_diagnostic_mode.h
${CMAKE_CURRENT_SOURCE_DIR}/direct_submission_properties.h ${CMAKE_CURRENT_SOURCE_DIR}/direct_submission_properties.h
${CMAKE_CURRENT_SOURCE_DIR}/relaxed_ordering_helper.cpp
${CMAKE_CURRENT_SOURCE_DIR}/relaxed_ordering_helper.h ${CMAKE_CURRENT_SOURCE_DIR}/relaxed_ordering_helper.h
) )

View File

@@ -0,0 +1,30 @@
/*
* Copyright (C) 2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/direct_submission/relaxed_ordering_helper.h"
#include "shared/source/command_stream/command_stream_receiver.h"
#include "shared/source/debug_settings/debug_settings_manager.h"
namespace NEO {
namespace RelaxedOrderingHelper {
bool isRelaxedOrderingDispatchAllowed(const CommandStreamReceiver &csr, uint32_t numWaitEvents) {
if (numWaitEvents == 0u) {
return false;
}
uint32_t minimalNumberOfClients = 2;
if (DebugManager.flags.DirectSubmissionRelaxedOrderingMinNumberOfClients.get() != -1) {
minimalNumberOfClients = static_cast<uint32_t>(DebugManager.flags.DirectSubmissionRelaxedOrderingMinNumberOfClients.get());
}
return (csr.getNumClients() >= minimalNumberOfClients && csr.directSubmissionRelaxedOrderingEnabled());
}
} // namespace RelaxedOrderingHelper
} // namespace NEO

View File

@@ -11,7 +11,10 @@
#include "shared/source/command_container/encode_alu_helper.h" #include "shared/source/command_container/encode_alu_helper.h"
namespace NEO { namespace NEO {
class CommandStreamReceiver;
namespace RelaxedOrderingHelper { namespace RelaxedOrderingHelper {
bool isRelaxedOrderingDispatchAllowed(const CommandStreamReceiver &csr, uint32_t numWaitEvents);
static constexpr uint32_t queueSizeMultiplier = 4; static constexpr uint32_t queueSizeMultiplier = 4;

View File

@@ -2941,4 +2941,34 @@ HWTEST2_F(DirectSubmissionRelaxedOrderingTests, givenReturnPtrsRequiredWhenAskin
size_t sizeWitfRetPtr = directSubmission.getSizeDispatch(true, true); size_t sizeWitfRetPtr = directSubmission.getSizeDispatch(true, true);
EXPECT_EQ(baseSize + RelaxedOrderingHelper::getSizeReturnPtrRegs<FamilyType>(), sizeWitfRetPtr); EXPECT_EQ(baseSize + RelaxedOrderingHelper::getSizeReturnPtrRegs<FamilyType>(), sizeWitfRetPtr);
}
HWTEST2_F(DirectSubmissionRelaxedOrderingTests, givenNumClientsWhenAskingIfRelaxedOrderingEnabledThenReturnCorrectValue, IsAtLeastXeHpcCore) {
auto ultCsr = static_cast<UltCommandStreamReceiver<FamilyType> *>(pDevice->getDefaultEngine().commandStreamReceiver);
ultCsr->registerClient();
auto directSubmission = new NEO::MockDirectSubmissionHw<FamilyType, RenderDispatcher<FamilyType>>(*ultCsr);
ultCsr->directSubmission.reset(directSubmission);
EXPECT_EQ(1u, ultCsr->getNumClients());
EXPECT_FALSE(NEO::RelaxedOrderingHelper::isRelaxedOrderingDispatchAllowed(*ultCsr, 1));
ultCsr->registerClient();
EXPECT_EQ(2u, ultCsr->getNumClients());
EXPECT_TRUE(NEO::RelaxedOrderingHelper::isRelaxedOrderingDispatchAllowed(*ultCsr, 1));
DebugManager.flags.DirectSubmissionRelaxedOrderingMinNumberOfClients.set(4);
EXPECT_EQ(2u, ultCsr->getNumClients());
EXPECT_FALSE(NEO::RelaxedOrderingHelper::isRelaxedOrderingDispatchAllowed(*ultCsr, 1));
ultCsr->registerClient();
EXPECT_EQ(3u, ultCsr->getNumClients());
EXPECT_FALSE(NEO::RelaxedOrderingHelper::isRelaxedOrderingDispatchAllowed(*ultCsr, 1));
ultCsr->registerClient();
EXPECT_EQ(4u, ultCsr->getNumClients());
EXPECT_TRUE(NEO::RelaxedOrderingHelper::isRelaxedOrderingDispatchAllowed(*ultCsr, 1));
} }