Skip to content

Commit 76efeae

Browse files
Pass more information to programPipelineSelect.
Change-Id: Iaabe60742269b721f8defe71306dd6e87d60d546
1 parent 9bdedc6 commit 76efeae

File tree

13 files changed

+30
-14
lines changed

13 files changed

+30
-14
lines changed

runtime/command_queue/enqueue_common.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -526,6 +526,7 @@ CompletionStamp CommandQueueHw<GfxFamily>::enqueueNonBlocked(
526526

527527
auto mediaSamplerRequired = false;
528528
uint32_t numGrfRequired = GrfConfig::DefaultGrfNumber;
529+
auto specialPipelineSelectMode = false;
529530
Kernel *kernel = nullptr;
530531
for (auto &dispatchInfo : multiDispatchInfo) {
531532
if (kernel != dispatchInfo.getKernel()) {
@@ -538,6 +539,7 @@ CompletionStamp CommandQueueHw<GfxFamily>::enqueueNonBlocked(
538539
mediaSamplerRequired |= kernel->isVmeKernel();
539540
auto numGrfRequiredByKernel = kernel->getKernelInfo().patchInfo.executionEnvironment->NumGRFRequired;
540541
numGrfRequired = std::max(numGrfRequired, numGrfRequiredByKernel);
542+
specialPipelineSelectMode |= kernel->requiresSpecialPipelineSelectMode();
541543
}
542544

543545
if (mediaSamplerRequired) {
@@ -595,6 +597,7 @@ CompletionStamp CommandQueueHw<GfxFamily>::enqueueNonBlocked(
595597
dispatchFlags.outOfDeviceDependencies = &eventsRequest;
596598
}
597599
dispatchFlags.numGrfRequired = numGrfRequired;
600+
dispatchFlags.specialPipelineSelectMode = specialPipelineSelectMode;
598601
DEBUG_BREAK_IF(taskLevel >= Event::eventNotReady);
599602

600603
if (gtpinIsGTPinInitialized()) {

runtime/command_stream/command_stream_receiver.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,7 @@ class CommandStreamReceiver {
218218
bool stallingPipeControlOnNextFlushRequired = false;
219219
bool timestampPacketWriteEnabled = false;
220220
bool nTo1SubmissionModelEnabled = false;
221+
bool lastSpecialPipelineSelectMode = false;
221222
};
222223

223224
typedef CommandStreamReceiver *(*CommandStreamReceiverCreateFunc)(const HardwareInfo &hwInfoIn, bool withAubDump, ExecutionEnvironment &executionEnvironment);

runtime/command_stream/command_stream_receiver_hw.inl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ inline typename GfxFamily::PIPE_CONTROL *CommandStreamReceiverHw<GfxFamily>::add
121121
template <typename GfxFamily>
122122
void CommandStreamReceiverHw<GfxFamily>::programPipelineSelect(LinearStream &commandStream, DispatchFlags &dispatchFlags) {
123123
if (csrSizeRequestFlags.mediaSamplerConfigChanged || !isPreambleSent) {
124-
PreambleHelper<GfxFamily>::programPipelineSelect(&commandStream, dispatchFlags.mediaSamplerRequired);
124+
PreambleHelper<GfxFamily>::programPipelineSelect(&commandStream, dispatchFlags);
125125
this->lastMediaSamplerConfig = dispatchFlags.mediaSamplerRequired;
126126
}
127127
}
@@ -239,6 +239,7 @@ CompletionStamp CommandStreamReceiverHw<GfxFamily>::flushTask(
239239
csrSizeRequestFlags.preemptionRequestChanged = this->lastPreemptionMode != dispatchFlags.preemptionMode;
240240
csrSizeRequestFlags.mediaSamplerConfigChanged = this->lastMediaSamplerConfig != static_cast<int8_t>(dispatchFlags.mediaSamplerRequired);
241241
csrSizeRequestFlags.numGrfRequiredChanged = this->lastSentNumGrfRequired != dispatchFlags.numGrfRequired;
242+
csrSizeRequestFlags.specialPipelineSelectModeChanged = this->lastSpecialPipelineSelectMode != dispatchFlags.specialPipelineSelectMode;
242243

243244
size_t requiredScratchSizeInBytes = requiredScratchSize * device.getDeviceInfo().computeUnitsUsedForScratch;
244245

runtime/command_stream/csr_definitions.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ struct DispatchFlags {
4545
PreemptionMode preemptionMode = PreemptionMode::Disabled;
4646
EventsRequest *outOfDeviceDependencies = nullptr;
4747
uint32_t numGrfRequired = GrfConfig::DefaultGrfNumber;
48+
bool specialPipelineSelectMode = false;
4849
};
4950

5051
struct CsrSizeRequestFlags {
@@ -54,5 +55,6 @@ struct CsrSizeRequestFlags {
5455
bool mediaSamplerConfigChanged = false;
5556
bool hasSharedHandles = false;
5657
bool numGrfRequiredChanged = false;
58+
bool specialPipelineSelectModeChanged = false;
5759
};
5860
} // namespace OCLRT

runtime/gen10/preamble_gen10.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55
*
66
*/
77

8-
#include "runtime/helpers/preamble.inl"
98
#include "runtime/command_queue/gpgpu_walker.h"
9+
#include "runtime/command_stream/csr_definitions.h"
10+
#include "runtime/helpers/preamble.inl"
1011

1112
namespace OCLRT {
1213

@@ -67,7 +68,7 @@ void PreambleHelper<CNLFamily>::addPipeControlBeforeVfeCmd(LinearStream *pComman
6768
}
6869

6970
template <>
70-
void PreambleHelper<CNLFamily>::programPipelineSelect(LinearStream *pCommandStream, bool mediaSamplerRequired) {
71+
void PreambleHelper<CNLFamily>::programPipelineSelect(LinearStream *pCommandStream, const DispatchFlags &dispatchFlags) {
7172
typedef typename CNLFamily::PIPELINE_SELECT PIPELINE_SELECT;
7273

7374
auto pCmd = (PIPELINE_SELECT *)pCommandStream->getSpace(sizeof(PIPELINE_SELECT));
@@ -76,7 +77,7 @@ void PreambleHelper<CNLFamily>::programPipelineSelect(LinearStream *pCommandStre
7677
auto mask = pipelineSelectEnablePipelineSelectMaskBits | pipelineSelectMediaSamplerDopClockGateMaskBits;
7778
pCmd->setMaskBits(mask);
7879
pCmd->setPipelineSelection(PIPELINE_SELECT::PIPELINE_SELECTION_GPGPU);
79-
pCmd->setMediaSamplerDopClockGateEnable(!mediaSamplerRequired);
80+
pCmd->setMediaSamplerDopClockGateEnable(!dispatchFlags.mediaSamplerRequired);
8081
}
8182

8283
template struct PreambleHelper<CNLFamily>;

runtime/gen8/preamble_gen8.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ uint32_t PreambleHelper<BDWFamily>::getL3Config(const HardwareInfo &hwInfo, bool
3232
}
3333

3434
template <>
35-
void PreambleHelper<BDWFamily>::programPipelineSelect(LinearStream *pCommandStream, bool mediaSamplerRequired) {
35+
void PreambleHelper<BDWFamily>::programPipelineSelect(LinearStream *pCommandStream, const DispatchFlags &dispatchFlags) {
3636
typedef typename BDWFamily::PIPELINE_SELECT PIPELINE_SELECT;
3737
auto pCmd = (PIPELINE_SELECT *)pCommandStream->getSpace(sizeof(PIPELINE_SELECT));
3838
*pCmd = PIPELINE_SELECT::sInit();

runtime/gen9/preamble_gen9.cpp

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

8+
#include "runtime/command_stream/csr_definitions.h"
89
#include "runtime/helpers/preamble.inl"
910

1011
namespace OCLRT {
@@ -27,7 +28,7 @@ uint32_t PreambleHelper<SKLFamily>::getL3Config(const HardwareInfo &hwInfo, bool
2728
}
2829

2930
template <>
30-
void PreambleHelper<SKLFamily>::programPipelineSelect(LinearStream *pCommandStream, bool mediaSamplerRequired) {
31+
void PreambleHelper<SKLFamily>::programPipelineSelect(LinearStream *pCommandStream, const DispatchFlags &dispatchFlags) {
3132
typedef typename SKLFamily::PIPELINE_SELECT PIPELINE_SELECT;
3233

3334
auto pCmd = (PIPELINE_SELECT *)pCommandStream->getSpace(sizeof(PIPELINE_SELECT));
@@ -36,7 +37,7 @@ void PreambleHelper<SKLFamily>::programPipelineSelect(LinearStream *pCommandStre
3637
auto mask = pipelineSelectEnablePipelineSelectMaskBits | pipelineSelectMediaSamplerDopClockGateMaskBits;
3738
pCmd->setMaskBits(mask);
3839
pCmd->setPipelineSelection(PIPELINE_SELECT::PIPELINE_SELECTION_GPGPU);
39-
pCmd->setMediaSamplerDopClockGateEnable(!mediaSamplerRequired);
40+
pCmd->setMediaSamplerDopClockGateEnable(!dispatchFlags.mediaSamplerRequired);
4041
}
4142

4243
template <>

runtime/helpers/pipeline_select_helper.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77

88
#pragma once
9-
#include "stdint.h"
9+
#include <cstdint>
1010

1111
namespace OCLRT {
1212
const uint32_t pipelineSelectEnablePipelineSelectMaskBits = 0x3;

runtime/helpers/preamble.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,15 @@
77

88
#pragma once
99
#include "igfxfmid.h"
10-
#include "stdint.h"
1110
#include "runtime/helpers/pipeline_select_helper.h"
1211
#include <cstddef>
12+
#include <cstdint>
1313

1414
namespace OCLRT {
1515

1616
struct HardwareInfo;
1717
class Device;
18+
struct DispatchFlags;
1819
class GraphicsAllocation;
1920
class LinearStream;
2021

@@ -26,7 +27,7 @@ struct PreambleHelper {
2627
static constexpr size_t getScratchSpaceOffsetFor64bit() { return 4096; }
2728

2829
static void programL3(LinearStream *pCommandStream, uint32_t l3Config);
29-
static void programPipelineSelect(LinearStream *pCommandStream, bool mediaSamplerRequired);
30+
static void programPipelineSelect(LinearStream *pCommandStream, const DispatchFlags &dispatchFlags);
3031
static uint32_t getDefaultThreadArbitrationPolicy();
3132
static void programThreadArbitration(LinearStream *pCommandStream, uint32_t requiredThreadArbitrationPolicy);
3233
static void programPreemption(LinearStream *pCommandStream, Device &device, GraphicsAllocation *preemptionCsr);

runtime/helpers/task_information.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ CompletionStamp &CommandComputeKernel::submit(uint32_t taskLevel, bool terminate
206206
if (commandStreamReceiver.peekTimestampPacketWriteEnabled()) {
207207
dispatchFlags.outOfDeviceDependencies = &eventsRequest;
208208
}
209+
dispatchFlags.specialPipelineSelectMode = kernel->requiresSpecialPipelineSelectMode();
209210

210211
DEBUG_BREAK_IF(taskLevel >= Event::eventNotReady);
211212

runtime/kernel/kernel.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -276,15 +276,16 @@ class Kernel : public BaseObject<_cl_kernel> {
276276
const void *getKernelArg(uint32_t argIndex) const;
277277
const SimpleKernelArgInfo &getKernelArgInfo(uint32_t argIndex) const;
278278

279-
bool getAllowNonUniform() { return program->getAllowNonUniform(); }
280-
bool isVmeKernel() { return kernelInfo.isVmeWorkload; };
279+
bool getAllowNonUniform() const { return program->getAllowNonUniform(); }
280+
bool isVmeKernel() const { return kernelInfo.isVmeWorkload; }
281+
bool requiresSpecialPipelineSelectMode() const { return specialPipelineSelectMode; }
281282

282283
//residency for kernel surfaces
283284
MOCKABLE_VIRTUAL void makeResident(CommandStreamReceiver &commandStreamReceiver);
284285
MOCKABLE_VIRTUAL void getResidency(std::vector<Surface *> &dst);
285286
bool requiresCoherency();
286287
void resetSharedObjectsPatchAddresses();
287-
bool isUsingSharedObjArgs() { return usingSharedObjArgs; }
288+
bool isUsingSharedObjArgs() const { return usingSharedObjArgs; }
288289

289290
bool hasPrintfOutput() const;
290291

@@ -490,5 +491,7 @@ class Kernel : public BaseObject<_cl_kernel> {
490491

491492
std::vector<PatchInfoData> patchInfoDataList;
492493
std::unique_ptr<ImageTransformer> imageTransformer;
494+
495+
bool specialPipelineSelectMode = false;
493496
};
494497
} // namespace OCLRT

unit_tests/libult/mock_gfx_family.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ uint32_t PreambleHelper<GENX>::getL3Config(const HardwareInfo &hwInfo, bool useS
158158
}
159159

160160
template <>
161-
void PreambleHelper<GENX>::programPipelineSelect(LinearStream *pCommandStream, bool mediaSamplerRequired) {
161+
void PreambleHelper<GENX>::programPipelineSelect(LinearStream *pCommandStream, const DispatchFlags &dispatchFlags) {
162162
}
163163

164164
template <>

unit_tests/mocks/mock_kernel.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,8 @@ class MockKernel : public Kernel {
225225
Kernel::releaseOwnership();
226226
}
227227

228+
void setSpecialPipelineSelectMode(bool value) { specialPipelineSelectMode = value; }
229+
228230
uint32_t makeResidentCalls = 0;
229231
uint32_t getResidencyCalls = 0;
230232
mutable uint32_t takeOwnershipCalls = 0;

0 commit comments

Comments
 (0)