Skip to content

Commit

Permalink
Fix Bandwidth Calculations in JSON (#993)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #993

We are using TSC timestamps as durations instead of the conversion to seconds. We should never call the start/end bare, only use the duration() and timstamp() functions

Differential Revision: D63422014
  • Loading branch information
sraikund16 authored and facebook-github-bot committed Sep 26, 2024
1 parent 0aacc09 commit 90351d3
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions libkineto/src/CuptiActivity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
#include "Demangle.h"
#include "DeviceProperties.h"
#include "output_base.h"
#include "Logger.h"


namespace KINETO_NAMESPACE {

Expand Down Expand Up @@ -167,7 +169,7 @@ inline const std::string GpuActivity<CUpti_ActivityMemcpy>::metadataJson() const
"bytes": {}, "memory bandwidth (GB/s)": {})JSON",
memcpy.deviceId, memcpy.contextId,
memcpy.streamId, memcpy.correlationId,
memcpy.bytes, bandwidth(memcpy.bytes, memcpy.end - memcpy.start));
memcpy.bytes, bandwidth(memcpy.bytes, duration()));
// clang-format on
}

Expand All @@ -194,7 +196,7 @@ inline const std::string GpuActivity<CUpti_ActivityMemcpy2>::metadataJson() cons
memcpy.srcDeviceId, memcpy.deviceId, memcpy.dstDeviceId,
memcpy.srcContextId, memcpy.contextId, memcpy.dstContextId,
memcpy.streamId, memcpy.correlationId,
memcpy.bytes, bandwidth(memcpy.bytes, memcpy.end - memcpy.start));
memcpy.bytes, bandwidth(memcpy.bytes, duration()));
// clang-format on
}

Expand All @@ -220,7 +222,7 @@ inline const std::string GpuActivity<CUpti_ActivityMemset>::metadataJson() const
"bytes": {}, "memory bandwidth (GB/s)": {})JSON",
memset.deviceId, memset.contextId,
memset.streamId, memset.correlationId,
memset.bytes, bandwidth(memset.bytes, memset.end - memset.start));
memset.bytes, bandwidth(memset.bytes, duration()));
// clang-format on
}

Expand Down

0 comments on commit 90351d3

Please sign in to comment.