Skip to content

Commit

Permalink
[kineto] Deprecate ClientTraceActivity and merge it with GenericTrace…
Browse files Browse the repository at this point in the history
…Activity (pytorch#56743)

Summary:
Pull Request resolved: pytorch#56743

Pull Request resolved: pytorch/kineto#184

as part of the migration to ClientTraceActivity -> GenericTraceActivity, now that all CTA mirrors GTA's data structure, we can safely swap out the symbol name.

Test Plan:
- `buck build kineto`
- sandcastle to catch any other breakage in depdendees

Took before and after of `fastrnns` bench
`buck run mode/opt //caffe2/benchmarks/fastrnns:bench -- --cnns resnet50 --group cnns --nloops 1000`

Before
https://fburl.com/perfdoctor/9n0izgji

{F611729029}

After
https://fburl.com/perfdoctor/h9d9tlmp
{F611725475}

Sample ParamComms traces
https://www.internalfb.com/intern/perfdoctor/trace_view?filepath=tree%2Ftraces%2Fdynocli%2F0%2F1619503816%2F127.0.0.1%2Flibkineto_activities_4003656.json.gz&bucket=gpu_traces

https://www.internalfb.com/intern/perfdoctor/trace_view?filepath=tree%2Ftraces%2Fdynocli%2F0%2F1619503816%2F127.0.0.1%2Flibkineto_activities_4003657.json.gz&bucket=gpu_traces

https://www.internalfb.com/intern/perfdoctor/trace_view?filepath=tree%2Ftraces%2Fdynocli%2F0%2F1619503816%2F127.0.0.1%2Flibkineto_activities_4003658.json.gz&bucket=gpu_traces

Reviewed By: gdankel

Differential Revision: D27353973

fbshipit-source-id: 7012c6524c3c75079029ac290c1dd722ac187ec5
  • Loading branch information
chaekit authored and facebook-github-bot committed Apr 29, 2021
1 parent 16fc18b commit 49dbe17
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions torch/csrc/autograd/profiler_kineto.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,16 @@ struct TORCH_API KinetoThreadLocalState : public ProfilerThreadLocalState {
if (!ctx) {
return;
}
#ifdef USE_KINETO_UPDATED
libkineto::GenericTraceActivity op;
op.activityType = libkineto::ActivityType::CPU_OP;
op.activityName = std::string(fn.name().str());
#else
libkineto::ClientTraceActivity op;
op.opType = std::string(fn.name().str());
#endif
op.startTime = ctx->startUs;
op.endTime = getTimeUs();
op.opType = std::string(fn.name().str());
op.device = 0;
op.correlation = ctx->correlationId;
// optimization - postpone shapesToStr till finalizeCPUTrace
Expand Down Expand Up @@ -126,7 +132,7 @@ struct TORCH_API KinetoThreadLocalState : public ProfilerThreadLocalState {
void addTraceEvents(libkineto::ActivityTraceInterface& trace) {
const auto& events = *(trace.activities());
for (const auto& ev_ptr : events) {
// ClientTraceActivity events are already processed
// CPU_OP events are already processed
if (ev_ptr->type() != libkineto::ActivityType::CPU_OP) {
kineto_events_.emplace_back();
kineto_events_.back()
Expand Down

0 comments on commit 49dbe17

Please sign in to comment.