mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
Summary: This is a re-attempt to land the iwyu header changes, by taking the diff from [PR 100304](https://github.com/pytorch/pytorch/pull/100304), and adding the bare minimal changes to make the diff build corectly in the internal builds. X-link: https://github.com/facebookresearch/pytorch3d/pull/1541 X-link: https://github.com/fairinternal/pytorch3d/pull/44 - Re-work D45769819 to fix header inclusions in c10 Test Plan: ``` buck2 build --no-remote-cache mode/dev-nosan //caffe2/c10/... buck2 build --no-remote-cache mode/dev-nosan //deeplearning/fbgemm/fbgemm_gpu/... buck2 build mode/dev-nosan //vision/fair/pytorch3d/pytorch3d:_C ``` Reviewed By: malfet Differential Revision: D45920611 Pull Request resolved: https://github.com/pytorch/pytorch/pull/101846 Approved by: https://github.com/malfet, https://github.com/Skylion007
21 lines
450 B
C++
21 lines
450 B
C++
#include <c10/core/impl/GPUTrace.h>
|
|
#include <c10/util/CallOnce.h>
|
|
|
|
namespace c10 {
|
|
namespace impl {
|
|
|
|
std::atomic<const PyInterpreter*> GPUTrace::gpuTraceState{nullptr};
|
|
|
|
bool GPUTrace::haveState{false};
|
|
|
|
void GPUTrace::set_trace(const PyInterpreter* trace) {
|
|
static c10::once_flag flag;
|
|
c10::call_once(flag, [&]() {
|
|
gpuTraceState.store(trace, std::memory_order_release);
|
|
haveState = true;
|
|
});
|
|
}
|
|
|
|
} // namespace impl
|
|
} // namespace c10
|