Skip to content

Commit 583d4d4

Browse files
Add clearAllDependencies parameter to obtainNewTimestampPacketNodes
The capability to clear Timestamp packet dependencies from command queue. Related-To: NEO-2747 Change-Id: Id3812539a47b96e23d0b8b17b9b8f54878ee2ef2 Signed-off-by: Milczarek, Slawomir <[email protected]>
1 parent 608ec93 commit 583d4d4

File tree

4 files changed

+14
-15
lines changed

4 files changed

+14
-15
lines changed

runtime/command_queue/command_queue.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -551,11 +551,11 @@ void CommandQueue::dispatchAuxTranslation(MultiDispatchInfo &multiDispatchInfo,
551551
multiDispatchInfo.rbegin()->setPipeControlRequired(true);
552552
}
553553

554-
void CommandQueue::obtainNewTimestampPacketNodes(size_t numberOfNodes, TimestampPacketContainer &previousNodes) {
554+
void CommandQueue::obtainNewTimestampPacketNodes(size_t numberOfNodes, TimestampPacketContainer &previousNodes, bool clearAllDependencies) {
555555
auto allocator = getCommandStreamReceiver().getTimestampPacketAllocator();
556556

557557
previousNodes.swapNodes(*timestampPacketContainer);
558-
previousNodes.resolveDependencies(isOOQEnabled() || DebugManager.flags.OmitTimestampPacketDependencies.get());
558+
previousNodes.resolveDependencies(clearAllDependencies);
559559

560560
DEBUG_BREAK_IF(timestampPacketContainer->peekNodes().size() > 0);
561561

runtime/command_queue/command_queue.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ class CommandQueue : public BaseObject<_cl_command_queue> {
444444
MOCKABLE_VIRTUAL void dispatchAuxTranslation(MultiDispatchInfo &multiDispatchInfo, MemObjsForAuxTranslation &memObjsForAuxTranslation,
445445
AuxTranslationDirection auxTranslationDirection);
446446

447-
void obtainNewTimestampPacketNodes(size_t numberOfNodes, TimestampPacketContainer &previousNodes);
447+
void obtainNewTimestampPacketNodes(size_t numberOfNodes, TimestampPacketContainer &previousNodes, bool clearAllDependencies);
448448
void processProperties(const cl_queue_properties *properties);
449449

450450
Context *context = nullptr;

runtime/command_queue/enqueue_common.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ void CommandQueueHw<GfxFamily>::enqueueHandler(Surface **surfacesForResidency,
139139
Kernel *parentKernel = multiDispatchInfo.peekParentKernel();
140140
auto devQueue = this->getContext().getDefaultDeviceQueue();
141141
DeviceQueueHw<GfxFamily> *devQueueHw = castToObject<DeviceQueueHw<GfxFamily>>(devQueue);
142+
auto clearAllDependencies = isOOQEnabled() || DebugManager.flags.OmitTimestampPacketDependencies.get();
142143

143144
TagNode<HwTimeStamps> *hwTimeStamps = nullptr;
144145

@@ -205,11 +206,9 @@ void CommandQueueHw<GfxFamily>::enqueueHandler(Surface **surfacesForResidency,
205206
if (getCommandStreamReceiver().peekTimestampPacketWriteEnabled()) {
206207
csrDeps.fillFromEventsRequestAndMakeResident(eventsRequest, getCommandStreamReceiver(), CsrDependencies::DependenciesType::OnCsr);
207208

208-
if (!multiDispatchInfo.empty()) {
209-
obtainNewTimestampPacketNodes(estimateTimestampPacketNodesCount(multiDispatchInfo), previousTimestampPacketNodes);
210-
csrDeps.push_back(&previousTimestampPacketNodes);
211-
} else if (isCacheFlushCommand(commandType)) {
212-
obtainNewTimestampPacketNodes(1, previousTimestampPacketNodes);
209+
auto nodesCount = !multiDispatchInfo.empty() ? estimateTimestampPacketNodesCount(multiDispatchInfo) : isCacheFlushCommand(commandType) ? 1u : 0u;
210+
if (nodesCount > 0) {
211+
obtainNewTimestampPacketNodes(nodesCount, previousTimestampPacketNodes, clearAllDependencies);
213212
csrDeps.push_back(&previousTimestampPacketNodes);
214213
}
215214
}

unit_tests/helpers/timestamp_packet_tests.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -958,7 +958,7 @@ HWTEST_F(TimestampPacketTests, givenAlreadyAssignedNodeWhenEnqueueingNonBlockedT
958958

959959
auto cmdQ = std::make_unique<MockCommandQueueHw<FamilyType>>(context, device.get(), nullptr);
960960
TimestampPacketContainer previousNodes;
961-
cmdQ->obtainNewTimestampPacketNodes(1, previousNodes);
961+
cmdQ->obtainNewTimestampPacketNodes(1, previousNodes, false);
962962
auto firstNode = cmdQ->timestampPacketContainer->peekNodes().at(0);
963963

964964
csr.storeMakeResidentAllocations = true;
@@ -980,7 +980,7 @@ HWTEST_F(TimestampPacketTests, givenAlreadyAssignedNodeWhenEnqueueingBlockedThen
980980

981981
auto cmdQ = clUniquePtr(new MockCommandQueueHw<FamilyType>(context, device.get(), nullptr));
982982
TimestampPacketContainer previousNodes;
983-
cmdQ->obtainNewTimestampPacketNodes(1, previousNodes);
983+
cmdQ->obtainNewTimestampPacketNodes(1, previousNodes, false);
984984
auto firstNode = cmdQ->timestampPacketContainer->peekNodes().at(0);
985985

986986
csr.storeMakeResidentAllocations = true;
@@ -1003,7 +1003,7 @@ HWTEST_F(TimestampPacketTests, givenAlreadyAssignedNodeWhenEnqueueingThenDontKee
10031003

10041004
MockCommandQueueHw<FamilyType> cmdQ(context, device.get(), nullptr);
10051005
TimestampPacketContainer previousNodes;
1006-
cmdQ.obtainNewTimestampPacketNodes(1, previousNodes);
1006+
cmdQ.obtainNewTimestampPacketNodes(1, previousNodes, false);
10071007
auto firstNode = cmdQ.timestampPacketContainer->peekNodes().at(0);
10081008
setTagToReadyState(firstNode);
10091009

@@ -1034,7 +1034,7 @@ HWTEST_F(TimestampPacketTests, givenAlreadyAssignedNodeWhenEnqueueingThenKeepDep
10341034

10351035
MockCommandQueueHw<FamilyType> cmdQ(context, device.get(), nullptr);
10361036
TimestampPacketContainer previousNodes;
1037-
cmdQ.obtainNewTimestampPacketNodes(2, previousNodes);
1037+
cmdQ.obtainNewTimestampPacketNodes(2, previousNodes, false);
10381038
firstNode.add(cmdQ.timestampPacketContainer->peekNodes().at(0));
10391039
firstNode.add(cmdQ.timestampPacketContainer->peekNodes().at(1));
10401040
auto firstTag0 = firstNode.getNode(0);
@@ -1067,7 +1067,7 @@ HWTEST_F(TimestampPacketTests, givenAlreadyAssignedNodeWhenEnqueueingToOoqThenDo
10671067
cl_queue_properties properties[] = {CL_QUEUE_PROPERTIES, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE, 0};
10681068
MockCommandQueueHw<FamilyType> cmdQ(context, device.get(), properties);
10691069
TimestampPacketContainer previousNodes;
1070-
cmdQ.obtainNewTimestampPacketNodes(1, previousNodes);
1070+
cmdQ.obtainNewTimestampPacketNodes(1, previousNodes, false);
10711071

10721072
cmdQ.enqueueKernel(kernel->mockKernel, 1, nullptr, gws, nullptr, 0, nullptr, nullptr);
10731073

@@ -1097,7 +1097,7 @@ HWTEST_F(TimestampPacketTests, givenAlreadyAssignedNodeWhenEnqueueingWithOmitTim
10971097

10981098
MockCommandQueueHw<FamilyType> cmdQ(context, device.get(), nullptr);
10991099
TimestampPacketContainer previousNodes;
1100-
cmdQ.obtainNewTimestampPacketNodes(1, previousNodes);
1100+
cmdQ.obtainNewTimestampPacketNodes(1, previousNodes, false);
11011101

11021102
cmdQ.enqueueKernel(kernel->mockKernel, 1, nullptr, gws, nullptr, 0, nullptr, nullptr);
11031103

@@ -1250,7 +1250,7 @@ TEST_F(TimestampPacketTests, givenDispatchSizeWhenAskingForNewTimestampsThenObta
12501250
EXPECT_EQ(0u, mockCmdQ->timestampPacketContainer->peekNodes().size());
12511251

12521252
TimestampPacketContainer previousNodes;
1253-
mockCmdQ->obtainNewTimestampPacketNodes(dispatchSize, previousNodes);
1253+
mockCmdQ->obtainNewTimestampPacketNodes(dispatchSize, previousNodes, false);
12541254
EXPECT_EQ(dispatchSize, mockCmdQ->timestampPacketContainer->peekNodes().size());
12551255
}
12561256

0 commit comments

Comments
 (0)