add tracking of the state of pipeline select for command lists and queues

This change prepares infrastructure for pipeline select handling in
command lists and queues by optimization of number of commands dispatched.
State is synchronized between flush-task immediate and regular command lists.
Next step is to add optimization itself which disables legacy hw command
dispatch algorithm.
This change corrects ADL-P support for systolic mode changes.

Related-To: NEO-5019

Signed-off-by: Zbigniew Zdanowicz <zbigniew.zdanowicz@intel.com>
This commit is contained in:
Zbigniew Zdanowicz
2022-09-15 01:10:00 +00:00
committed by Compute-Runtime-Automation
parent 934939c8b6
commit 8eaa9d690e
18 changed files with 351 additions and 13 deletions

View File

@@ -2317,6 +2317,7 @@ void CommandListCoreFamily<gfxCoreFamily>::updateStreamProperties(Kernel &kernel
auto &kernelAttributes = kernel.getKernelDescriptor().kernelAttributes;
if (!containsAnyKernel) {
requiredStreamState.frontEndState.setProperties(isCooperative, kernelAttributes.flags.requiresDisabledEUFusion, disableOverdispatch, -1, hwInfo);
requiredStreamState.pipelineSelect.setProperties(true, false, kernelAttributes.flags.usesSystolicPipelineSelectMode, hwInfo);
finalStreamState = requiredStreamState;
requiredStreamState.stateComputeMode.setProperties(false, kernelAttributes.numGrfRequired, kernelAttributes.threadArbitrationPolicy, device->getDevicePreemptionMode(), hwInfo);
containsAnyKernel = true;
@@ -2353,6 +2354,8 @@ void CommandListCoreFamily<gfxCoreFamily>::updateStreamProperties(Kernel &kernel
NEO::EncodeComputeMode<GfxFamily>::programComputeModeCommandWithSynchronization(
*commandContainer.getCommandStream(), finalStreamState.stateComputeMode, {}, false, hwInfo, isRcs, nullptr);
}
finalStreamState.pipelineSelect.setProperties(true, false, kernelAttributes.flags.usesSystolicPipelineSelectMode, hwInfo);
}
template <GFXCORE_FAMILY gfxCoreFamily>

View File

@@ -160,6 +160,7 @@ struct CommandQueueHw : public CommandQueueImp {
inline void updateTaskCountAndPostSync(bool isDispatchTaskCountPostSyncRequired);
inline ze_result_t waitForCommandQueueCompletionAndCleanHeapContainer();
inline ze_result_t handleSubmissionAndCompletionResults(NEO::SubmissionStatus submitRet, ze_result_t completionRet);
inline void updatePipelineSelectState(CommandList *commandList);
size_t alignedChildStreamPadding{};
};

View File

@@ -164,6 +164,7 @@ ze_result_t CommandQueueHw<gfxCoreFamily>::executeCommandListsRegular(
for (auto i = 0u; i < numCommandLists; ++i) {
auto commandList = CommandList::fromHandle(phCommandLists[i]);
this->updateOneCmdListPreemptionModeAndCtxStatePreemption(ctx, commandList->getCommandListPreemptionMode(), child);
this->updatePipelineSelectState(commandList);
this->programOneCmdListFrontEndIfDirty(ctx, commandList, child);
this->patchCommands(*commandList, this->csr->getScratchSpaceController()->getScratchPatchAddress());
@@ -1087,4 +1088,15 @@ ze_result_t CommandQueueHw<gfxCoreFamily>::handleSubmissionAndCompletionResults(
return completionRet;
}
template <GFXCORE_FAMILY gfxCoreFamily>
void CommandQueueHw<gfxCoreFamily>::updatePipelineSelectState(CommandList *commandList) {
auto &streamProperties = this->csr->getStreamProperties();
auto &requiredStreamState = commandList->getRequiredStreamState();
auto &finalStreamState = commandList->getFinalStreamState();
streamProperties.pipelineSelect.setProperties(requiredStreamState.pipelineSelect);
streamProperties.pipelineSelect.setProperties(finalStreamState.pipelineSelect);
}
} // namespace L0

View File

@@ -71,13 +71,13 @@ void MultiTileCommandListFixtureInit::setUpParams(bool createImmediate, bool cre
event = std::unique_ptr<Event>(Event::create<uint32_t>(eventPool.get(), &eventDesc, device));
}
void MultiReturnCommandListFixture::setUp() {
DebugManager.flags.MultiReturnPointCommandList.set(1);
void ModuleMutableCommandListFixture::setUp(uint32_t revision) {
ModuleImmutableDataFixture::setUp();
auto revId = NEO::HwInfoConfig::get(device->getHwInfo().platform.eProductFamily)->getHwRevIdFromStepping(REVISION_B, device->getHwInfo());
neoDevice->getRootDeviceEnvironment().getMutableHardwareInfo()->platform.usRevId = revId;
if (revision != 0) {
auto revId = NEO::HwInfoConfig::get(device->getHwInfo().platform.eProductFamily)->getHwRevIdFromStepping(revision, device->getHwInfo());
neoDevice->getRootDeviceEnvironment().getMutableHardwareInfo()->platform.usRevId = revId;
}
ze_result_t returnValue;
@@ -105,7 +105,7 @@ void MultiReturnCommandListFixture::setUp() {
createKernel(kernel.get());
}
void MultiReturnCommandListFixture::tearDown() {
void ModuleMutableCommandListFixture::tearDown() {
commandQueue->destroy();
commandList.reset(nullptr);
kernel.reset(nullptr);
@@ -113,5 +113,10 @@ void MultiReturnCommandListFixture::tearDown() {
ModuleImmutableDataFixture::tearDown();
}
void MultiReturnCommandListFixture::setUp() {
DebugManager.flags.MultiReturnPointCommandList.set(1);
ModuleMutableCommandListFixture::setUp(REVISION_B);
}
} // namespace ult
} // namespace L0

View File

@@ -148,17 +148,24 @@ void validateTimestampRegisters(GenCmdList &cmdList,
startIt = itor;
}
struct MultiReturnCommandListFixture : public ModuleImmutableDataFixture {
void setUp();
struct ModuleMutableCommandListFixture : public ModuleImmutableDataFixture {
void setUp() {
setUp(0u);
}
void setUp(uint32_t revision);
void tearDown();
DebugManagerStateRestore restorer;
std::unique_ptr<MockImmutableData> mockKernelImmData;
std::unique_ptr<L0::ult::CommandList> commandList;
std::unique_ptr<ModuleImmutableDataFixture::MockKernel> kernel;
L0::ult::CommandQueue *commandQueue;
};
struct MultiReturnCommandListFixture : public ModuleMutableCommandListFixture {
void setUp();
DebugManagerStateRestore restorer;
};
} // namespace ult
} // namespace L0

View File

@@ -12,6 +12,7 @@
#include "level_zero/core/source/cmdlist/cmdlist.h"
#include "level_zero/core/source/fence/fence.h"
#include "level_zero/core/test/unit_tests/fixtures/cmdlist_fixture.h"
#include "level_zero/core/test/unit_tests/fixtures/device_fixture.h"
#include "level_zero/core/test/unit_tests/fixtures/module_fixture.h"
#include "level_zero/core/test/unit_tests/mocks/mock_cmdqueue.h"
@@ -532,5 +533,58 @@ HWTEST_F(PauseOnGpuTests, givenPauseModeSetToBeforeAndAfterWhenDispatchingThenIn
EXPECT_EQ(1u, pipeControlAfterWalkerFound);
}
using CmdListPipelineSelectStateTest = Test<ModuleMutableCommandListFixture>;
using SystolicSupport = IsWithinProducts<IGFX_XE_HP_SDV, IGFX_PVC>;
HWTEST2_F(CmdListPipelineSelectStateTest,
givenAppendSystolicKernelToCommandListWhenExecutingCommandListThenPipelineSelectStateIsTrackedCorrectly, SystolicSupport) {
const ze_group_count_t groupCount{1, 1, 1};
CmdListKernelLaunchParams launchParams = {};
auto &cmdlistRequiredState = commandList->getRequiredStreamState();
auto &cmdListFinalState = commandList->getFinalStreamState();
mockKernelImmData->kernelDescriptor->kernelAttributes.flags.usesSystolicPipelineSelectMode = 1;
auto result = commandList->appendLaunchKernel(kernel->toHandle(), &groupCount, nullptr, 0, nullptr, launchParams);
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
EXPECT_EQ(1, cmdlistRequiredState.pipelineSelect.systolicMode.value);
EXPECT_EQ(1, cmdListFinalState.pipelineSelect.systolicMode.value);
mockKernelImmData->kernelDescriptor->kernelAttributes.flags.usesSystolicPipelineSelectMode = 0;
result = commandList->appendLaunchKernel(kernel->toHandle(), &groupCount, nullptr, 0, nullptr, launchParams);
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
EXPECT_EQ(1, cmdlistRequiredState.pipelineSelect.systolicMode.value);
EXPECT_EQ(0, cmdListFinalState.pipelineSelect.systolicMode.value);
commandList->close();
auto &csrState = commandQueue->csr->getStreamProperties();
auto commandListHandle = commandList->toHandle();
result = commandQueue->executeCommandLists(1, &commandListHandle, nullptr, false);
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
EXPECT_EQ(0, csrState.pipelineSelect.systolicMode.value);
commandList->reset();
mockKernelImmData->kernelDescriptor->kernelAttributes.flags.usesSystolicPipelineSelectMode = 1;
result = commandList->appendLaunchKernel(kernel->toHandle(), &groupCount, nullptr, 0, nullptr, launchParams);
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
EXPECT_EQ(1, cmdlistRequiredState.pipelineSelect.systolicMode.value);
EXPECT_EQ(1, cmdListFinalState.pipelineSelect.systolicMode.value);
commandList->close();
result = commandQueue->executeCommandLists(1, &commandListHandle, nullptr, false);
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
EXPECT_EQ(1, csrState.pipelineSelect.systolicMode.value);
}
} // namespace ult
} // namespace L0

View File

@@ -58,11 +58,15 @@ inline size_t CommandStreamReceiverHw<GfxFamily>::getCmdSizeForL3Config() const
template <typename GfxFamily>
void CommandStreamReceiverHw<GfxFamily>::programPipelineSelect(LinearStream &commandStream, PipelineSelectArgs &pipelineSelectArgs) {
if (csrSizeRequestFlags.mediaSamplerConfigChanged || !isPreambleSent) {
if (csrSizeRequestFlags.mediaSamplerConfigChanged || csrSizeRequestFlags.systolicPipelineSelectMode || !isPreambleSent) {
auto &hwInfo = peekHwInfo();
if (!isPipelineSelectAlreadyProgrammed()) {
PreambleHelper<GfxFamily>::programPipelineSelect(&commandStream, pipelineSelectArgs, peekHwInfo());
pipelineSelectArgs.systolicPipelineSelectSupport = this->systolicModeConfigurable;
PreambleHelper<GfxFamily>::programPipelineSelect(&commandStream, pipelineSelectArgs, hwInfo);
}
this->lastMediaSamplerConfig = pipelineSelectArgs.mediaSamplerRequired;
this->lastSystolicPipelineSelectMode = pipelineSelectArgs.systolicPipelineSelectMode;
this->streamProperties.pipelineSelect.setProperties(true, this->lastMediaSamplerConfig, this->lastSystolicPipelineSelectMode, hwInfo);
}
}

View File

@@ -47,10 +47,12 @@ size_t CommandStreamReceiverHw<GfxFamily>::getCmdSizeForL3Config() const { retur
template <typename GfxFamily>
void CommandStreamReceiverHw<GfxFamily>::programPipelineSelect(LinearStream &commandStream, PipelineSelectArgs &pipelineSelectArgs) {
if (csrSizeRequestFlags.mediaSamplerConfigChanged || csrSizeRequestFlags.systolicPipelineSelectMode || !isPreambleSent) {
auto &hwInfo = peekHwInfo();
pipelineSelectArgs.systolicPipelineSelectSupport = this->systolicModeConfigurable;
PreambleHelper<GfxFamily>::programPipelineSelect(&commandStream, pipelineSelectArgs, peekHwInfo());
PreambleHelper<GfxFamily>::programPipelineSelect(&commandStream, pipelineSelectArgs, hwInfo);
this->lastMediaSamplerConfig = pipelineSelectArgs.mediaSamplerRequired;
this->lastSystolicPipelineSelectMode = pipelineSelectArgs.systolicPipelineSelectMode;
this->streamProperties.pipelineSelect.setProperties(true, this->lastMediaSamplerConfig, this->lastSystolicPipelineSelectMode, hwInfo);
}
}

View File

@@ -96,6 +96,19 @@ void EncodeStoreMMIO<Family>::appendFlags(MI_STORE_REGISTER_MEM *storeRegMem, bo
storeRegMem->setMmioRemapEnable(true);
}
template <>
void EncodeComputeMode<Family>::adjustPipelineSelect(CommandContainer &container, const NEO::KernelDescriptor &kernelDescriptor) {
auto &hwInfo = container.getDevice()->getHardwareInfo();
PipelineSelectArgs pipelineSelectArgs;
pipelineSelectArgs.systolicPipelineSelectMode = kernelDescriptor.kernelAttributes.flags.usesSystolicPipelineSelectMode;
pipelineSelectArgs.systolicPipelineSelectSupport = container.systolicModeSupport;
PreambleHelper<Family>::programPipelineSelect(container.getCommandStream(),
pipelineSelectArgs,
hwInfo);
}
template struct EncodeDispatchKernel<Family>;
template struct EncodeStates<Family>;
template struct EncodeMath<Family>;

View File

@@ -0,0 +1,42 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/test/common/fixtures/command_stream_receiver_fixture.h"
#include "shared/source/command_stream/preemption.h"
using namespace NEO;
void CommandStreamReceiverFixture::setUp() {
DeviceFixture::setUp();
commandStream.replaceBuffer(cmdBuffer, bufferSize);
auto graphicsAllocation = new MockGraphicsAllocation(cmdBuffer, bufferSize);
commandStream.replaceGraphicsAllocation(graphicsAllocation);
dsh.replaceBuffer(dshBuffer, bufferSize);
graphicsAllocation = new MockGraphicsAllocation(dshBuffer, bufferSize);
dsh.replaceGraphicsAllocation(graphicsAllocation);
ioh.replaceBuffer(iohBuffer, bufferSize);
graphicsAllocation = new MockGraphicsAllocation(iohBuffer, bufferSize);
ioh.replaceGraphicsAllocation(graphicsAllocation);
ssh.replaceBuffer(sshBuffer, bufferSize);
graphicsAllocation = new MockGraphicsAllocation(sshBuffer, bufferSize);
ssh.replaceGraphicsAllocation(graphicsAllocation);
flushTaskFlags.preemptionMode = PreemptionHelper::getDefaultPreemptionMode(pDevice->getHardwareInfo());
}
void CommandStreamReceiverFixture::tearDown() {
DeviceFixture::tearDown();
delete dsh.getGraphicsAllocation();
delete ioh.getGraphicsAllocation();
delete ssh.getGraphicsAllocation();
delete commandStream.getGraphicsAllocation();
}

View File

@@ -0,0 +1,33 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include "shared/source/command_stream/csr_definitions.h"
#include "shared/source/indirect_heap/indirect_heap.h"
#include "shared/test/common/fixtures/device_fixture.h"
#include "shared/test/common/helpers/dispatch_flags_helper.h"
struct CommandStreamReceiverFixture : public NEO::DeviceFixture {
void setUp();
void tearDown();
static constexpr size_t bufferSize = 256;
uint8_t cmdBuffer[bufferSize];
uint8_t dshBuffer[bufferSize];
uint8_t iohBuffer[bufferSize];
uint8_t sshBuffer[bufferSize];
NEO::LinearStream commandStream;
NEO::IndirectHeap dsh = {nullptr};
NEO::IndirectHeap ioh = {nullptr};
NEO::IndirectHeap ssh = {nullptr};
NEO::DispatchFlags flushTaskFlags = DispatchFlagsHelper::createDefaultDispatchFlags();
uint32_t taskLevel = 2;
};

View File

@@ -67,6 +67,8 @@ append_sources_from_properties(neo_libult_common_SRCS_ENABLE_TESTED_HW NEO_SRCS_
set(neo_libult_common_SRCS_LIB_ULT
${NEO_SHARED_TEST_DIRECTORY}/common/fixtures/aub_command_stream_receiver_fixture.h
${NEO_SHARED_TEST_DIRECTORY}/common/fixtures/command_stream_receiver_fixture.cpp
${NEO_SHARED_TEST_DIRECTORY}/common/fixtures/command_stream_receiver_fixture.h
${NEO_SHARED_TEST_DIRECTORY}/common/fixtures/device_fixture.cpp
${NEO_SHARED_TEST_DIRECTORY}/common/fixtures/device_fixture.h
${NEO_SHARED_TEST_DIRECTORY}/common/fixtures/gmm_callbacks_fixture.h

View File

@@ -17,6 +17,7 @@
#include "shared/source/os_interface/hw_info_config.h"
#include "shared/source/os_interface/os_interface.h"
#include "shared/source/utilities/tag_allocator.h"
#include "shared/test/common/fixtures/command_stream_receiver_fixture.h"
#include "shared/test/common/fixtures/device_fixture.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/helpers/engine_descriptor_helper.h"
@@ -2116,3 +2117,40 @@ TEST_F(CommandStreamReceiverTest, givenPreemptionSentIsInitialWhenSettingPreempt
commandStreamReceiver->setPreemptionMode(mode);
EXPECT_EQ(mode, commandStreamReceiver->getPreemptionMode());
}
using CommandStreamReceiverHwTests = Test<CommandStreamReceiverFixture>;
using SystolicSupport = IsWithinProducts<IGFX_XE_HP_SDV, IGFX_PVC>;
HWTEST2_F(CommandStreamReceiverHwTests, givenSystolicModeChangedWhenFlushTaskCalledThenSystolicStateIsUpdated, SystolicSupport) {
auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver<FamilyType>();
StreamProperties &streamProperties = commandStreamReceiver.getStreamProperties();
commandStreamReceiver.isPreambleSent = true;
commandStreamReceiver.lastMediaSamplerConfig = false;
flushTaskFlags.pipelineSelectArgs.systolicPipelineSelectMode = true;
flushTaskFlags.pipelineSelectArgs.mediaSamplerRequired = false;
commandStreamReceiver.flushTask(commandStream,
0,
&dsh,
&ioh,
&ssh,
taskLevel,
flushTaskFlags,
*pDevice);
EXPECT_EQ(true, commandStreamReceiver.lastSystolicPipelineSelectMode);
EXPECT_EQ(1, streamProperties.pipelineSelect.systolicMode.value);
flushTaskFlags.pipelineSelectArgs.systolicPipelineSelectMode = false;
commandStreamReceiver.flushTask(commandStream,
0,
&dsh,
&ioh,
&ssh,
taskLevel,
flushTaskFlags,
*pDevice);
EXPECT_EQ(false, commandStreamReceiver.lastSystolicPipelineSelectMode);
EXPECT_EQ(0, streamProperties.pipelineSelect.systolicMode.value);
}

View File

@@ -11,6 +11,7 @@ if(TESTS_GEN12LP)
${CMAKE_CURRENT_SOURCE_DIR}/command_encoder_tests_gen12lp.cpp
${CMAKE_CURRENT_SOURCE_DIR}/command_stream_receiver_simulated_common_hw_tests_gen12lp.inl
${CMAKE_CURRENT_SOURCE_DIR}/compute_mode_tests_gen12lp.inl
${CMAKE_CURRENT_SOURCE_DIR}/excludes_gen12lp.cpp
${CMAKE_CURRENT_SOURCE_DIR}/gen12lp_shared_tests_wrapper.cpp
${CMAKE_CURRENT_SOURCE_DIR}/hw_cmds_gen12lp_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/image_surface_state_tests_gen12lp.cpp

View File

@@ -7,6 +7,7 @@
if(TESTS_ADLP)
target_sources(neo_shared_tests PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
${CMAKE_CURRENT_SOURCE_DIR}/command_stream_receiver_hw_tests_adlp.cpp
${CMAKE_CURRENT_SOURCE_DIR}/excludes_adlp.cpp
${CMAKE_CURRENT_SOURCE_DIR}/preamble_helper_tests_adlp.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test_hw_info_config_adlp.cpp

View File

@@ -0,0 +1,53 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/command_stream/stream_properties.h"
#include "shared/source/gen12lp/hw_cmds_adlp.h"
#include "shared/test/common/fixtures/command_stream_receiver_fixture.h"
#include "shared/test/common/helpers/default_hw_info.h"
#include "shared/test/common/libult/ult_command_stream_receiver.h"
#include "shared/test/common/test_macros/header/per_product_test_definitions.h"
#include "shared/test/common/test_macros/test.h"
using namespace NEO;
using Gen12LpCommandStreamReceiverHwTests = Test<CommandStreamReceiverFixture>;
ADLPTEST_F(Gen12LpCommandStreamReceiverHwTests, givenSystolicModeChangedWhenFlushTaskCalledThenSystolicStateIsUpdated) {
auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver<FamilyType>();
StreamProperties &streamProperties = commandStreamReceiver.getStreamProperties();
commandStreamReceiver.isPreambleSent = true;
commandStreamReceiver.lastMediaSamplerConfig = false;
flushTaskFlags.pipelineSelectArgs.systolicPipelineSelectMode = true;
flushTaskFlags.pipelineSelectArgs.mediaSamplerRequired = false;
commandStreamReceiver.flushTask(commandStream,
0,
&dsh,
&ioh,
&ssh,
taskLevel,
flushTaskFlags,
*pDevice);
EXPECT_EQ(true, commandStreamReceiver.lastSystolicPipelineSelectMode);
EXPECT_EQ(1, streamProperties.pipelineSelect.systolicMode.value);
flushTaskFlags.pipelineSelectArgs.systolicPipelineSelectMode = false;
commandStreamReceiver.flushTask(commandStream,
0,
&dsh,
&ioh,
&ssh,
taskLevel,
flushTaskFlags,
*pDevice);
EXPECT_EQ(false, commandStreamReceiver.lastSystolicPipelineSelectMode);
EXPECT_EQ(0, streamProperties.pipelineSelect.systolicMode.value);
}

View File

@@ -0,0 +1,10 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/test/common/test_macros/hw_test_base.h"
HWTEST_EXCLUDE_PRODUCT(CommandEncodeStatesTest, whenAdjustPipelineSelectIsCalledThenNothingHappens, IGFX_GEN12LP_CORE);

View File

@@ -8,6 +8,7 @@
#include "shared/source/command_container/cmdcontainer.h"
#include "shared/source/command_container/command_encoder.h"
#include "shared/source/gmm_helper/gmm_helper.h"
#include "shared/source/helpers/pipeline_select_helper.h"
#include "shared/source/helpers/preamble.h"
#include "shared/source/os_interface/os_context.h"
#include "shared/test/common/cmd_parse/gen_cmd_parse.h"
@@ -149,3 +150,59 @@ using Gen12lpCommandEncodeTest = testing::Test;
GEN12LPTEST_F(Gen12lpCommandEncodeTest, givenBcsCommandsHelperWhenMiArbCheckWaRequiredThenReturnTrue) {
EXPECT_FALSE(BlitCommandsHelper<FamilyType>::miArbCheckWaRequired());
}
GEN12LPTEST_F(CommandEncodeStatesTest, givenGen12LpPlatformWhenAdjustPipelineSelectIsCalledThenPipelineIsDispatched) {
using PIPELINE_SELECT = typename FamilyType::PIPELINE_SELECT;
auto &hwInfo = pDevice->getHardwareInfo();
size_t barrierSize = 0;
if (MemorySynchronizationCommands<FamilyType>::isBarrierlPriorToPipelineSelectWaRequired(hwInfo)) {
barrierSize = MemorySynchronizationCommands<FamilyType>::getSizeForSingleBarrier(false);
}
auto &cmdStream = *cmdContainer->getCommandStream();
cmdContainer->systolicModeSupport = false;
descriptor.kernelAttributes.flags.usesSystolicPipelineSelectMode = true;
auto sizeUsed = cmdStream.getUsed();
void *ptr = ptrOffset(cmdStream.getCpuBase(), (barrierSize + sizeUsed));
NEO::EncodeComputeMode<FamilyType>::adjustPipelineSelect(*cmdContainer, descriptor);
auto pipelineSelectCmd = genCmdCast<PIPELINE_SELECT *>(ptr);
ASSERT_NE(nullptr, pipelineSelectCmd);
auto mask = pipelineSelectEnablePipelineSelectMaskBits | pipelineSelectMediaSamplerDopClockGateMaskBits;
EXPECT_EQ(mask, pipelineSelectCmd->getMaskBits());
EXPECT_EQ(PIPELINE_SELECT::PIPELINE_SELECTION_GPGPU, pipelineSelectCmd->getPipelineSelection());
EXPECT_EQ(true, pipelineSelectCmd->getMediaSamplerDopClockGateEnable());
EXPECT_EQ(false, pipelineSelectCmd->getSpecialModeEnable());
cmdContainer->systolicModeSupport = true;
sizeUsed = cmdStream.getUsed();
ptr = ptrOffset(cmdStream.getCpuBase(), (barrierSize + sizeUsed));
NEO::EncodeComputeMode<FamilyType>::adjustPipelineSelect(*cmdContainer, descriptor);
pipelineSelectCmd = genCmdCast<PIPELINE_SELECT *>(ptr);
ASSERT_NE(nullptr, pipelineSelectCmd);
mask |= pipelineSelectSystolicModeEnableMaskBits;
EXPECT_EQ(mask, pipelineSelectCmd->getMaskBits());
EXPECT_EQ(PIPELINE_SELECT::PIPELINE_SELECTION_GPGPU, pipelineSelectCmd->getPipelineSelection());
EXPECT_EQ(true, pipelineSelectCmd->getMediaSamplerDopClockGateEnable());
EXPECT_EQ(true, pipelineSelectCmd->getSpecialModeEnable());
descriptor.kernelAttributes.flags.usesSystolicPipelineSelectMode = false;
sizeUsed = cmdStream.getUsed();
ptr = ptrOffset(cmdStream.getCpuBase(), (barrierSize + sizeUsed));
NEO::EncodeComputeMode<FamilyType>::adjustPipelineSelect(*cmdContainer, descriptor);
pipelineSelectCmd = genCmdCast<PIPELINE_SELECT *>(ptr);
ASSERT_NE(nullptr, pipelineSelectCmd);
EXPECT_EQ(mask, pipelineSelectCmd->getMaskBits());
EXPECT_EQ(PIPELINE_SELECT::PIPELINE_SELECTION_GPGPU, pipelineSelectCmd->getPipelineSelection());
EXPECT_EQ(true, pipelineSelectCmd->getMediaSamplerDopClockGateEnable());
EXPECT_EQ(false, pipelineSelectCmd->getSpecialModeEnable());
}