未验证 提交 73ec9b78 编写于 作者: R Ruibiao Chen 提交者: GitHub

Set once_flag to thread_local for StreamSafeCUDAAllcation (#49104)

上级 d6b062e8
...@@ -266,7 +266,7 @@ uint64_t StreamSafeCUDAAllocator::ProcessUnfreedAllocationsAndRelease() { ...@@ -266,7 +266,7 @@ uint64_t StreamSafeCUDAAllocator::ProcessUnfreedAllocationsAndRelease() {
return underlying_allocator_->Release(place_); return underlying_allocator_->Release(place_);
} }
std::once_flag StreamSafeCUDAAllocation::once_flag_; thread_local std::once_flag StreamSafeCUDAAllocation::once_flag_;
std::map<platform::Place, std::vector<StreamSafeCUDAAllocator*>> std::map<platform::Place, std::vector<StreamSafeCUDAAllocator*>>
StreamSafeCUDAAllocator::allocator_map_; StreamSafeCUDAAllocator::allocator_map_;
......
...@@ -45,7 +45,7 @@ class StreamSafeCUDAAllocation : public Allocation { ...@@ -45,7 +45,7 @@ class StreamSafeCUDAAllocation : public Allocation {
gpuStream_t GetOwningStream() const; gpuStream_t GetOwningStream() const;
private: private:
static std::once_flag once_flag_; thread_local static std::once_flag once_flag_;
void RecordGraphCapturingStreams(); void RecordGraphCapturingStreams();
void RecordStreamWithNoGraphCapturing(gpuStream_t stream); void RecordStreamWithNoGraphCapturing(gpuStream_t stream);
DecoratedAllocationPtr underlying_allocation_; DecoratedAllocationPtr underlying_allocation_;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册