From 24f5362296d9ed1d429570edd5d50bd159c2dd84 Mon Sep 17 00:00:00 2001 From: German Date: Fri, 19 Aug 2022 10:06:26 -0400 Subject: [PATCH] SWDEV-349794 - Fix time accumulation If the execution command had a split into multiple HW operations, then runtime has to accumulate time for all operations Change-Id: Iaba31e96250918d8190bf63adb4c07730fdfefbf --- rocclr/device/rocm/rocvirtual.cpp | 7 ++++++- rocclr/device/rocm/rocvirtual.hpp | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/rocclr/device/rocm/rocvirtual.cpp b/rocclr/device/rocm/rocvirtual.cpp index 1b6287e976..61daa52240 100644 --- a/rocclr/device/rocm/rocvirtual.cpp +++ b/rocclr/device/rocm/rocvirtual.cpp @@ -151,7 +151,12 @@ void Timestamp::checkGpuTime() { } signals_.clear(); if (end != 0) { - start_ = start * ticksToTime_; + // Check if it's the first execution and update start time + if (!accum_ena_) { + start_ = start * ticksToTime_; + accum_ena_ = true; + } + // Progress the end time always end_ = end * ticksToTime_; } } diff --git a/rocclr/device/rocm/rocvirtual.hpp b/rocclr/device/rocm/rocvirtual.hpp index 1bb0868c9a..21dad7f18d 100644 --- a/rocclr/device/rocm/rocvirtual.hpp +++ b/rocclr/device/rocm/rocvirtual.hpp @@ -105,6 +105,7 @@ class Timestamp : public amd::ReferenceCountedObject { std::vector signals_; //!< The list of all signals, associated with the TS hsa_signal_t callback_signal_; //!< Signal associated with a callback for possible later update amd::Monitor lock_; //!< Serialize timestamp update + bool accum_ena_ = false; //!< If TRUE then the accumulation of execution times has started Timestamp(const Timestamp&) = delete; Timestamp& operator=(const Timestamp&) = delete;