Skip to content

Provide a way to initialize connection to dynolog without triggering cupti API #1032

Open
pytorch/pytorch
#147015
@yinghai

Description

Context in facebookincubator/dynolog#286.

In pytorch, we have only 2 call sites of libkineto_init (https://github.com/search?q=repo%3Apytorch%2Fpytorch%20libkineto_init&type=code). - One is the to when we need to register ourselves to dynolog (KINETO_USE_DAEMON=1).

First one is triggered from global_kineto_init, but libkineto_init actually triggers a bunch of cupti API, which defeats the purpose of lazy cupti attach. Therefore we are potentially affecting the perf of the program until cuptiFinalize is called.

I think the right design would be decoupling registration to dynolog from all the cupti initialization. At global_kineto_init, we only register to dynolog but don't do cupti calls. And then when we get signal from dynolog, we trigger ondemand profile and then attach cupti context, basically following the pattern of the second use case in pytorch above.

This requires

  • Some work to separate registration to dynolog from all the cupti initialization in libkineto
  • Provide API in libkineto so that global_kineto_init in pytorch only trigger the registration to dynolog part
  • Change pytorch code global_kineto_init accordingly.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions