8000 [BE] Fix variable shadowing in CUDACachingAllocator.cpp (#86646) · pytorch/pytorch@224ae0d · GitHub
[go: up one dir, main page]

Skip to content

Commit 224ae0d

Browse files
malfetpytorchmergebot
authored andcommitted
[BE] Fix variable shadowing in CUDACachingAllocator.cpp (#86646)
Test Plan: CI Differential Revision: D40245365 Pull Request resolved: #86646 Approved by: https://github.com/seemethere
1 parent 2cb330a commit 224ae0d

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

c10/cuda/CUDACachingAllocator.cpp

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -558,8 +558,8 @@ class DeviceCachingAllocator {
558558
bool record_history = false;
559559
std::atomic<CreateContextFn> context_recorder_;
560560
size_t alloc_trace_next = 0;
561-
bool alloc_trace_record_context = false;
562-
size_t alloc_trace_max_entries = 1;
561+
bool alloc_trace_record_context_ = false;
562+
size_t alloc_trace_max_entries_ = 1;
563563
std::vector<TraceEntry>*
564564
alloc_trace; // pointer because we need to intentionally leak this on
565565
// deallocation it can hold references to Python state which
@@ -599,11 +599,10 @@ class DeviceCachingAllocator {
599599
size_t alloc_trace_max_entries,
600600
bool alloc_trace_record_context) {
601601
std::unique_lock<std::recursive_mutex> lock(mutex);
602-
this->record_history = enabled;
603-
this->context_recorder_.store(context_recorder);
604-
this->alloc_trace_max_entries =
605-
std::max(size_t(1), alloc_trace_max_entries);
606-
this->alloc_trace_record_context = alloc_trace_record_context;
602+
record_history = enabled;
603+
context_recorder_.store(context_recorder);
604+
alloc_trace_max_entries_ = std::max(size_t(1), alloc_trace_max_entries);
605+
alloc_trace_record_context_ = alloc_trace_record_context;
607606
alloc_trace_next = 0;
608607
alloc_trace->clear();
609608
}
@@ -1758,12 +1757,12 @@ class DeviceCachingAllocator {
17581757
addr,
17591758
size,
17601759
stream,
1761-
alloc_trace_record_context ? std::move(context) : nullptr);
1762-
if (alloc_trace->size() < alloc_trace_max_entries) {
1760+
alloc_trace_record_context_ ? std::move(context) : nullptr);
1761+
if (alloc_trace->size() < alloc_trace_max_entries_) {
17631762
alloc_trace->emplace_back(te);
17641763
} else {
17651764
(*alloc_trace)[alloc_trace_next++] = te;
1766-
if (alloc_trace_next == alloc_trace_max_entries) {
1765+
if (alloc_trace_next == alloc_trace_max_entries_) {
17671766
alloc_trace_next = 0;
17681767
}
17691768
}

0 commit comments

Comments
 (0)
0