Skip to content

Commit 62b0f0a

Browse files
kgibalaCompute-Runtime-Automation
authored andcommitted
Refactor addPipeControlWA, PipeControlWArequired
Related-To: NEO-3210 Change-Id: I0516154b323e29eeb697bf2253ca08ae1ce150d8 Signed-off-by: Krzysztof Gibala <[email protected]>
1 parent c961157 commit 62b0f0a

33 files changed

+82
-59
lines changed

runtime/command_queue/gpgpu_walker.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,8 @@ class GpgpuWalkerHelper {
112112

113113
static void dispatchProfilingCommandsStart(
114114
TagNode<HwTimeStamps> &hwTimeStamps,
115-
LinearStream *commandStream);
115+
LinearStream *commandStream,
116+
const HardwareInfo &hwInfo);
116117

117118
static void dispatchProfilingCommandsEnd(
118119
TagNode<HwTimeStamps> &hwTimeStamps,
@@ -132,7 +133,8 @@ class GpgpuWalkerHelper {
132133
LinearStream *cmdStream,
133134
WALKER_TYPE<GfxFamily> *walkerCmd,
134135
TagNode<TimestampPacketStorage> *timestampPacketNode,
135-
TimestampPacketStorage::WriteOperationType writeOperationType);
136+
TimestampPacketStorage::WriteOperationType writeOperationType,
137+
const HardwareInfo &hwInfo);
136138

137139
static void dispatchScheduler(
138140
LinearStream &commandStream,

runtime/command_queue/gpgpu_walker_base.inl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,8 @@ void GpgpuWalkerHelper<GfxFamily>::addAluReadModifyWriteRegister(
104104
template <typename GfxFamily>
105105
void GpgpuWalkerHelper<GfxFamily>::dispatchProfilingCommandsStart(
106106
TagNode<HwTimeStamps> &hwTimeStamps,
107-
LinearStream *commandStream) {
107+
LinearStream *commandStream,
108+
const HardwareInfo &hwInfo) {
108109

109110
using MI_STORE_REGISTER_MEM = typename GfxFamily::MI_STORE_REGISTER_MEM;
110111

@@ -113,7 +114,7 @@ void GpgpuWalkerHelper<GfxFamily>::dispatchProfilingCommandsStart(
113114

114115
PipeControlHelper<GfxFamily>::obtainPipeControlAndProgramPostSyncOperation(*commandStream,
115116
PIPE_CONTROL::POST_SYNC_OPERATION_WRITE_TIMESTAMP,
116-
timeStampAddress, 0llu, false);
117+
timeStampAddress, 0llu, false, hwInfo);
117118

118119
//MI_STORE_REGISTER_MEM for context local timestamp
119120
timeStampAddress = hwTimeStamps.getGpuAddress() + offsetof(HwTimeStamps, ContextStartTS);

runtime/command_queue/gpgpu_walker_bdw_plus.inl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,19 +171,20 @@ void GpgpuWalkerHelper<GfxFamily>::setupTimestampPacket(
171171
LinearStream *cmdStream,
172172
WALKER_TYPE<GfxFamily> *walkerCmd,
173173
TagNode<TimestampPacketStorage> *timestampPacketNode,
174-
TimestampPacketStorage::WriteOperationType writeOperationType) {
174+
TimestampPacketStorage::WriteOperationType writeOperationType,
175+
const HardwareInfo &hwInfo) {
175176

176177
if (TimestampPacketStorage::WriteOperationType::AfterWalker == writeOperationType) {
177178
uint64_t address = timestampPacketNode->getGpuAddress() + offsetof(TimestampPacketStorage, packets[0].contextEnd);
178179
PipeControlHelper<GfxFamily>::obtainPipeControlAndProgramPostSyncOperation(*cmdStream,
179-
PIPE_CONTROL::POST_SYNC_OPERATION_WRITE_IMMEDIATE_DATA, address, 0, false);
180+
PIPE_CONTROL::POST_SYNC_OPERATION_WRITE_IMMEDIATE_DATA, address, 0, false, hwInfo);
180181
}
181182
}
182183

183184
template <typename GfxFamily>
184185
size_t EnqueueOperation<GfxFamily>::getSizeRequiredCSKernel(bool reserveProfilingCmdsSpace, bool reservePerfCounters, CommandQueue &commandQueue, const Kernel *pKernel) {
185186
size_t size = sizeof(typename GfxFamily::GPGPU_WALKER) + HardwareCommandsHelper<GfxFamily>::getSizeRequiredCS(pKernel) +
186-
sizeof(PIPE_CONTROL) * (HardwareCommandsHelper<GfxFamily>::isPipeControlWArequired() ? 2 : 1);
187+
sizeof(PIPE_CONTROL) * (HardwareCommandsHelper<GfxFamily>::isPipeControlWArequired(pKernel->getDevice().getHardwareInfo()) ? 2 : 1);
187188
size += HardwareCommandsHelper<GfxFamily>::getSizeRequiredForCacheFlush(commandQueue, pKernel, 0U);
188189
size += PreemptionHelper::getPreemptionWaCsSize<GfxFamily>(commandQueue.getDevice());
189190
if (reserveProfilingCmdsSpace) {

runtime/command_queue/hardware_interface_base.inl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ void HardwareInterface<GfxFamily>::dispatchKernelCommands(CommandQueue &commandQ
178178

179179
if (commandQueue.getGpgpuCommandStreamReceiver().peekTimestampPacketWriteEnabled()) {
180180
auto timestampPacketNode = currentTimestampPacketNodes->peekNodes().at(currentDispatchIndex);
181-
GpgpuWalkerHelper<GfxFamily>::setupTimestampPacket(&commandStream, nullptr, timestampPacketNode, TimestampPacketStorage::WriteOperationType::BeforeWalker);
181+
GpgpuWalkerHelper<GfxFamily>::setupTimestampPacket(&commandStream, nullptr, timestampPacketNode, TimestampPacketStorage::WriteOperationType::BeforeWalker, commandQueue.getDevice().getHardwareInfo());
182182
}
183183

184184
programWalker(commandStream, kernel, commandQueue, currentTimestampPacketNodes, dsh, ioh, ssh, globalWorkSizes,

runtime/command_queue/hardware_interface_bdw_plus.inl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ inline void HardwareInterface<GfxFamily>::dispatchProfilingPerfStartCommands(
5757

5858
// If hwTimeStampAlloc is passed (not nullptr), then we know that profiling is enabled
5959
if (hwTimeStamps != nullptr) {
60-
GpgpuWalkerHelper<GfxFamily>::dispatchProfilingCommandsStart(*hwTimeStamps, commandStream);
60+
GpgpuWalkerHelper<GfxFamily>::dispatchProfilingCommandsStart(*hwTimeStamps, commandStream, commandQueue.getDevice().getHardwareInfo());
6161
}
6262
if (hwPerfCounter != nullptr) {
6363
GpgpuWalkerHelper<GfxFamily>::dispatchPerfCountersCommandsStart(commandQueue, *hwPerfCounter, commandStream);
@@ -109,7 +109,7 @@ inline void HardwareInterface<GfxFamily>::programWalker(
109109

110110
if (currentTimestampPacketNodes && commandQueue.getGpgpuCommandStreamReceiver().peekTimestampPacketWriteEnabled()) {
111111
auto timestampPacketNode = currentTimestampPacketNodes->peekNodes().at(currentDispatchIndex);
112-
GpgpuWalkerHelper<GfxFamily>::setupTimestampPacket(&commandStream, walkerCmd, timestampPacketNode, TimestampPacketStorage::WriteOperationType::AfterWalker);
112+
GpgpuWalkerHelper<GfxFamily>::setupTimestampPacket(&commandStream, walkerCmd, timestampPacketNode, TimestampPacketStorage::WriteOperationType::AfterWalker, commandQueue.getDevice().getHardwareInfo());
113113
}
114114

115115
HardwareCommandsHelper<GfxFamily>::sendIndirectState(

runtime/command_stream/command_stream_receiver.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ class CommandStreamReceiver {
9393

9494
LinearStream &getCS(size_t minRequiredSize = 1024u);
9595
OSInterface *getOSInterface() const { return osInterface; };
96+
ExecutionEnvironment &getExecutionEnvironment() const { return executionEnvironment; };
9697

9798
MOCKABLE_VIRTUAL void setTagAllocation(GraphicsAllocation *allocation);
9899
GraphicsAllocation *getTagAllocation() const {

runtime/command_stream/command_stream_receiver_hw_base.inl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ CompletionStamp CommandStreamReceiverHw<GfxFamily>::flushTask(
179179
auto address = getTagAllocation()->getGpuAddress();
180180
PipeControlHelper<GfxFamily>::obtainPipeControlAndProgramPostSyncOperation(commandStreamTask,
181181
PIPE_CONTROL::POST_SYNC_OPERATION_WRITE_IMMEDIATE_DATA,
182-
address, taskCount + 1, dispatchFlags.dcFlush);
182+
address, taskCount + 1, dispatchFlags.dcFlush, device.getHardwareInfo());
183183

184184
this->latestSentTaskCount = taskCount + 1;
185185
DBG_LOG(LogTaskCounts, __FUNCTION__, "Line: ", __LINE__, "taskCount", taskCount);
@@ -496,7 +496,7 @@ inline void CommandStreamReceiverHw<GfxFamily>::flushBatchedSubmissions() {
496496

497497
ResidencyContainer surfacesForSubmit;
498498
ResourcePackage resourcePackage;
499-
auto pipeControlLocationSize = PipeControlHelper<GfxFamily>::getSizeForPipeControlWithPostSyncOperation();
499+
auto pipeControlLocationSize = PipeControlHelper<GfxFamily>::getSizeForPipeControlWithPostSyncOperation(peekHwInfo());
500500
void *currentPipeControlForNooping = nullptr;
501501
void *epiloguePipeControlLocation = nullptr;
502502

runtime/command_stream/experimental_command_buffer.inl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ size_t ExperimentalCommandBuffer::getTimeStampPipeControlSize() noexcept {
6363
using PIPE_CONTROL = typename GfxFamily::PIPE_CONTROL;
6464

6565
// Two P_C for timestamps
66-
return 2 * PipeControlHelper<GfxFamily>::getSizeForPipeControlWithPostSyncOperation();
66+
return 2 * PipeControlHelper<GfxFamily>::getSizeForPipeControlWithPostSyncOperation(*commandStreamReceiver->getExecutionEnvironment().getHardwareInfo());
6767
}
6868

6969
template <typename GfxFamily>
@@ -73,7 +73,7 @@ void ExperimentalCommandBuffer::addTimeStampPipeControl() {
7373
uint64_t timeStampAddress = timestamps->getGpuAddress() + timestampsOffset;
7474

7575
PipeControlHelper<GfxFamily>::obtainPipeControlAndProgramPostSyncOperation(*currentStream,
76-
PIPE_CONTROL::POST_SYNC_OPERATION_WRITE_TIMESTAMP, timeStampAddress, 0llu, false);
76+
PIPE_CONTROL::POST_SYNC_OPERATION_WRITE_TIMESTAMP, timeStampAddress, 0llu, false, *commandStreamReceiver->getExecutionEnvironment().getHardwareInfo());
7777

7878
//moving to next chunk
7979
timestampsOffset += sizeof(uint64_t);

runtime/device_queue/device_queue_hw_base.inl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,13 +125,13 @@ void DeviceQueueHw<GfxFamily>::addExecutionModelCleanUpSection(Kernel *parentKer
125125

126126
PipeControlHelper<GfxFamily>::obtainPipeControlAndProgramPostSyncOperation(slbCS,
127127
PIPE_CONTROL::POST_SYNC_OPERATION_WRITE_IMMEDIATE_DATA,
128-
criticalSectionAddress, ExecutionModelCriticalSection::Free, false);
128+
criticalSectionAddress, ExecutionModelCriticalSection::Free, false, device->getHardwareInfo());
129129

130130
uint64_t tagAddress = reinterpret_cast<uint64_t>(device->getDefaultEngine().commandStreamReceiver->getTagAddress());
131131

132132
PipeControlHelper<GfxFamily>::obtainPipeControlAndProgramPostSyncOperation(slbCS,
133133
PIPE_CONTROL::POST_SYNC_OPERATION_WRITE_IMMEDIATE_DATA,
134-
tagAddress, taskCount, false);
134+
tagAddress, taskCount, false, device->getHardwareInfo());
135135

136136
addMediaStateClearCmds();
137137

runtime/gen9/hardware_commands_helper_gen9.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
namespace NEO {
1717

1818
template <>
19-
bool HardwareCommandsHelper<SKLFamily>::isPipeControlWArequired() { return true; }
19+
bool HardwareCommandsHelper<SKLFamily>::isPipeControlWArequired(const HardwareInfo &hwInfo) { return true; }
2020

2121
template struct HardwareCommandsHelper<SKLFamily>;
2222
} // namespace NEO

0 commit comments

Comments
 (0)