Skip to content

Mitigate issue in kineto trace processing logic #1059

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion libkineto/src/CuptiActivityProfiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,14 @@ void CuptiActivityProfiler::processCpuTrace(
const std::unique_ptr<GenericTraceActivity>>::value,
"handleActivity is unsafe and relies on the caller to maintain not "
"only lifetime but also address stability.");
if (act->duration() <= 0) {
// This logic appears flawed, as it converts spans that have a 0ns duration
// into unfinished spans. This messes up the traces in Perfetto and the Chrome UI.
// In practice, very short spans are sometimes reported with a 0ns duration,
// depending on the effective resolution of the perf counters.
// We mitigate the issue by leaving spans with a 0ns duration untouched,
// but recognize there may be unintended consequences and may not be the correct fix.
// if (act->duration() <= 0) {
if (act->duration() < 0) {
act->endTime = captureWindowEndTime_;
act->addMetadata("finished", "false");
}
Expand Down