Assign data only to unused barrier timestamps

Signed-off-by: Lukasz Jobczyk <lukasz.jobczyk@intel.com>
This commit is contained in:
Lukasz Jobczyk
2022-03-30 12:19:43 +00:00
committed by Compute-Runtime-Automation
parent 5350553f72
commit aa46dd9cdf
3 changed files with 25 additions and 5 deletions

View File

@@ -985,6 +985,16 @@ void CommandQueue::aubCaptureHook(bool &blocking, bool &clearAllDependencies, co
}
}
void CommandQueue::assignDataToOverwrittenBcsNode(TagNodeBase *node) {
std::array<uint32_t, 8u> timestampData;
timestampData.fill(std::numeric_limits<uint32_t>::max());
if (node->refCountFetchSub(0) <= 2) { //One ref from deferred container and one from bcs barrier container it is going to be released from
for (uint32_t i = 0; i < node->getPacketsUsed(); i++) {
node->assignDataToAllTimestamps(i, timestampData.data());
}
}
}
bool CommandQueue::isWaitForTimestampsEnabled() const {
auto &hwHelper = HwHelper::get(getDevice().getHardwareInfo().platform.eRenderCoreFamily);
auto enabled = CommandQueue::isTimestampWaitEnabled();
@@ -1061,12 +1071,8 @@ void CommandQueue::setupBarrierTimestampForBcsEngines(aub_stream::EngineType eng
// Save latest timestamp (override previous, if any).
if (!bcsTimestampPacketContainers[currentBcsIndex].lastBarrierToWaitFor.peekNodes().empty()) {
std::array<uint32_t, 8u> timestampData;
timestampData.fill(std::numeric_limits<uint32_t>::max());
for (auto &node : bcsTimestampPacketContainers[currentBcsIndex].lastBarrierToWaitFor.peekNodes()) {
for (uint32_t i = 0; i < node->getPacketsUsed(); i++) {
node->assignDataToAllTimestamps(i, timestampData.data());
}
this->assignDataToOverwrittenBcsNode(node);
}
}
TimestampPacketContainer newContainer{};

View File

@@ -383,6 +383,7 @@ class CommandQueue : public BaseObject<_cl_command_queue> {
MOCKABLE_VIRTUAL bool blitEnqueueImageAllowed(const size_t *origin, const size_t *region, const Image &image) const;
void aubCaptureHook(bool &blocking, bool &clearAllDependencies, const MultiDispatchInfo &multiDispatchInfo);
virtual bool obtainTimestampPacketForCacheFlush(bool isCacheFlushRequired) const = 0;
void assignDataToOverwrittenBcsNode(TagNodeBase *node);
Context *context = nullptr;
ClDevice *device = nullptr;

View File

@@ -2135,6 +2135,19 @@ TEST_F(CommandQueueWithTimestampPacketTests, givenOutOfOrderQueueWhenSetupBarrie
EXPECT_EQ(1u, barrierNode->getContextEndValue(0u));
dependencies.moveNodesToNewContainer(*queue.getDeferredTimestampPackets());
queue.getGpgpuCommandStreamReceiver().requestStallingCommandsOnNextFlush();
barrierNode->incRefCount();
barrierNode->incRefCount();
barrierNode->incRefCount();
barrierNode->incRefCount();
queue.setupBarrierTimestampForBcsEngines(aub_stream::EngineType::ENGINE_BCS, dependencies);
EXPECT_EQ(1u, barrierNode->getContextEndValue(0u));
EXPECT_EQ(1u, dependencies.barrierNodes.peekNodes().size());
barrierNode->refCountFetchSub(4u);
barrierNode = dependencies.barrierNodes.peekNodes()[0];
EXPECT_EQ(1u, barrierNode->getContextEndValue(0u));
dependencies.moveNodesToNewContainer(*queue.getDeferredTimestampPackets());
queue.getGpgpuCommandStreamReceiver().requestStallingCommandsOnNextFlush();
queue.setupBarrierTimestampForBcsEngines(aub_stream::EngineType::ENGINE_BCS, dependencies);
EXPECT_NE(1u, barrierNode->getContextEndValue(0u));