Suggestions on how to use the Torch Profiler API

Hi everyone, I’d like some suggestions from experts on how to use Torch profiler API from the C++ frontend.
I was reading through the code, and I guess the core in in /torch/csrc/profiler/.
However, I expected a Profiler class to be provided, while it does not seem to be the case.
I suppose in an application one should include /torch/csrc/profiler/api.h, which only includes observer.h in which only some config stuff is declared/defined.

Also, it seems that profiler related stuff is present in two different say Torch modules: (1) torch::profiler and torch::autograd::profiler. I suppose the former is to be used, but I might be wrong. However, for example for the Kineto client, it looks like that the interface implementation in torch/csrc/profiler/ is a wrapper API around the implementation found under /csrc/autograd.

So, I am a bit confused on how the Profiling infrastructure is setup in Torch.
I’d love some guidance/help on how to use this functionality :slight_smile:

PS: I was expecting to see a backend-like structure as it is done for the distributed framework, where there is the base Backend virtual class, and all its implementations depending on the compile options. So something like:

class Profiler {}
class KinetoProfiler : public Profiler {}