Skip to content

Commit

Permalink
[kineto] deprecate metdata args from ClientTraceActivity (pytorch#55988)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: pytorch#55988

Pull Request resolved: pytorch/kineto#165

as part of the ClientTraceActivity -> GenericTraceActivity migration, move all the metadata fields to JSON encoded string

Test Plan:
- `buck build`
- tested with subsequent diffs

Reviewed By: gdankel

Differential Revision: D27340314

fbshipit-source-id: f55b77a779e4bda1fb8667cb4e0f4252b93af5ea
  • Loading branch information
chaekit authored and facebook-github-bot committed Apr 15, 2021
1 parent 52f1a07 commit 1ca51f0
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions torch/csrc/autograd/profiler_kineto.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,14 @@ struct TORCH_API KinetoThreadLocalState : public ProfilerThreadLocalState {
// }

// Not setting atm
#ifndef USE_KINETO_UPDATED
op.inputTypes = "[]";
op.arguments = "[]";
op.outputDims = "[]";
op.outputTypes = "[]";
op.inputNames = "[]";
op.outputNames = "[]";
#endif

// setting both pthread and linux tid for Kineto
op.sysThreadId = cachedTid();
Expand Down Expand Up @@ -139,13 +141,23 @@ struct TORCH_API KinetoThreadLocalState : public ProfilerThreadLocalState {
void finalizeCPUTrace() {
TORCH_INTERNAL_ASSERT(cpu_trace->activities.size() == kineto_events_.size());
for (size_t idx = 0; idx < cpu_trace->activities.size(); ++idx) {
#ifdef USE_KINETO_UPDATED
if (kineto_events_[idx].hasShapes()) {
cpu_trace->activities[idx].addMetadata("Input Dims", shapesToStr(kineto_events_[idx].shapes()));
}
#else
if (kineto_events_[idx].hasShapes()) {
cpu_trace->activities[idx].inputDims = shapesToStr(kineto_events_[idx].shapes());
} else {
cpu_trace->activities[idx].inputDims = "[]";
}
#endif
if (kineto_events_[idx].hasStack()) {
#ifdef USE_KINETO_UPDATED
cpu_trace->activities[idx].addMetadata("Call stack", stacksToStr(kineto_events_[idx].stack()));
#else
cpu_trace->activities[idx].callStack = stacksToStr(kineto_events_[idx].stack());
#endif
}
}
}
Expand Down

0 comments on commit 1ca51f0

Please sign in to comment.