pytorch
fdd36654 - [Profiler] Make `LibKinetoClient::stop()` directly call `ProfilerStateBase::pop` (#83965)

Commit
2 years ago
[Profiler] Make `LibKinetoClient::stop()` directly call `ProfilerStateBase::pop` (#83965) It has been discussed earlier in the stack at length, but if profiler fails after it pops the profiler state but before stopping Kineto then the next profiler call will see `LibKinetoClient::stop()` try to clean up the prior run (which it still thinks is active) by calling `disableProfiler()`. (Which fails because there is not an active profiler.) This PR addresses the issue rather bluntly by simply rug pulling any active profiler from `LibKinetoClient::stop()`. I'm not particularly fond of this solution and we should refine the semantics in the future, but for now it has the desired effect of returning to a clean state. Earlier PRs in this stack cleaned up some of the lifetime management such that objects being destroyed triggers appropriate cleanup. As a result it is no longer catastrophic to simply pop the profiler state and let the destructor chain clean up. Differential Revision: [D38958237](https://our.internmc.facebook.com/intern/diff/D38958237/) Pull Request resolved: https://github.com/pytorch/pytorch/pull/83965 Approved by: https://github.com/slgong-fb
Author
Taylor Robie
Committer
Parents
Loading