mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-08 22:12:59 +08:00
refactor: reposition preamble helper implementation methods
Signed-off-by: Zbigniew Zdanowicz <zbigniew.zdanowicz@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
ad3aeb6eea
commit
2e09b5ff66
@@ -1109,55 +1109,6 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrWhenPreambleNotSentThenReq
|
||||
EXPECT_EQ(mediaSamplerConfigChangedSize, mediaSamplerConfigNotChangedSize);
|
||||
}
|
||||
|
||||
HWTEST2_F(CommandStreamReceiverFlushTaskTests, givenSpecialPipelineSelectModeChangedWhenGetCmdSizeForPielineSelectIsCalledThenCorrectSizeIsReturned, IsAtMostXeHpcCore) {
|
||||
using PIPELINE_SELECT = typename FamilyType::PIPELINE_SELECT;
|
||||
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;
|
||||
|
||||
UltCommandStreamReceiver<FamilyType> &commandStreamReceiver = (UltCommandStreamReceiver<FamilyType> &)pDevice->getGpgpuCommandStreamReceiver();
|
||||
|
||||
CsrSizeRequestFlags csrSizeRequest = {};
|
||||
DispatchFlags flags = DispatchFlagsHelper::createDefaultDispatchFlags();
|
||||
|
||||
csrSizeRequest.systolicPipelineSelectMode = true;
|
||||
commandStreamReceiver.overrideCsrSizeReqFlags(csrSizeRequest);
|
||||
size_t size = commandStreamReceiver.getCmdSizeForPipelineSelect();
|
||||
|
||||
size_t expectedSize = sizeof(PIPELINE_SELECT);
|
||||
if (MemorySynchronizationCommands<FamilyType>::isBarrierPriorToPipelineSelectWaRequired(pDevice->getRootDeviceEnvironment())) {
|
||||
expectedSize += sizeof(PIPE_CONTROL);
|
||||
}
|
||||
EXPECT_EQ(expectedSize, size);
|
||||
}
|
||||
|
||||
HWTEST2_F(CommandStreamReceiverFlushTaskTests, givenCsrWhenPreambleSentThenRequiredCsrSizeDependsOnmediaSamplerConfigChanged, IsAtMostXeHpcCore) {
|
||||
using PIPELINE_SELECT = typename FamilyType::PIPELINE_SELECT;
|
||||
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;
|
||||
|
||||
UltCommandStreamReceiver<FamilyType> &commandStreamReceiver = (UltCommandStreamReceiver<FamilyType> &)pDevice->getGpgpuCommandStreamReceiver();
|
||||
CsrSizeRequestFlags csrSizeRequest = {};
|
||||
DispatchFlags flags = DispatchFlagsHelper::createDefaultDispatchFlags();
|
||||
|
||||
commandStreamReceiver.isPreambleSent = true;
|
||||
|
||||
csrSizeRequest.mediaSamplerConfigChanged = false;
|
||||
commandStreamReceiver.overrideCsrSizeReqFlags(csrSizeRequest);
|
||||
auto mediaSamplerConfigNotChangedSize = commandStreamReceiver.getRequiredCmdStreamSize(flags, *pDevice);
|
||||
|
||||
csrSizeRequest.mediaSamplerConfigChanged = true;
|
||||
commandStreamReceiver.overrideCsrSizeReqFlags(csrSizeRequest);
|
||||
auto mediaSamplerConfigChangedSize = commandStreamReceiver.getRequiredCmdStreamSize(flags, *pDevice);
|
||||
|
||||
EXPECT_NE(mediaSamplerConfigChangedSize, mediaSamplerConfigNotChangedSize);
|
||||
auto difference = mediaSamplerConfigChangedSize - mediaSamplerConfigNotChangedSize;
|
||||
|
||||
size_t expectedDifference = sizeof(PIPELINE_SELECT);
|
||||
if (MemorySynchronizationCommands<FamilyType>::isBarrierPriorToPipelineSelectWaRequired(pDevice->getRootDeviceEnvironment())) {
|
||||
expectedDifference += sizeof(PIPE_CONTROL);
|
||||
}
|
||||
|
||||
EXPECT_EQ(expectedDifference, difference);
|
||||
}
|
||||
|
||||
HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrWhenSamplerCacheFlushSentThenRequiredCsrSizeContainsPipecontrolSize) {
|
||||
typedef typename FamilyType::PIPELINE_SELECT PIPELINE_SELECT;
|
||||
UltCommandStreamReceiver<FamilyType> &commandStreamReceiver = (UltCommandStreamReceiver<FamilyType> &)pDevice->getGpgpuCommandStreamReceiver();
|
||||
|
||||
@@ -148,29 +148,6 @@ HWTEST_F(UltCommandStreamReceiverTest, givenPreambleSentAndThreadArbitrationPoli
|
||||
EXPECT_EQ(expectedDifference, actualDifferenceForFlush);
|
||||
}
|
||||
|
||||
HWTEST_F(UltCommandStreamReceiverTest, givenPreambleSentWhenEstimatingFlushTaskSizeThenResultDependsOnAdditionalCmdsSize) {
|
||||
auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver<FamilyType>();
|
||||
|
||||
commandStreamReceiver.isPreambleSent = false;
|
||||
auto preambleNotSentPreamble = commandStreamReceiver.getRequiredCmdSizeForPreamble(*pDevice);
|
||||
auto preambleNotSentFlush = commandStreamReceiver.getRequiredCmdStreamSize(flushTaskFlags, *pDevice);
|
||||
|
||||
commandStreamReceiver.isPreambleSent = true;
|
||||
auto preambleSentPreamble = commandStreamReceiver.getRequiredCmdSizeForPreamble(*pDevice);
|
||||
auto preambleSentFlush = commandStreamReceiver.getRequiredCmdStreamSize(flushTaskFlags, *pDevice);
|
||||
|
||||
auto actualDifferenceForPreamble = preambleNotSentPreamble - preambleSentPreamble;
|
||||
auto actualDifferenceForFlush = preambleNotSentFlush - preambleSentFlush;
|
||||
|
||||
commandStreamReceiver.isPreambleSent = false;
|
||||
auto expectedDifferenceForPreamble = PreambleHelper<FamilyType>::getAdditionalCommandsSize(*pDevice);
|
||||
auto expectedDifferenceForFlush = expectedDifferenceForPreamble + commandStreamReceiver.getCmdSizeForL3Config() +
|
||||
PreambleHelper<FamilyType>::getCmdSizeForPipelineSelect(pDevice->getRootDeviceEnvironment());
|
||||
|
||||
EXPECT_EQ(expectedDifferenceForPreamble, actualDifferenceForPreamble);
|
||||
EXPECT_EQ(expectedDifferenceForFlush, actualDifferenceForFlush);
|
||||
}
|
||||
|
||||
HWCMDTEST_F(IGFX_GEN8_CORE, UltCommandStreamReceiverTest, givenMediaVfeStateDirtyEstimatingPreambleCmdSizeThenResultDependsVfeStateProgrammingCmdSize) {
|
||||
typedef typename FamilyType::MEDIA_VFE_STATE MEDIA_VFE_STATE;
|
||||
typedef typename FamilyType::PIPE_CONTROL PIPE_CONTROL;
|
||||
|
||||
@@ -36,23 +36,6 @@ HWTEST2_F(ThreadArbitrationXeHPAndLater, whenGetDefaultThreadArbitrationPolicyIs
|
||||
}
|
||||
|
||||
using ProgramPipelineXeHPAndLater = PreambleFixture;
|
||||
HWTEST2_F(ProgramPipelineXeHPAndLater, whenCleanStateInPreambleIsSetAndProgramPipelineSelectIsCalledThenExtraPipelineSelectAndTwoExtraPipeControlsAdded, IsWithinXeGfxFamily) {
|
||||
typedef typename FamilyType::PIPELINE_SELECT PIPELINE_SELECT;
|
||||
typedef typename FamilyType::PIPE_CONTROL PIPE_CONTROL;
|
||||
DebugManagerStateRestore stateRestore;
|
||||
DebugManager.flags.CleanStateInPreamble.set(true);
|
||||
|
||||
LinearStream &cs = linearStream;
|
||||
PipelineSelectArgs pipelineArgs;
|
||||
PreambleHelper<FamilyType>::programPipelineSelect(&cs, pipelineArgs, pDevice->getRootDeviceEnvironment());
|
||||
|
||||
parseCommands<FamilyType>(cs, 0);
|
||||
auto numPipeControl = getCommandsList<PIPE_CONTROL>().size();
|
||||
EXPECT_EQ(2u, numPipeControl);
|
||||
auto numPipelineSelect = getCommandsList<PIPELINE_SELECT>().size();
|
||||
EXPECT_EQ(2u, numPipelineSelect);
|
||||
}
|
||||
|
||||
HWTEST2_F(ProgramPipelineXeHPAndLater, givenDebugVariableWhenProgramPipelineSelectIsCalledThenItHasProperFieldsSet, IsWithinXeGfxFamily) {
|
||||
typedef typename FamilyType::PIPELINE_SELECT PIPELINE_SELECT;
|
||||
DebugManagerStateRestore stateRestore;
|
||||
|
||||
@@ -63,6 +63,17 @@ void PreambleHelper<Family>::programPipelineSelect(LinearStream *pCommandStream,
|
||||
*cmdSpace = pipelineSelectCmd;
|
||||
}
|
||||
|
||||
template <>
|
||||
size_t PreambleHelper<Family>::getCmdSizeForPipelineSelect(const RootDeviceEnvironment &rootDeviceEnvironment) {
|
||||
size_t size = 0;
|
||||
using PIPELINE_SELECT = typename Family::PIPELINE_SELECT;
|
||||
size += sizeof(PIPELINE_SELECT);
|
||||
if (MemorySynchronizationCommands<Family>::isBarrierPriorToPipelineSelectWaRequired(rootDeviceEnvironment)) {
|
||||
size += sizeof(PIPE_CONTROL);
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
||||
template <>
|
||||
void PreambleHelper<Family>::addPipeControlBeforeVfeCmd(LinearStream *pCommandStream, const HardwareInfo *hwInfo, EngineGroupType engineGroupType) {
|
||||
PipeControlArgs args = {};
|
||||
|
||||
@@ -173,6 +173,12 @@ if(SUPPORT_XEHP_AND_LATER)
|
||||
)
|
||||
endif()
|
||||
|
||||
if(SUPPORT_XE_HPG_CORE OR SUPPORT_XE_HPC_CORE)
|
||||
list(APPEND NEO_CORE_HELPERS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/preamble_xe_hpg_and_xe_hpc.inl
|
||||
)
|
||||
endif()
|
||||
|
||||
if(SUPPORT_DG2_AND_LATER)
|
||||
list(APPEND NEO_CORE_HELPERS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/gfx_core_helper_dg2_and_later.inl
|
||||
|
||||
@@ -53,17 +53,6 @@ size_t PreambleHelper<GfxFamily>::getAdditionalCommandsSize(const Device &device
|
||||
return totalSize;
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
size_t PreambleHelper<GfxFamily>::getCmdSizeForPipelineSelect(const RootDeviceEnvironment &rootDeviceEnvironment) {
|
||||
size_t size = 0;
|
||||
using PIPELINE_SELECT = typename GfxFamily::PIPELINE_SELECT;
|
||||
size += sizeof(PIPELINE_SELECT);
|
||||
if (MemorySynchronizationCommands<GfxFamily>::isBarrierPriorToPipelineSelectWaRequired(rootDeviceEnvironment)) {
|
||||
size += sizeof(PIPE_CONTROL);
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
void PreambleHelper<GfxFamily>::programPreamble(LinearStream *pCommandStream, Device &device, uint32_t l3Config,
|
||||
GraphicsAllocation *preemptionCsr) {
|
||||
@@ -86,9 +75,6 @@ size_t PreambleHelper<GfxFamily>::getKernelDebuggingCommandsSize(bool debuggingA
|
||||
return 0;
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
void PreambleHelper<GfxFamily>::appendProgramVFEState(const RootDeviceEnvironment &rootDeviceEnvironment, const StreamProperties &streamProperties, void *cmd) {}
|
||||
|
||||
template <typename GfxFamily>
|
||||
uint32_t PreambleHelper<GfxFamily>::getScratchSizeValueToProgramMediaVfeState(uint32_t scratchSize) {
|
||||
scratchSize >>= static_cast<uint32_t>(MemoryConstants::kiloByteShiftSize);
|
||||
|
||||
@@ -73,4 +73,13 @@ size_t PreambleHelper<GfxFamily>::getVFECommandsSize() {
|
||||
return sizeof(MEDIA_VFE_STATE) + sizeof(PIPE_CONTROL);
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
void PreambleHelper<GfxFamily>::appendProgramVFEState(const RootDeviceEnvironment &rootDeviceEnvironment, const StreamProperties &streamProperties, void *cmd) {}
|
||||
|
||||
template <typename GfxFamily>
|
||||
size_t PreambleHelper<GfxFamily>::getCmdSizeForPipelineSelect(const RootDeviceEnvironment &rootDeviceEnvironment) {
|
||||
using PIPELINE_SELECT = typename GfxFamily::PIPELINE_SELECT;
|
||||
return sizeof(PIPELINE_SELECT);
|
||||
}
|
||||
|
||||
} // namespace NEO
|
||||
|
||||
85
shared/source/helpers/preamble_xe_hpg_and_xe_hpc.inl
Normal file
85
shared/source/helpers/preamble_xe_hpg_and_xe_hpc.inl
Normal file
@@ -0,0 +1,85 @@
|
||||
/*
|
||||
* Copyright (C) 2023 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/command_stream/linear_stream.h"
|
||||
#include "shared/source/command_stream/stream_properties.h"
|
||||
#include "shared/source/debug_settings/debug_settings_manager.h"
|
||||
#include "shared/source/helpers/gfx_core_helper.h"
|
||||
#include "shared/source/helpers/pipe_control_args.h"
|
||||
#include "shared/source/helpers/pipeline_select_args.h"
|
||||
#include "shared/source/helpers/pipeline_select_helper.h"
|
||||
#include "shared/source/helpers/preamble.h"
|
||||
|
||||
namespace NEO {
|
||||
|
||||
template <typename Family>
|
||||
void PreambleHelper<Family>::programPipelineSelect(LinearStream *pCommandStream,
|
||||
const PipelineSelectArgs &pipelineSelectArgs,
|
||||
const RootDeviceEnvironment &rootDeviceEnvironment) {
|
||||
|
||||
using PIPELINE_SELECT = typename Family::PIPELINE_SELECT;
|
||||
|
||||
PIPELINE_SELECT cmd = Family::cmdInitPipelineSelect;
|
||||
|
||||
if (DebugManager.flags.CleanStateInPreamble.get()) {
|
||||
auto cmdBuffer = pCommandStream->getSpaceForCmd<PIPELINE_SELECT>();
|
||||
cmd.setPipelineSelection(PIPELINE_SELECT::PIPELINE_SELECTION_3D);
|
||||
*cmdBuffer = cmd;
|
||||
|
||||
PipeControlArgs args = {};
|
||||
args.stateCacheInvalidationEnable = true;
|
||||
MemorySynchronizationCommands<Family>::addSingleBarrier(*pCommandStream, args);
|
||||
}
|
||||
|
||||
auto cmdBuffer = pCommandStream->getSpaceForCmd<PIPELINE_SELECT>();
|
||||
|
||||
auto mask = pipelineSelectEnablePipelineSelectMaskBits;
|
||||
|
||||
cmd.setPipelineSelection(PIPELINE_SELECT::PIPELINE_SELECTION_GPGPU);
|
||||
if constexpr (Family::isUsingMediaSamplerDopClockGate) {
|
||||
mask |= pipelineSelectMediaSamplerDopClockGateMaskBits;
|
||||
cmd.setMediaSamplerDopClockGateEnable(!pipelineSelectArgs.mediaSamplerRequired);
|
||||
}
|
||||
|
||||
bool systolicSupport = pipelineSelectArgs.systolicPipelineSelectSupport;
|
||||
bool systolicValue = pipelineSelectArgs.systolicPipelineSelectMode;
|
||||
int32_t overrideSystolic = DebugManager.flags.OverrideSystolicPipelineSelect.get();
|
||||
|
||||
if (overrideSystolic != -1) {
|
||||
systolicSupport = true;
|
||||
systolicValue = !!overrideSystolic;
|
||||
}
|
||||
|
||||
if (systolicSupport) {
|
||||
cmd.setSystolicModeEnable(systolicValue);
|
||||
mask |= pipelineSelectSystolicModeEnableMaskBits;
|
||||
}
|
||||
|
||||
cmd.setMaskBits(mask);
|
||||
|
||||
*cmdBuffer = cmd;
|
||||
|
||||
if (DebugManager.flags.CleanStateInPreamble.get()) {
|
||||
PipeControlArgs args = {};
|
||||
args.stateCacheInvalidationEnable = true;
|
||||
MemorySynchronizationCommands<Family>::addSingleBarrier(*pCommandStream, args);
|
||||
}
|
||||
}
|
||||
|
||||
template <typename Family>
|
||||
size_t PreambleHelper<Family>::getCmdSizeForPipelineSelect(const RootDeviceEnvironment &rootDeviceEnvironment) {
|
||||
size_t size = 0;
|
||||
using PIPELINE_SELECT = typename Family::PIPELINE_SELECT;
|
||||
size += sizeof(PIPELINE_SELECT);
|
||||
if (DebugManager.flags.CleanStateInPreamble.get()) {
|
||||
size += sizeof(PIPELINE_SELECT);
|
||||
size += 2 * MemorySynchronizationCommands<Family>::getSizeForSingleBarrier(false);
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
||||
} // namespace NEO
|
||||
@@ -15,82 +15,20 @@
|
||||
|
||||
#include "reg_configs_common.h"
|
||||
|
||||
// L3 programming:
|
||||
// All L3 Client Pool: 320KB
|
||||
// URB Pool: 64KB
|
||||
// Use Full ways: true
|
||||
// SLM: reserved (always enabled)
|
||||
|
||||
namespace NEO {
|
||||
|
||||
template <typename Family>
|
||||
void PreambleHelper<Family>::programPipelineSelect(LinearStream *pCommandStream,
|
||||
const PipelineSelectArgs &pipelineSelectArgs,
|
||||
const RootDeviceEnvironment &rootDeviceEnvironment) {
|
||||
|
||||
using PIPELINE_SELECT = typename Family::PIPELINE_SELECT;
|
||||
|
||||
PIPELINE_SELECT cmd = Family::cmdInitPipelineSelect;
|
||||
|
||||
if (DebugManager.flags.CleanStateInPreamble.get()) {
|
||||
auto cmdBuffer = pCommandStream->getSpaceForCmd<PIPELINE_SELECT>();
|
||||
cmd.setPipelineSelection(PIPELINE_SELECT::PIPELINE_SELECTION_3D);
|
||||
*cmdBuffer = cmd;
|
||||
|
||||
PipeControlArgs args = {};
|
||||
args.stateCacheInvalidationEnable = true;
|
||||
MemorySynchronizationCommands<Family>::addSingleBarrier(*pCommandStream, args);
|
||||
template <typename GfxFamily>
|
||||
void PreambleHelper<GfxFamily>::addPipeControlBeforeVfeCmd(LinearStream *pCommandStream, const HardwareInfo *hwInfo, EngineGroupType engineGroupType) {
|
||||
}
|
||||
|
||||
auto cmdBuffer = pCommandStream->getSpaceForCmd<PIPELINE_SELECT>();
|
||||
|
||||
auto mask = pipelineSelectEnablePipelineSelectMaskBits;
|
||||
|
||||
cmd.setPipelineSelection(PIPELINE_SELECT::PIPELINE_SELECTION_GPGPU);
|
||||
if constexpr (Family::isUsingMediaSamplerDopClockGate) {
|
||||
mask |= pipelineSelectMediaSamplerDopClockGateMaskBits;
|
||||
cmd.setMediaSamplerDopClockGateEnable(!pipelineSelectArgs.mediaSamplerRequired);
|
||||
template <typename GfxFamily>
|
||||
void PreambleHelper<GfxFamily>::programL3(LinearStream *pCommandStream, uint32_t l3Config) {
|
||||
}
|
||||
|
||||
bool systolicSupport = pipelineSelectArgs.systolicPipelineSelectSupport;
|
||||
bool systolicValue = pipelineSelectArgs.systolicPipelineSelectMode;
|
||||
int32_t overrideSystolic = DebugManager.flags.OverrideSystolicPipelineSelect.get();
|
||||
|
||||
if (overrideSystolic != -1) {
|
||||
systolicSupport = true;
|
||||
systolicValue = !!overrideSystolic;
|
||||
}
|
||||
|
||||
if (systolicSupport) {
|
||||
cmd.setSystolicModeEnable(systolicValue);
|
||||
mask |= pipelineSelectSystolicModeEnableMaskBits;
|
||||
}
|
||||
|
||||
cmd.setMaskBits(mask);
|
||||
|
||||
*cmdBuffer = cmd;
|
||||
|
||||
if (DebugManager.flags.CleanStateInPreamble.get()) {
|
||||
PipeControlArgs args = {};
|
||||
args.stateCacheInvalidationEnable = true;
|
||||
MemorySynchronizationCommands<Family>::addSingleBarrier(*pCommandStream, args);
|
||||
}
|
||||
}
|
||||
|
||||
template <>
|
||||
void PreambleHelper<Family>::addPipeControlBeforeVfeCmd(LinearStream *pCommandStream, const HardwareInfo *hwInfo, EngineGroupType engineGroupType) {
|
||||
}
|
||||
|
||||
template <>
|
||||
void PreambleHelper<Family>::programL3(LinearStream *pCommandStream, uint32_t l3Config) {
|
||||
}
|
||||
|
||||
template <>
|
||||
uint32_t PreambleHelper<Family>::getUrbEntryAllocationSize() {
|
||||
template <typename GfxFamily>
|
||||
uint32_t PreambleHelper<GfxFamily>::getUrbEntryAllocationSize() {
|
||||
return 0u;
|
||||
}
|
||||
template <>
|
||||
void PreambleHelper<Family>::appendProgramVFEState(const RootDeviceEnvironment &rootDeviceEnvironment, const StreamProperties &streamProperties, void *cmd);
|
||||
|
||||
template <typename GfxFamily>
|
||||
void *PreambleHelper<GfxFamily>::getSpaceForVfeState(LinearStream *pCommandStream,
|
||||
@@ -130,8 +68,8 @@ void PreambleHelper<GfxFamily>::programVfeState(void *pVfeState,
|
||||
*cfeState = cmd;
|
||||
}
|
||||
|
||||
template <>
|
||||
uint64_t PreambleHelper<Family>::getScratchSpaceAddressOffsetForVfeState(LinearStream *pCommandStream, void *pVfeState) {
|
||||
template <typename GfxFamily>
|
||||
uint64_t PreambleHelper<GfxFamily>::getScratchSpaceAddressOffsetForVfeState(LinearStream *pCommandStream, void *pVfeState) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -141,8 +79,8 @@ size_t PreambleHelper<GfxFamily>::getVFECommandsSize() {
|
||||
return sizeof(CFE_STATE);
|
||||
}
|
||||
|
||||
template <>
|
||||
uint32_t PreambleHelper<Family>::getL3Config(const HardwareInfo &hwInfo, bool useSLM) {
|
||||
template <typename GfxFamily>
|
||||
uint32_t PreambleHelper<GfxFamily>::getL3Config(const HardwareInfo &hwInfo, bool useSLM) {
|
||||
return 0u;
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ using Family = XeHpcCoreFamily;
|
||||
} // namespace NEO
|
||||
|
||||
#include "shared/source/command_stream/stream_properties.h"
|
||||
#include "shared/source/helpers/preamble_xe_hpg_and_xe_hpc.inl"
|
||||
#include "shared/source/helpers/preamble_xehp_and_later.inl"
|
||||
#include "shared/source/os_interface/product_helper.h"
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2021-2022 Intel Corporation
|
||||
* Copyright (C) 2021-2023 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -13,6 +13,7 @@ struct XeHpgCoreFamily;
|
||||
using Family = XeHpgCoreFamily;
|
||||
} // namespace NEO
|
||||
|
||||
#include "shared/source/helpers/preamble_xe_hpg_and_xe_hpc.inl"
|
||||
#include "shared/source/helpers/preamble_xehp_and_later.inl"
|
||||
|
||||
namespace NEO {
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include "shared/source/gmm_helper/page_table_mngr.h"
|
||||
#include "shared/source/helpers/api_specific_config.h"
|
||||
#include "shared/source/helpers/basic_math.h"
|
||||
#include "shared/source/helpers/preamble.h"
|
||||
#include "shared/source/indirect_heap/indirect_heap.h"
|
||||
#include "shared/source/memory_manager/internal_allocation_storage.h"
|
||||
#include "shared/source/memory_manager/surface.h"
|
||||
@@ -4672,3 +4673,75 @@ HWTEST_F(CommandStreamReceiverHwTest, GivenFlushHeapStorageRequiresRecyclingTagW
|
||||
EXPECT_TRUE(commandStreamReceiver.latestFlushedBatchBuffer.dispatchMonitorFence);
|
||||
EXPECT_EQ(24u, commandStreamReceiver.peekLatestFlushedTaskCount());
|
||||
}
|
||||
|
||||
HWTEST2_F(CommandStreamReceiverHwTest, givenSpecialPipelineSelectModeChangedWhenGetCmdSizeForPielineSelectIsCalledThenCorrectSizeIsReturned, IsAtMostXeHpcCore) {
|
||||
using PIPELINE_SELECT = typename FamilyType::PIPELINE_SELECT;
|
||||
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;
|
||||
|
||||
auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver<FamilyType>();
|
||||
|
||||
CsrSizeRequestFlags csrSizeRequest = {};
|
||||
DispatchFlags flags = DispatchFlagsHelper::createDefaultDispatchFlags();
|
||||
|
||||
csrSizeRequest.systolicPipelineSelectMode = true;
|
||||
commandStreamReceiver.overrideCsrSizeReqFlags(csrSizeRequest);
|
||||
size_t size = commandStreamReceiver.getCmdSizeForPipelineSelect();
|
||||
|
||||
size_t expectedSize = sizeof(PIPELINE_SELECT);
|
||||
if (MemorySynchronizationCommands<FamilyType>::isBarrierPriorToPipelineSelectWaRequired(pDevice->getRootDeviceEnvironment())) {
|
||||
expectedSize += sizeof(PIPE_CONTROL);
|
||||
}
|
||||
EXPECT_EQ(expectedSize, size);
|
||||
}
|
||||
|
||||
HWTEST2_F(CommandStreamReceiverHwTest, givenCsrWhenPreambleSentThenRequiredCsrSizeDependsOnmediaSamplerConfigChanged, IsAtMostXeHpcCore) {
|
||||
using PIPELINE_SELECT = typename FamilyType::PIPELINE_SELECT;
|
||||
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;
|
||||
|
||||
auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver<FamilyType>();
|
||||
CsrSizeRequestFlags csrSizeRequest = {};
|
||||
DispatchFlags flags = DispatchFlagsHelper::createDefaultDispatchFlags();
|
||||
|
||||
commandStreamReceiver.isPreambleSent = true;
|
||||
|
||||
csrSizeRequest.mediaSamplerConfigChanged = false;
|
||||
commandStreamReceiver.overrideCsrSizeReqFlags(csrSizeRequest);
|
||||
auto mediaSamplerConfigNotChangedSize = commandStreamReceiver.getRequiredCmdStreamSize(flags, *pDevice);
|
||||
|
||||
csrSizeRequest.mediaSamplerConfigChanged = true;
|
||||
commandStreamReceiver.overrideCsrSizeReqFlags(csrSizeRequest);
|
||||
auto mediaSamplerConfigChangedSize = commandStreamReceiver.getRequiredCmdStreamSize(flags, *pDevice);
|
||||
|
||||
EXPECT_NE(mediaSamplerConfigChangedSize, mediaSamplerConfigNotChangedSize);
|
||||
auto difference = mediaSamplerConfigChangedSize - mediaSamplerConfigNotChangedSize;
|
||||
|
||||
size_t expectedDifference = sizeof(PIPELINE_SELECT);
|
||||
if (MemorySynchronizationCommands<FamilyType>::isBarrierPriorToPipelineSelectWaRequired(pDevice->getRootDeviceEnvironment())) {
|
||||
expectedDifference += sizeof(PIPE_CONTROL);
|
||||
}
|
||||
|
||||
EXPECT_EQ(expectedDifference, difference);
|
||||
}
|
||||
|
||||
HWTEST_F(CommandStreamReceiverHwTest, givenPreambleSentWhenEstimatingFlushTaskSizeThenResultDependsOnAdditionalCmdsSize) {
|
||||
auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver<FamilyType>();
|
||||
|
||||
commandStreamReceiver.isPreambleSent = false;
|
||||
auto preambleNotSentPreamble = commandStreamReceiver.getRequiredCmdSizeForPreamble(*pDevice);
|
||||
auto preambleNotSentFlush = commandStreamReceiver.getRequiredCmdStreamSize(flushTaskFlags, *pDevice);
|
||||
|
||||
commandStreamReceiver.isPreambleSent = true;
|
||||
auto preambleSentPreamble = commandStreamReceiver.getRequiredCmdSizeForPreamble(*pDevice);
|
||||
auto preambleSentFlush = commandStreamReceiver.getRequiredCmdStreamSize(flushTaskFlags, *pDevice);
|
||||
|
||||
auto actualDifferenceForPreamble = preambleNotSentPreamble - preambleSentPreamble;
|
||||
auto actualDifferenceForFlush = preambleNotSentFlush - preambleSentFlush;
|
||||
|
||||
commandStreamReceiver.isPreambleSent = false;
|
||||
auto expectedDifferenceForPreamble = PreambleHelper<FamilyType>::getAdditionalCommandsSize(*pDevice);
|
||||
auto expectedDifferenceForFlush = expectedDifferenceForPreamble + commandStreamReceiver.getCmdSizeForL3Config() +
|
||||
PreambleHelper<FamilyType>::getCmdSizeForPipelineSelect(pDevice->getRootDeviceEnvironment());
|
||||
|
||||
EXPECT_EQ(expectedDifferenceForPreamble, actualDifferenceForPreamble);
|
||||
EXPECT_EQ(expectedDifferenceForFlush, actualDifferenceForFlush);
|
||||
}
|
||||
|
||||
@@ -179,3 +179,10 @@ GEN11TEST_F(ThreadArbitrationGen11, whenGetSupportThreadArbitrationPoliciesIsCal
|
||||
supportedPolicies.end(),
|
||||
ThreadArbitrationPolicy::RoundRobinAfterDependency));
|
||||
}
|
||||
|
||||
using Gen11PreamblePipelineSelect = PreambleFixture;
|
||||
GEN11TEST_F(Gen11PreamblePipelineSelect, WhenPreambleRetrievesPipelineSelectSizeThenValueIsCorrect) {
|
||||
using PIPELINE_SELECT = typename FamilyType::PIPELINE_SELECT;
|
||||
size_t actualVal = PreambleHelper<FamilyType>::getCmdSizeForPipelineSelect(pDevice->getRootDeviceEnvironment());
|
||||
EXPECT_EQ(sizeof(PIPELINE_SELECT), actualVal);
|
||||
}
|
||||
|
||||
@@ -108,3 +108,10 @@ BDWTEST_F(PreambleVfeState, WhenProgrammingVfeStateThenProgrammingIsCorrect) {
|
||||
EXPECT_TRUE(pc.getDcFlushEnable());
|
||||
EXPECT_EQ(1u, pc.getCommandStreamerStallEnable());
|
||||
}
|
||||
|
||||
using Gen8PreamblePipelineSelect = PreambleFixture;
|
||||
BDWTEST_F(Gen8PreamblePipelineSelect, WhenPreambleRetrievesPipelineSelectSizeThenValueIsCorrect) {
|
||||
using PIPELINE_SELECT = typename FamilyType::PIPELINE_SELECT;
|
||||
size_t actualVal = PreambleHelper<FamilyType>::getCmdSizeForPipelineSelect(pDevice->getRootDeviceEnvironment());
|
||||
EXPECT_EQ(sizeof(PIPELINE_SELECT), actualVal);
|
||||
}
|
||||
|
||||
@@ -130,3 +130,10 @@ GEN9TEST_F(PreambleVfeState, GivenWaOnWhenProgrammingVfeStateThenProgrammingIsCo
|
||||
EXPECT_TRUE(pc.getDcFlushEnable());
|
||||
EXPECT_EQ(1u, pc.getCommandStreamerStallEnable());
|
||||
}
|
||||
|
||||
using Gen9PreamblePipelineSelect = PreambleFixture;
|
||||
GEN9TEST_F(Gen9PreamblePipelineSelect, WhenPreambleRetrievesPipelineSelectSizeThenValueIsCorrect) {
|
||||
using PIPELINE_SELECT = typename FamilyType::PIPELINE_SELECT;
|
||||
size_t actualVal = PreambleHelper<FamilyType>::getCmdSizeForPipelineSelect(pDevice->getRootDeviceEnvironment());
|
||||
EXPECT_EQ(sizeof(PIPELINE_SELECT), actualVal);
|
||||
}
|
||||
|
||||
@@ -11,9 +11,11 @@
|
||||
#include "shared/source/gen_common/reg_configs_common.h"
|
||||
#include "shared/source/helpers/flat_batch_buffer_helper_hw.h"
|
||||
#include "shared/source/helpers/gfx_core_helper.h"
|
||||
#include "shared/source/helpers/pipeline_select_args.h"
|
||||
#include "shared/source/helpers/preamble.h"
|
||||
#include "shared/source/utilities/stackvec.h"
|
||||
#include "shared/test/common/cmd_parse/hw_parse.h"
|
||||
#include "shared/test/common/fixtures/preamble_fixture.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/helpers/unit_test_helper.h"
|
||||
#include "shared/test/common/mocks/mock_device.h"
|
||||
@@ -249,3 +251,50 @@ HWTEST_F(PreambleTest, givenNotSetForceSemaphoreDelayBetweenWaitsWhenProgramSema
|
||||
auto cmdList = hwParser.getCommandsList<MI_LOAD_REGISTER_IMM>();
|
||||
ASSERT_EQ(0u, cmdList.size());
|
||||
}
|
||||
|
||||
HWTEST2_F(PreambleTest, whenCleanStateInPreambleIsSetAndProgramPipelineSelectIsCalledThenExtraPipelineSelectAndTwoExtraPipeControlsAdded, IsWithinXeGfxFamily) {
|
||||
using PIPELINE_SELECT = typename FamilyType::PIPELINE_SELECT;
|
||||
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;
|
||||
|
||||
DebugManagerStateRestore stateRestore;
|
||||
DebugManager.flags.CleanStateInPreamble.set(true);
|
||||
|
||||
auto mockDevice = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
|
||||
constexpr size_t bufferSize = 256;
|
||||
uint8_t buffer[bufferSize];
|
||||
LinearStream stream(buffer, bufferSize);
|
||||
|
||||
PipelineSelectArgs pipelineArgs;
|
||||
|
||||
PreambleHelper<FamilyType>::programPipelineSelect(&stream, pipelineArgs, mockDevice->getRootDeviceEnvironment());
|
||||
size_t usedSpace = stream.getUsed();
|
||||
|
||||
EXPECT_EQ(usedSpace, PreambleHelper<FamilyType>::getCmdSizeForPipelineSelect(mockDevice->getRootDeviceEnvironment()));
|
||||
|
||||
HardwareParse hwParser;
|
||||
hwParser.parseCommands<FamilyType>(stream);
|
||||
|
||||
auto numPipeControl = hwParser.getCommandsList<PIPE_CONTROL>().size();
|
||||
EXPECT_EQ(2u, numPipeControl);
|
||||
auto numPipelineSelect = hwParser.getCommandsList<PIPELINE_SELECT>().size();
|
||||
EXPECT_EQ(2u, numPipelineSelect);
|
||||
}
|
||||
|
||||
HWTEST2_F(PreambleTest, GivenAtLeastXeHpCoreWhenPreambleRetrievesUrbEntryAllocationSizeThenValueIsCorrect, IsAtLeastXeHpCore) {
|
||||
uint32_t actualVal = PreambleHelper<FamilyType>::getUrbEntryAllocationSize();
|
||||
EXPECT_EQ(0u, actualVal);
|
||||
}
|
||||
|
||||
using PreambleHwTest = PreambleFixture;
|
||||
|
||||
HWTEST2_F(PreambleHwTest, GivenAtLeastXeHpCoreWhenPreambleAddsPipeControlBeforeCommandThenExpectNothingToAdd, IsAtLeastXeHpCore) {
|
||||
constexpr size_t bufferSize = 64;
|
||||
uint8_t buffer[bufferSize];
|
||||
LinearStream stream(buffer, bufferSize);
|
||||
|
||||
auto &hwInfo = pDevice->getHardwareInfo();
|
||||
|
||||
PreambleHelper<FamilyType>::addPipeControlBeforeVfeCmd(&stream, &hwInfo, EngineGroupType::Compute);
|
||||
EXPECT_EQ(0u, stream.getUsed());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user