Skip to content

Commit

Permalink
[kineto] implement kineto client interface (pytorch#76076)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: pytorch#76076

The last missing puzzle that enables ProfilerKineto in the ondemand flow

Test Plan:
Sample trace taken with the e2e trace_tester(diff above)

`sh kineto/libkineto/fb/integration_tests/dyno_trace_tester.sh`

https://fburl.com/perfdoctor/tzgtw2ln

Reviewed By: robieta

Differential Revision: D35572928

fbshipit-source-id: 4a45426ebadfb2327026db635e1fc70383441bc8
(cherry picked from commit 80ef547)
  • Loading branch information
chaekit authored and malfet committed Apr 22, 2022
1 parent cd7895e commit 018dee5
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions torch/csrc/profiler/kineto_client_interface.cpp
Original file line number Diff line number Diff line change
@@ -1,29 +1,41 @@
#ifdef USE_KINETO
#include <libkineto.h>
#include <caffe2/torch/csrc/api/include/torch/torch.h>

namespace torch {
namespace profiler {
namespace impl {

namespace {

using namespace torch::autograd::profiler;

class LibKinetoClient : public libkineto::ClientInterface {
public:
void init() override {
// TODO: implement
}
void init() override {}

void warmup(bool setupOpInputsCollection) override {
// TODO: implement
reportInputShapes_ = setupOpInputsCollection;
}

void start() override {
// TODO: implement
ProfilerConfig cfg{
ProfilerState::KINETO_ONDEMAND,
reportInputShapes_,
false,
false,
false,
false};
std::set<ActivityType> activities{ActivityType::CPU};
auto scopes = {RecordScope::FUNCTION, RecordScope::USER_SCOPE};
enableProfiler(cfg, activities, scopes);
}

void stop() override {
// TODO: implement
(void)disableProfiler();
}
private:
bool reportInputShapes_{true};
};

} // namespace
Expand Down

0 comments on commit 018dee5

Please sign in to comment.