MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / TrackAllocate

Method TrackAllocate

tensorflow/core/common_runtime/gpu_memory_planner.cc:175–199  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

173}
174
175void GPUMemoryPlanner::TrackAllocate(size_t alignment, size_t num_bytes, void* ptr) {
176 if (!is_stats_.load()) {
177 return;
178 }
179
180 timeval tmp;
181 gettimeofday(&tmp, nullptr);
182
183 auto alloc_stats = new AllocStats;
184 alloc_stats->begin = Timeval2Double(tmp);
185 alloc_stats->size = num_bytes;
186 {
187 std::lock_guard<spin_lock> l(stats_lock_);
188 ptr_stats_[ptr] = alloc_stats;
189 }
190
191 if (SmallAlloc(num_bytes)) {
192 GetSmallBin(num_bytes)->TrackAllocate(alignment);
193 return;
194 }
195
196 for (auto lifetime_policy : lifetime_stats_polices_) {
197 lifetime_policy->TrackAllocate(alignment, num_bytes);
198 }
199}
200
201void GPUMemoryPlanner::TrackDeallocate(void* ptr) {
202 if (!is_stats_.load()) {

Callers

nothing calls this directly

Calls 4

Timeval2DoubleFunction · 0.85
SmallAllocFunction · 0.85
IndexFunction · 0.70
loadMethod · 0.45

Tested by

no test coverage detected