Skip to content

Commit fec7382

Browse files
Assign data to overwritten bcs barrier timestamps
Signed-off-by: Lukasz Jobczyk <lukasz.jobczyk@intel.com>
1 parent 05a0664 commit fec7382

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

opencl/source/command_queue/command_queue.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1062,6 +1062,15 @@ void CommandQueue::setupBarrierTimestampForBcsEngines(aub_stream::EngineType eng
10621062
}
10631063

10641064
// Save latest timestamp (override previous, if any).
1065+
if (!bcsTimestampPacketContainers[currentBcsIndex].lastBarrierToWaitFor.peekNodes().empty()) {
1066+
std::array<uint32_t, 8u> timestampData;
1067+
timestampData.fill(std::numeric_limits<uint32_t>::max());
1068+
for (auto &node : bcsTimestampPacketContainers[currentBcsIndex].lastBarrierToWaitFor.peekNodes()) {
1069+
for (uint32_t i = 0; i < node->getPacketsUsed(); i++) {
1070+
node->assignDataToAllTimestamps(i, timestampData.data());
1071+
}
1072+
}
1073+
}
10651074
TimestampPacketContainer newContainer{};
10661075
newContainer.assignAndIncrementNodesRefCounts(timestampPacketDependencies.barrierNodes);
10671076
bcsTimestampPacketContainers[currentBcsIndex].lastBarrierToWaitFor.swapNodes(newContainer);

opencl/test/unit_test/command_queue/command_queue_tests.cpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2116,6 +2116,30 @@ TEST_F(CommandQueueWithTimestampPacketTests, givenOutOfOrderQueueWhenSetupBarrie
21162116
EXPECT_EQ(queue.bcsTimestampPacketContainers.size(), barrierNode->refCountFetchSub(0));
21172117
}
21182118

2119+
TEST_F(CommandQueueWithTimestampPacketTests, givenOutOfOrderQueueWhenSetupBarrierTimestampForBcsEnginesAndOverwritePreviousOneThenEnsureBarrierNodeHasDataAssigned) {
2120+
const cl_queue_properties props[3] = {CL_QUEUE_PROPERTIES, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE, 0};
2121+
MockContext context{};
2122+
MockCommandQueue queue{&context, context.getDevice(0), props, false};
2123+
TimestampPacketDependencies dependencies{};
2124+
queue.getGpgpuCommandStreamReceiver().requestStallingCommandsOnNextFlush();
2125+
for (auto &containers : queue.bcsTimestampPacketContainers) {
2126+
EXPECT_TRUE(containers.lastBarrierToWaitFor.peekNodes().empty());
2127+
}
2128+
2129+
queue.setupBarrierTimestampForBcsEngines(aub_stream::EngineType::ENGINE_BCS, dependencies);
2130+
EXPECT_EQ(1u, dependencies.barrierNodes.peekNodes().size());
2131+
auto barrierNode = dependencies.barrierNodes.peekNodes()[0];
2132+
EXPECT_EQ(1u, barrierNode->getContextEndValue(0u));
2133+
dependencies.moveNodesToNewContainer(*queue.getDeferredTimestampPackets());
2134+
queue.getGpgpuCommandStreamReceiver().requestStallingCommandsOnNextFlush();
2135+
2136+
queue.setupBarrierTimestampForBcsEngines(aub_stream::EngineType::ENGINE_BCS, dependencies);
2137+
EXPECT_NE(1u, barrierNode->getContextEndValue(0u));
2138+
EXPECT_EQ(1u, dependencies.barrierNodes.peekNodes().size());
2139+
barrierNode = dependencies.barrierNodes.peekNodes()[0];
2140+
EXPECT_EQ(1u, barrierNode->getContextEndValue(0u));
2141+
}
2142+
21192143
TEST_F(CommandQueueWithTimestampPacketTests, givenOutOfOrderQueueWhenSetupBarrierTimestampForBcsEnginesCalledOnNonBcsEngineThenEnsureBarrierNodeIsPresentAndSaveItForBcses) {
21202144
const cl_queue_properties props[3] = {CL_QUEUE_PROPERTIES, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE, 0};
21212145
MockContext context{};

0 commit comments

Comments
 (0)