From 0aacc09b085eea5c20b964edd8410f1189dcbdb7 Mon Sep 17 00:00:00 2001 From: Shivam Raikundalia Date: Wed, 25 Sep 2024 10:28:11 -0700 Subject: [PATCH] Add 1ns buffer to Roctracer Events (#992) Summary: Pull Request resolved: https://github.com/pytorch/kineto/pull/992 As reported in https://github.com/ROCm/roctracer/issues/105, there is an issue where event starts and ends can "tie". This can cause a visual issue in the traces. Lets add a tiny buffer so the events are separate. At the single nanosecond level, the timings are inaccurate anyways so it doesn't really hurt to add this buffer in the meanwhile. Remove/wrap in ifdef once it is issue is resolved Reviewed By: aaronenyeshi Differential Revision: D63296093 fbshipit-source-id: 09e313e55bbee65f5e6a4974dc52b3e0df4d5922 --- libkineto/src/RoctracerActivity.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/libkineto/src/RoctracerActivity.h b/libkineto/src/RoctracerActivity.h index c4cbfe9bc..677e3507f 100644 --- a/libkineto/src/RoctracerActivity.h +++ b/libkineto/src/RoctracerActivity.h @@ -101,6 +101,15 @@ struct GpuActivity : public RoctracerActivity { void log(ActivityLogger& logger) const override; const std::string metadataJson() const override; + // Add small buffer to fix visual error created by https://github.com/ROCm/roctracer/issues/105 + // Once this is resolved we can use ifdef to handle having this buffer or not based on version + int64_t timestamp() const override { + return activity_.begin + 1; + } + int64_t duration() const override { + return activity_.end - (activity_.begin + 1); + } + private: ActivityType type_; };