Skip to content

Commit ae44253

Browse files
Preamble Helper Refactor
Change-Id: Iacd05dcb6d9047fc2814895fa87d1cd9be6df446 Signed-off-by: Daria Hinz <[email protected]>
1 parent 8daf59c commit ae44253

16 files changed

+61
-36
lines changed

core/helpers/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ set(NEO_CORE_HELPERS
1212
${CMAKE_CURRENT_SOURCE_DIR}/debug_helpers.h
1313
${CMAKE_CURRENT_SOURCE_DIR}/interlocked_max.h
1414
${CMAKE_CURRENT_SOURCE_DIR}/non_copyable_or_moveable.h
15+
${CMAKE_CURRENT_SOURCE_DIR}/pipeline_select_args.h
1516
${CMAKE_CURRENT_SOURCE_DIR}/ptr_math.h
1617
${CMAKE_CURRENT_SOURCE_DIR}/register_offsets.h
1718
${CMAKE_CURRENT_SOURCE_DIR}/string.h
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/*
2+
* Copyright (C) 2017-2019 Intel Corporation
3+
*
4+
* SPDX-License-Identifier: MIT
5+
*
6+
*/
7+
8+
#include <cstdint>
9+
10+
namespace NEO {
11+
struct PipelineSelectArgs {
12+
bool specialPipelineSelectMode = false;
13+
bool mediaSamplerRequired = false;
14+
};
15+
} // namespace NEO

runtime/command_queue/enqueue_common.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -676,7 +676,7 @@ CompletionStamp CommandQueueHw<GfxFamily>::enqueueNonBlocked(
676676
dispatchFlags.useSLM = multiDispatchInfo.usesSlm() || multiDispatchInfo.peekParentKernel();
677677
dispatchFlags.guardCommandBufferWithPipeControl = true;
678678
dispatchFlags.GSBA32BitRequired = commandType == CL_COMMAND_NDRANGE_KERNEL;
679-
dispatchFlags.mediaSamplerRequired = mediaSamplerRequired;
679+
dispatchFlags.pipelineSelectArgs.mediaSamplerRequired = mediaSamplerRequired;
680680
dispatchFlags.requiresCoherency = requiresCoherency;
681681
dispatchFlags.lowPriority = (QueuePriority::LOW == priority);
682682
dispatchFlags.throttle = getThrottle();
@@ -689,7 +689,7 @@ CompletionStamp CommandQueueHw<GfxFamily>::enqueueNonBlocked(
689689
dispatchFlags.csrDependencies.makeResident(getGpgpuCommandStreamReceiver());
690690
}
691691
dispatchFlags.numGrfRequired = numGrfRequired;
692-
dispatchFlags.specialPipelineSelectMode = specialPipelineSelectMode;
692+
dispatchFlags.pipelineSelectArgs.specialPipelineSelectMode = specialPipelineSelectMode;
693693
dispatchFlags.multiEngineQueue = this->multiEngineQueue;
694694
DEBUG_BREAK_IF(taskLevel >= Event::eventNotReady);
695695

runtime/command_stream/command_stream_receiver_hw.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ class CommandStreamReceiverHw : public CommandStreamReceiver {
7878
void programPreemption(LinearStream &csr, DispatchFlags &dispatchFlags);
7979
void programL3(LinearStream &csr, DispatchFlags &dispatchFlags, uint32_t &newL3Config);
8080
void programPreamble(LinearStream &csr, Device &device, DispatchFlags &dispatchFlags, uint32_t &newL3Config);
81-
void programPipelineSelect(LinearStream &csr, DispatchFlags &dispatchFlags);
81+
void programPipelineSelect(LinearStream &csr, PipelineSelectArgs &pipelineSelectArgs);
8282
void programEpilogue(LinearStream &csr, void **batchBufferEndLocation, DispatchFlags &dispatchFlags);
8383
void programEpliogueCommands(LinearStream &csr, const DispatchFlags &dispatchFlags);
8484
void programMediaSampler(LinearStream &csr, DispatchFlags &dispatchFlags);

runtime/command_stream/command_stream_receiver_hw_base.inl

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -215,9 +215,9 @@ CompletionStamp CommandStreamReceiverHw<GfxFamily>::flushTask(
215215
csrSizeRequestFlags.l3ConfigChanged = this->lastSentL3Config != newL3Config;
216216
csrSizeRequestFlags.coherencyRequestChanged = this->lastSentCoherencyRequest != static_cast<int8_t>(dispatchFlags.requiresCoherency);
217217
csrSizeRequestFlags.preemptionRequestChanged = this->lastPreemptionMode != dispatchFlags.preemptionMode;
218-
csrSizeRequestFlags.mediaSamplerConfigChanged = this->lastMediaSamplerConfig != static_cast<int8_t>(dispatchFlags.mediaSamplerRequired);
218+
csrSizeRequestFlags.mediaSamplerConfigChanged = this->lastMediaSamplerConfig != static_cast<int8_t>(dispatchFlags.pipelineSelectArgs.mediaSamplerRequired);
219219
csrSizeRequestFlags.numGrfRequiredChanged = this->lastSentNumGrfRequired != dispatchFlags.numGrfRequired;
220-
csrSizeRequestFlags.specialPipelineSelectModeChanged = this->lastSpecialPipelineSelectMode != dispatchFlags.specialPipelineSelectMode;
220+
csrSizeRequestFlags.specialPipelineSelectModeChanged = this->lastSpecialPipelineSelectMode != dispatchFlags.pipelineSelectArgs.specialPipelineSelectMode;
221221

222222
auto force32BitAllocations = getMemoryManager()->peekForce32BitAllocations();
223223
bool stateBaseAddressDirty = false;
@@ -264,7 +264,7 @@ CompletionStamp CommandStreamReceiverHw<GfxFamily>::flushTask(
264264
programPreemption(commandStreamCSR, dispatchFlags);
265265
programComputeMode(commandStreamCSR, dispatchFlags);
266266
programL3(commandStreamCSR, dispatchFlags, newL3Config);
267-
programPipelineSelect(commandStreamCSR, dispatchFlags);
267+
programPipelineSelect(commandStreamCSR, dispatchFlags.pipelineSelectArgs);
268268
programPreamble(commandStreamCSR, device, dispatchFlags, newL3Config);
269269
programMediaSampler(commandStreamCSR, dispatchFlags);
270270

@@ -607,7 +607,7 @@ size_t CommandStreamReceiverHw<GfxFamily>::getRequiredCmdStreamSize(const Dispat
607607

608608
size += getCmdSizeForL3Config();
609609
size += getCmdSizeForComputeMode();
610-
size += getCmdSizeForMediaSampler(dispatchFlags.mediaSamplerRequired);
610+
size += getCmdSizeForMediaSampler(dispatchFlags.pipelineSelectArgs.mediaSamplerRequired);
611611
size += getCmdSizeForPipelineSelect();
612612
size += getCmdSizeForPreemption(dispatchFlags);
613613
size += getCmdSizeForEpilogue(dispatchFlags);
@@ -635,18 +635,12 @@ size_t CommandStreamReceiverHw<GfxFamily>::getRequiredCmdStreamSize(const Dispat
635635

636636
template <typename GfxFamily>
637637
inline size_t CommandStreamReceiverHw<GfxFamily>::getCmdSizeForPipelineSelect() const {
638-
using PIPE_CONTROL = typename GfxFamily::PIPE_CONTROL;
639-
using PIPELINE_SELECT = typename GfxFamily::PIPELINE_SELECT;
640-
size_t size = 0;
641638

639+
size_t size = 0;
642640
if (csrSizeRequestFlags.mediaSamplerConfigChanged ||
643641
csrSizeRequestFlags.specialPipelineSelectModeChanged ||
644642
!isPreambleSent) {
645-
646-
size += sizeof(PIPELINE_SELECT);
647-
if (HardwareCommandsHelper<GfxFamily>::isPipeControlPriorToPipelineSelectWArequired(peekHwInfo())) {
648-
size += sizeof(PIPE_CONTROL);
649-
}
643+
size += PreambleHelper<GfxFamily>::getCmdSizeForPipelineSelect(peekHwInfo());
650644
}
651645
return size;
652646
}

runtime/command_stream/command_stream_receiver_hw_bdw_plus.inl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@ inline size_t CommandStreamReceiverHw<GfxFamily>::getCmdSizeForL3Config() const
4646
}
4747

4848
template <typename GfxFamily>
49-
void CommandStreamReceiverHw<GfxFamily>::programPipelineSelect(LinearStream &commandStream, DispatchFlags &dispatchFlags) {
49+
void CommandStreamReceiverHw<GfxFamily>::programPipelineSelect(LinearStream &commandStream, PipelineSelectArgs &pipelineSelectArgs) {
5050
if (csrSizeRequestFlags.mediaSamplerConfigChanged || !isPreambleSent) {
51-
PreambleHelper<GfxFamily>::programPipelineSelect(&commandStream, dispatchFlags, peekHwInfo());
52-
this->lastMediaSamplerConfig = dispatchFlags.mediaSamplerRequired;
51+
PreambleHelper<GfxFamily>::programPipelineSelect(&commandStream, pipelineSelectArgs, peekHwInfo());
52+
this->lastMediaSamplerConfig = pipelineSelectArgs.mediaSamplerRequired;
5353
}
5454
}
5555

runtime/command_stream/csr_definitions.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
*/
77

88
#pragma once
9+
#include "core/helpers/pipeline_select_args.h"
910
#include "core/memory_manager/memory_constants.h"
1011
#include "runtime/helpers/csr_deps.h"
1112
#include "runtime/helpers/hw_info.h"
@@ -38,6 +39,7 @@ constexpr uint32_t l3AndL1On = 2u;
3839

3940
struct DispatchFlags {
4041
CsrDependencies csrDependencies;
42+
PipelineSelectArgs pipelineSelectArgs;
4143
FlushStampTrackingObj *flushStampReference = nullptr;
4244
QueueThrottle throttle = QueueThrottle::MEDIUM;
4345
PreemptionMode preemptionMode = PreemptionMode::Disabled;
@@ -48,12 +50,10 @@ struct DispatchFlags {
4850
bool useSLM = false;
4951
bool guardCommandBufferWithPipeControl = false;
5052
bool GSBA32BitRequired = false;
51-
bool mediaSamplerRequired = false;
5253
bool requiresCoherency = false;
5354
bool lowPriority = false;
5455
bool implicitFlush = false;
5556
bool outOfOrderExecutionAllowed = false;
56-
bool specialPipelineSelectMode = false;
5757
bool multiEngineQueue = false;
5858
bool epilogueRequired = false;
5959
};

runtime/gen11/command_stream_receiver_hw_gen11.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ void CommandStreamReceiverHw<Family>::programMediaSampler(LinearStream &stream,
3737
using PWR_CLK_STATE_REGISTER = Family::PWR_CLK_STATE_REGISTER;
3838

3939
if (peekHwInfo().platform.eProductFamily == IGFX_ICELAKE_LP) {
40-
if (dispatchFlags.mediaSamplerRequired) {
40+
if (dispatchFlags.pipelineSelectArgs.mediaSamplerRequired) {
4141
if (!lastVmeSubslicesConfig) {
4242
auto pc = addPipeControlCmd(stream);
4343
pc->setDcFlushEnable(true);
@@ -108,7 +108,7 @@ template <>
108108
bool CommandStreamReceiverHw<Family>::detectInitProgrammingFlagsRequired(const DispatchFlags &dispatchFlags) const {
109109
bool flag = DebugManager.flags.ForceCsrReprogramming.get();
110110
if (peekHwInfo().platform.eProductFamily == IGFX_ICELAKE_LP) {
111-
if (!dispatchFlags.mediaSamplerRequired) {
111+
if (!dispatchFlags.pipelineSelectArgs.mediaSamplerRequired) {
112112
if (lastVmeSubslicesConfig) {
113113
flag = true;
114114
}

runtime/gen11/preamble_gen11.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ uint32_t PreambleHelper<ICLFamily>::getL3Config(const HardwareInfo &hwInfo, bool
2929

3030
template <>
3131
void PreambleHelper<ICLFamily>::programPipelineSelect(LinearStream *pCommandStream,
32-
const DispatchFlags &dispatchFlags,
32+
const PipelineSelectArgs &pipelineSelectArgs,
3333
const HardwareInfo &hwInfo) {
3434

3535
typedef typename ICLFamily::PIPELINE_SELECT PIPELINE_SELECT;
@@ -43,8 +43,8 @@ void PreambleHelper<ICLFamily>::programPipelineSelect(LinearStream *pCommandStre
4343

4444
pCmd->setMaskBits(mask);
4545
pCmd->setPipelineSelection(PIPELINE_SELECT::PIPELINE_SELECTION_GPGPU);
46-
pCmd->setMediaSamplerDopClockGateEnable(!dispatchFlags.mediaSamplerRequired);
47-
pCmd->setMediaSamplerPowerClockGateDisable(dispatchFlags.mediaSamplerRequired);
46+
pCmd->setMediaSamplerDopClockGateEnable(!pipelineSelectArgs.mediaSamplerRequired);
47+
pCmd->setMediaSamplerPowerClockGateDisable(pipelineSelectArgs.mediaSamplerRequired);
4848
}
4949

5050
template <>

runtime/gen8/preamble_gen8.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ bool PreambleHelper<BDWFamily>::isL3Configurable(const HardwareInfo &hwInfo) {
3838

3939
template <>
4040
void PreambleHelper<BDWFamily>::programPipelineSelect(LinearStream *pCommandStream,
41-
const DispatchFlags &dispatchFlags,
41+
const PipelineSelectArgs &pipelineSelectArgs,
4242
const HardwareInfo &hwInfo) {
4343

4444
typedef typename BDWFamily::PIPELINE_SELECT PIPELINE_SELECT;

0 commit comments

Comments
 (0)