Unify programming of pipe control command

Signed-off-by: Zbigniew Zdanowicz <zbigniew.zdanowicz@intel.com>
This commit is contained in:
Zbigniew Zdanowicz
2022-05-13 00:29:53 +00:00
committed by Compute-Runtime-Automation
parent 7eafb1e877
commit 52a3bfcfde
15 changed files with 104 additions and 103 deletions

View File

@ -53,8 +53,7 @@ inline void EncodeComputeMode<Family>::programComputeModeCommandWithSynchronizat
EncodeComputeMode<Family>::programComputeModeCommand(csr, properties, hwInfo);
if (hasSharedHandles) {
auto pc = csr.getSpaceForCmd<PIPE_CONTROL>();
*pc = Family::cmdInitPipeControl;
MemorySynchronizationCommands<Family>::addPipeControlWithCSStallOnly(csr);
}
NEO::EncodeWA<Family>::encodeAdditionalPipelineSelect(csr, args, false, hwInfo, isRcs);

View File

@ -163,7 +163,7 @@ class CommandStreamReceiverHw : public CommandStreamReceiver {
void programEnginePrologue(LinearStream &csr);
size_t getCmdSizeForPrologue() const;
void addClearSLMWorkAround(typename GfxFamily::PIPE_CONTROL *pCmd);
void setClearSlmWorkAroundParameter(PipeControlArgs &args);
void addPipeControlBeforeStateSip(LinearStream &commandStream, Device &device);
void addPipeControlBefore3dState(LinearStream &commandStream, DispatchFlags &dispatchFlags);
size_t getSshHeapSize();

View File

@ -993,7 +993,7 @@ void CommandStreamReceiverHw<GfxFamily>::resetKmdNotifyHelper(KmdNotifyHelper *n
}
template <typename GfxFamily>
void CommandStreamReceiverHw<GfxFamily>::addClearSLMWorkAround(typename GfxFamily::PIPE_CONTROL *pCmd) {
void CommandStreamReceiverHw<GfxFamily>::setClearSlmWorkAroundParameter(PipeControlArgs &args) {
}
template <typename GfxFamily>

View File

@ -25,12 +25,10 @@ inline void CommandStreamReceiverHw<GfxFamily>::programL3(LinearStream &csr, uin
typedef typename GfxFamily::PIPE_CONTROL PIPE_CONTROL;
if (csrSizeRequestFlags.l3ConfigChanged && this->isPreambleSent) {
// Add a PIPE_CONTROL w/ CS_stall
auto pCmd = (PIPE_CONTROL *)csr.getSpace(sizeof(PIPE_CONTROL));
PIPE_CONTROL cmd = GfxFamily::cmdInitPipeControl;
cmd.setCommandStreamerStallEnable(true);
cmd.setDcFlushEnable(true);
addClearSLMWorkAround(&cmd);
*pCmd = cmd;
PipeControlArgs args = {};
args.dcFlushEnable = true;
setClearSlmWorkAroundParameter(args);
MemorySynchronizationCommands<GfxFamily>::addPipeControl(csr, args);
PreambleHelper<GfxFamily>::programL3(&csr, newL3Config);
this->lastSentL3Config = newL3Config;

View File

@ -51,10 +51,7 @@ void EncodeComputeMode<Family>::programComputeModeCommand(LinearStream &csr, Sta
using PIPE_CONTROL = typename Family::PIPE_CONTROL;
if (properties.threadArbitrationPolicy.isDirty) {
auto pipeControl = csr.getSpaceForCmd<PIPE_CONTROL>();
PIPE_CONTROL cmd = Family::cmdInitPipeControl;
cmd.setCommandStreamerStallEnable(true);
*pipeControl = cmd;
MemorySynchronizationCommands<Family>::addPipeControlWithCSStallOnly(csr);
LriHelper<Family>::program(&csr,
RowChickenReg4::address,

View File

@ -13,8 +13,10 @@
namespace NEO {
using Family = ICLFamily;
template <>
uint32_t PreambleHelper<ICLFamily>::getL3Config(const HardwareInfo &hwInfo, bool useSLM) {
uint32_t PreambleHelper<Family>::getL3Config(const HardwareInfo &hwInfo, bool useSLM) {
uint32_t l3Config = 0;
switch (hwInfo.platform.eProductFamily) {
@ -28,14 +30,14 @@ uint32_t PreambleHelper<ICLFamily>::getL3Config(const HardwareInfo &hwInfo, bool
}
template <>
void PreambleHelper<ICLFamily>::programPipelineSelect(LinearStream *pCommandStream,
void PreambleHelper<Family>::programPipelineSelect(LinearStream *pCommandStream,
const PipelineSelectArgs &pipelineSelectArgs,
const HardwareInfo &hwInfo) {
using PIPELINE_SELECT = typename ICLFamily::PIPELINE_SELECT;
using PIPELINE_SELECT = typename Family::PIPELINE_SELECT;
auto pCmd = pCommandStream->getSpaceForCmd<PIPELINE_SELECT>();
PIPELINE_SELECT cmd = ICLFamily::cmdInitPipelineSelect;
PIPELINE_SELECT cmd = Family::cmdInitPipelineSelect;
auto mask = pipelineSelectEnablePipelineSelectMaskBits |
pipelineSelectMediaSamplerDopClockGateMaskBits |
@ -50,21 +52,18 @@ void PreambleHelper<ICLFamily>::programPipelineSelect(LinearStream *pCommandStre
}
template <>
void PreambleHelper<ICLFamily>::addPipeControlBeforeVfeCmd(LinearStream *pCommandStream, const HardwareInfo *hwInfo, EngineGroupType engineGroupType) {
auto pipeControl = pCommandStream->getSpaceForCmd<PIPE_CONTROL>();
PIPE_CONTROL cmd = ICLFamily::cmdInitPipeControl;
cmd.setCommandStreamerStallEnable(true);
void PreambleHelper<Family>::addPipeControlBeforeVfeCmd(LinearStream *pCommandStream, const HardwareInfo *hwInfo, EngineGroupType engineGroupType) {
PipeControlArgs args = {};
if (hwInfo->workaroundTable.flags.waSendMIFLUSHBeforeVFE) {
cmd.setRenderTargetCacheFlushEnable(true);
cmd.setDepthCacheFlushEnable(true);
cmd.setDcFlushEnable(true);
args.renderTargetCacheFlushEnable = true;
args.depthCacheFlushEnable = true;
args.dcFlushEnable = true;
}
*pipeControl = cmd;
MemorySynchronizationCommands<Family>::addPipeControl(*pCommandStream, args);
}
template <>
std::vector<int32_t> PreambleHelper<ICLFamily>::getSupportedThreadArbitrationPolicies() {
std::vector<int32_t> PreambleHelper<Family>::getSupportedThreadArbitrationPolicies() {
std::vector<int32_t> retVal;
int32_t policySize = sizeof(RowChickenReg4::regDataForArbitrationPolicy) /
sizeof(RowChickenReg4::regDataForArbitrationPolicy[0]);
@ -74,12 +73,12 @@ std::vector<int32_t> PreambleHelper<ICLFamily>::getSupportedThreadArbitrationPol
return retVal;
}
template <>
size_t PreambleHelper<ICLFamily>::getAdditionalCommandsSize(const Device &device) {
size_t totalSize = PreemptionHelper::getRequiredPreambleSize<ICLFamily>(device);
size_t PreambleHelper<Family>::getAdditionalCommandsSize(const Device &device) {
size_t totalSize = PreemptionHelper::getRequiredPreambleSize<Family>(device);
bool debuggingEnabled = device.getDebugger() != nullptr || device.isDebuggerActive();
totalSize += getKernelDebuggingCommandsSize(debuggingEnabled);
return totalSize;
}
template struct PreambleHelper<ICLFamily>;
template struct PreambleHelper<Family>;
} // namespace NEO

View File

@ -13,8 +13,10 @@
namespace NEO {
using Family = TGLLPFamily;
template <>
uint32_t PreambleHelper<TGLLPFamily>::getL3Config(const HardwareInfo &hwInfo, bool useSLM) {
uint32_t PreambleHelper<Family>::getL3Config(const HardwareInfo &hwInfo, bool useSLM) {
uint32_t l3Config = 0;
switch (hwInfo.platform.eProductFamily) {
@ -28,20 +30,20 @@ uint32_t PreambleHelper<TGLLPFamily>::getL3Config(const HardwareInfo &hwInfo, bo
}
template <>
void PreambleHelper<TGLLPFamily>::programPipelineSelect(LinearStream *pCommandStream,
void PreambleHelper<Family>::programPipelineSelect(LinearStream *pCommandStream,
const PipelineSelectArgs &pipelineSelectArgs,
const HardwareInfo &hwInfo) {
using PIPELINE_SELECT = typename TGLLPFamily::PIPELINE_SELECT;
using PIPELINE_SELECT = typename Family::PIPELINE_SELECT;
if (MemorySynchronizationCommands<TGLLPFamily>::isPipeControlPriorToPipelineSelectWArequired(hwInfo)) {
if (MemorySynchronizationCommands<Family>::isPipeControlPriorToPipelineSelectWArequired(hwInfo)) {
PipeControlArgs args;
args.renderTargetCacheFlushEnable = true;
MemorySynchronizationCommands<TGLLPFamily>::addPipeControl(*pCommandStream, args);
MemorySynchronizationCommands<Family>::addPipeControl(*pCommandStream, args);
}
auto pCmd = pCommandStream->getSpaceForCmd<PIPELINE_SELECT>();
PIPELINE_SELECT cmd = TGLLPFamily::cmdInitPipelineSelect;
PIPELINE_SELECT cmd = Family::cmdInitPipelineSelect;
auto mask = pipelineSelectEnablePipelineSelectMaskBits | pipelineSelectMediaSamplerDopClockGateMaskBits;
auto pipeline = pipelineSelectArgs.is3DPipelineRequired ? PIPELINE_SELECT::PIPELINE_SELECTION_3D : PIPELINE_SELECT::PIPELINE_SELECTION_GPGPU;
@ -56,33 +58,32 @@ void PreambleHelper<TGLLPFamily>::programPipelineSelect(LinearStream *pCommandSt
}
template <>
void PreambleHelper<TGLLPFamily>::addPipeControlBeforeVfeCmd(LinearStream *pCommandStream, const HardwareInfo *hwInfo, EngineGroupType engineGroupType) {
auto pipeControl = pCommandStream->getSpaceForCmd<PIPE_CONTROL>();
PIPE_CONTROL cmd = TGLLPFamily::cmdInitPipeControl;
cmd.setCommandStreamerStallEnable(true);
void PreambleHelper<Family>::addPipeControlBeforeVfeCmd(LinearStream *pCommandStream, const HardwareInfo *hwInfo, EngineGroupType engineGroupType) {
PipeControlArgs args = {};
if (hwInfo->workaroundTable.flags.waSendMIFLUSHBeforeVFE) {
if (engineGroupType != EngineGroupType::Compute) {
cmd.setRenderTargetCacheFlushEnable(true);
cmd.setDepthCacheFlushEnable(true);
cmd.setDepthStallEnable(true);
args.renderTargetCacheFlushEnable = true;
args.depthCacheFlushEnable = true;
args.depthStallEnable = true;
}
cmd.setDcFlushEnable(true);
args.dcFlushEnable = true;
}
*pipeControl = cmd;
MemorySynchronizationCommands<Family>::addPipeControl(*pCommandStream, args);
}
template <>
void PreambleHelper<TGLLPFamily>::programL3(LinearStream *pCommandStream, uint32_t l3Config) {
void PreambleHelper<Family>::programL3(LinearStream *pCommandStream, uint32_t l3Config) {
}
template <>
uint32_t PreambleHelper<TGLLPFamily>::getUrbEntryAllocationSize() {
uint32_t PreambleHelper<Family>::getUrbEntryAllocationSize() {
return 1024u;
}
template <>
void PreambleHelper<TGLLPFamily>::programAdditionalFieldsInVfeState(VFE_STATE_TYPE *mediaVfeState, const HardwareInfo &hwInfo, bool disableEUFusion) {
auto &hwHelper = HwHelper::get(hwInfo.platform.eRenderCoreFamily);
void PreambleHelper<Family>::programAdditionalFieldsInVfeState(VFE_STATE_TYPE *mediaVfeState, const HardwareInfo &hwInfo, bool disableEUFusion) {
auto &hwHelper = HwHelperHw<Family>::get();
if (!hwHelper.isFusedEuDispatchEnabled(hwInfo, disableEUFusion)) {
mediaVfeState->setDisableSlice0Subslice2(true);
}
@ -92,5 +93,5 @@ void PreambleHelper<TGLLPFamily>::programAdditionalFieldsInVfeState(VFE_STATE_TY
}
// Explicitly instantiate PreambleHelper for TGLLP device family
template struct PreambleHelper<TGLLPFamily>;
template struct PreambleHelper<Family>;
} // namespace NEO

View File

@ -22,8 +22,8 @@ void populateFactoryTable<CommandStreamReceiverHw<Family>>() {
}
template <>
void CommandStreamReceiverHw<Family>::addClearSLMWorkAround(Family::PIPE_CONTROL *pCmd) {
pCmd->setProtectedMemoryDisable(1);
void CommandStreamReceiverHw<Family>::setClearSlmWorkAroundParameter(PipeControlArgs &args) {
args.protectedMemoryDisable = true;
}
template class CommandStreamReceiverHw<Family>;

View File

@ -9,17 +9,17 @@
namespace NEO {
using Family = BDWFamily;
template <>
void PreambleHelper<BDWFamily>::addPipeControlBeforeVfeCmd(LinearStream *pCommandStream, const HardwareInfo *hwInfo, EngineGroupType engineGroupType) {
auto pipeControl = pCommandStream->getSpaceForCmd<PIPE_CONTROL>();
PIPE_CONTROL cmd = BDWFamily::cmdInitPipeControl;
cmd.setCommandStreamerStallEnable(true);
cmd.setDcFlushEnable(true);
*pipeControl = cmd;
void PreambleHelper<Family>::addPipeControlBeforeVfeCmd(LinearStream *pCommandStream, const HardwareInfo *hwInfo, EngineGroupType engineGroupType) {
PipeControlArgs args = {};
args.dcFlushEnable = true;
MemorySynchronizationCommands<Family>::addPipeControl(*pCommandStream, args);
}
template <>
uint32_t PreambleHelper<BDWFamily>::getL3Config(const HardwareInfo &hwInfo, bool useSLM) {
uint32_t PreambleHelper<Family>::getL3Config(const HardwareInfo &hwInfo, bool useSLM) {
uint32_t l3Config = 0;
switch (hwInfo.platform.eProductFamily) {
@ -33,18 +33,18 @@ uint32_t PreambleHelper<BDWFamily>::getL3Config(const HardwareInfo &hwInfo, bool
}
template <>
bool PreambleHelper<BDWFamily>::isL3Configurable(const HardwareInfo &hwInfo) {
bool PreambleHelper<Family>::isL3Configurable(const HardwareInfo &hwInfo) {
return getL3Config(hwInfo, true) != getL3Config(hwInfo, false);
}
template <>
void PreambleHelper<BDWFamily>::programPipelineSelect(LinearStream *pCommandStream,
void PreambleHelper<Family>::programPipelineSelect(LinearStream *pCommandStream,
const PipelineSelectArgs &pipelineSelectArgs,
const HardwareInfo &hwInfo) {
using PIPELINE_SELECT = typename BDWFamily::PIPELINE_SELECT;
using PIPELINE_SELECT = typename Family::PIPELINE_SELECT;
auto pCmd = pCommandStream->getSpaceForCmd<PIPELINE_SELECT>();
PIPELINE_SELECT cmd = BDWFamily::cmdInitPipelineSelect;
PIPELINE_SELECT cmd = Family::cmdInitPipelineSelect;
cmd.setMaskBits(pipelineSelectEnablePipelineSelectMaskBits);
cmd.setPipelineSelection(PIPELINE_SELECT::PIPELINE_SELECTION_GPGPU);
@ -53,10 +53,10 @@ void PreambleHelper<BDWFamily>::programPipelineSelect(LinearStream *pCommandStre
}
template <>
size_t PreambleHelper<BDWFamily>::getAdditionalCommandsSize(const Device &device) {
size_t PreambleHelper<Family>::getAdditionalCommandsSize(const Device &device) {
bool debuggingEnabled = device.getDebugger() != nullptr || device.isDebuggerActive();
return getKernelDebuggingCommandsSize(debuggingEnabled);
}
template struct PreambleHelper<BDWFamily>;
template struct PreambleHelper<Family>;
} // namespace NEO

View File

@ -43,10 +43,7 @@ void EncodeComputeMode<Family>::programComputeModeCommand(LinearStream &csr, Sta
UNRECOVERABLE_IF(properties.threadArbitrationPolicy.value == ThreadArbitrationPolicy::NotPresent);
if (properties.threadArbitrationPolicy.isDirty) {
auto pipeControl = csr.getSpaceForCmd<PIPE_CONTROL>();
PIPE_CONTROL cmd = SKLFamily::cmdInitPipeControl;
cmd.setCommandStreamerStallEnable(true);
*pipeControl = cmd;
MemorySynchronizationCommands<Family>::addPipeControlWithCSStallOnly(csr);
LriHelper<SKLFamily>::program(&csr,
DebugControlReg2::address,

View File

@ -10,8 +10,10 @@
namespace NEO {
using Family = SKLFamily;
template <>
uint32_t PreambleHelper<SKLFamily>::getL3Config(const HardwareInfo &hwInfo, bool useSLM) {
uint32_t PreambleHelper<Family>::getL3Config(const HardwareInfo &hwInfo, bool useSLM) {
uint32_t l3Config = 0;
switch (hwInfo.platform.eProductFamily) {
@ -28,19 +30,19 @@ uint32_t PreambleHelper<SKLFamily>::getL3Config(const HardwareInfo &hwInfo, bool
}
template <>
bool PreambleHelper<SKLFamily>::isL3Configurable(const HardwareInfo &hwInfo) {
bool PreambleHelper<Family>::isL3Configurable(const HardwareInfo &hwInfo) {
return getL3Config(hwInfo, true) != getL3Config(hwInfo, false);
}
template <>
void PreambleHelper<SKLFamily>::programPipelineSelect(LinearStream *pCommandStream,
void PreambleHelper<Family>::programPipelineSelect(LinearStream *pCommandStream,
const PipelineSelectArgs &pipelineSelectArgs,
const HardwareInfo &hwInfo) {
typedef typename SKLFamily::PIPELINE_SELECT PIPELINE_SELECT;
typedef typename Family::PIPELINE_SELECT PIPELINE_SELECT;
auto pCmd = pCommandStream->getSpaceForCmd<PIPELINE_SELECT>();
PIPELINE_SELECT cmd = SKLFamily::cmdInitPipelineSelect;
PIPELINE_SELECT cmd = Family::cmdInitPipelineSelect;
auto mask = pipelineSelectEnablePipelineSelectMaskBits | pipelineSelectMediaSamplerDopClockGateMaskBits;
cmd.setMaskBits(mask);
@ -51,25 +53,23 @@ void PreambleHelper<SKLFamily>::programPipelineSelect(LinearStream *pCommandStre
}
template <>
void PreambleHelper<SKLFamily>::addPipeControlBeforeVfeCmd(LinearStream *pCommandStream, const HardwareInfo *hwInfo, EngineGroupType engineGroupType) {
auto pipeControl = pCommandStream->getSpaceForCmd<PIPE_CONTROL>();
PIPE_CONTROL cmd = SKLFamily::cmdInitPipeControl;
cmd.setCommandStreamerStallEnable(true);
void PreambleHelper<Family>::addPipeControlBeforeVfeCmd(LinearStream *pCommandStream, const HardwareInfo *hwInfo, EngineGroupType engineGroupType) {
PipeControlArgs args = {};
if (hwInfo->workaroundTable.flags.waSendMIFLUSHBeforeVFE) {
cmd.setRenderTargetCacheFlushEnable(true);
cmd.setDepthCacheFlushEnable(true);
cmd.setDcFlushEnable(true);
args.renderTargetCacheFlushEnable = true;
args.depthCacheFlushEnable = true;
args.dcFlushEnable = true;
}
*pipeControl = cmd;
MemorySynchronizationCommands<Family>::addPipeControl(*pCommandStream, args);
}
template <>
std::vector<int32_t> PreambleHelper<SKLFamily>::getSupportedThreadArbitrationPolicies() {
std::vector<int32_t> PreambleHelper<Family>::getSupportedThreadArbitrationPolicies() {
std::vector<int32_t> retVal;
for (const int32_t &p : DebugControlReg2::supportedArbitrationPolicy) {
retVal.push_back(p);
}
return retVal;
}
template struct PreambleHelper<SKLFamily>;
template struct PreambleHelper<Family>;
} // namespace NEO

View File

@ -721,7 +721,7 @@ typedef struct tagPIPE_CONTROL {
uint32_t DestinationAddressType : BITFIELD_RANGE(24, 24);
uint32_t AmfsFlushEnable : BITFIELD_RANGE(25, 25);
uint32_t FlushLlc : BITFIELD_RANGE(26, 26);
uint32_t Reserved_59 : BITFIELD_RANGE(27, 27);
uint32_t ProtectedMemoryDisable : BITFIELD_RANGE(27, 27);
uint32_t TileCacheFlushEnable : BITFIELD_RANGE(28, 28);
uint32_t CommandCacheInvalidateEnable : BITFIELD_RANGE(29, 29);
uint32_t L3FabricFlush : BITFIELD_RANGE(30, 30);
@ -970,6 +970,12 @@ typedef struct tagPIPE_CONTROL {
inline bool getFlushLlc() const {
return TheStructure.Common.FlushLlc;
}
inline void setProtectedMemoryDisable(const bool value) {
TheStructure.Common.ProtectedMemoryDisable = value;
}
inline bool getProtectedMemoryDisable() const {
return TheStructure.Common.ProtectedMemoryDisable;
}
inline void setTileCacheFlushEnable(const bool value) {
TheStructure.Common.TileCacheFlushEnable = value;
}

View File

@ -319,6 +319,9 @@ void MemorySynchronizationCommands<GfxFamily>::setPipeControl(typename GfxFamily
pipeControl.setTlbInvalidate(args.tlbInvalidation);
pipeControl.setNotifyEnable(args.notifyEnable);
pipeControl.setDcFlushEnable(args.dcFlushEnable);
pipeControl.setDepthCacheFlushEnable(args.depthCacheFlushEnable);
pipeControl.setDepthStallEnable(args.depthStallEnable);
pipeControl.setProtectedMemoryDisable(args.protectedMemoryDisable);
if constexpr (GfxFamily::isUsingGenericMediaStateClear) {
pipeControl.setGenericMediaStateClear(args.genericMediaStateClear);

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2021 Intel Corporation
* Copyright (C) 2020-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -28,6 +28,9 @@ struct PipeControlArgs {
bool workloadPartitionOffset = false;
bool amfsFlushEnable = false;
bool unTypedDataPortCacheFlush = false;
bool depthCacheFlushEnable = false;
bool depthStallEnable = false;
bool protectedMemoryDisable = false;
};
} // namespace NEO

View File

@ -58,10 +58,9 @@ void PreambleHelper<Family>::programPipelineSelect(LinearStream *pCommandStream,
cmd.setPipelineSelection(PIPELINE_SELECT::PIPELINE_SELECTION_3D);
*pCmd = cmd;
auto pipeControl = Family::cmdInitPipeControl;
pipeControl.setStateCacheInvalidationEnable(true);
auto pipeControlBuffer = pCommandStream->getSpaceForCmd<PIPE_CONTROL>();
*pipeControlBuffer = pipeControl;
PipeControlArgs args = {};
args.stateCacheInvalidationEnable = true;
MemorySynchronizationCommands<Family>::addPipeControl(*pCommandStream, args);
}
auto pCmd = pCommandStream->getSpaceForCmd<PIPELINE_SELECT>();
@ -80,10 +79,9 @@ void PreambleHelper<Family>::programPipelineSelect(LinearStream *pCommandStream,
*pCmd = cmd;
if (DebugManager.flags.CleanStateInPreamble.get()) {
auto pipeControl = Family::cmdInitPipeControl;
pipeControl.setStateCacheInvalidationEnable(true);
auto pipeControlBuffer = pCommandStream->getSpaceForCmd<PIPE_CONTROL>();
*pipeControlBuffer = pipeControl;
PipeControlArgs args = {};
args.stateCacheInvalidationEnable = true;
MemorySynchronizationCommands<Family>::addPipeControl(*pCommandStream, args);
}
}