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

Method TrackDeallocate

tensorflow/core/common_runtime/gpu_memory_planner.cc:201–229  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

199}
200
201void GPUMemoryPlanner::TrackDeallocate(void* ptr) {
202 if (!is_stats_.load()) {
203 return;
204 }
205 timeval tmp;
206 gettimeofday(&tmp, nullptr);
207
208 AllocStats* alloc_stats;
209 {
210 std::lock_guard<spin_lock> l(stats_lock_);
211 auto iter = ptr_stats_.find(ptr);
212 if (iter == ptr_stats_.end()) {
213 return;
214 }
215 alloc_stats = iter->second;
216 ptr_stats_.erase(iter);
217 alloc_stats_.emplace_back(alloc_stats);
218 }
219 alloc_stats->end = Timeval2Double(tmp);
220
221 if (SmallAlloc(alloc_stats->size)) {
222 GetSmallBin(alloc_stats->size)->TrackDeallocate(alloc_stats);
223 return;
224 }
225
226 for (auto lifetime_policy : lifetime_stats_polices_) {
227 lifetime_policy->TrackDeallocate(alloc_stats);
228 }
229}
230
231GPULifetimePolicy::GPULifetimePolicy(size_t interval,
232 size_t interval_offset, size_t start) :

Callers

nothing calls this directly

Calls 8

Timeval2DoubleFunction · 0.85
SmallAllocFunction · 0.85
IndexFunction · 0.70
loadMethod · 0.45
findMethod · 0.45
endMethod · 0.45
eraseMethod · 0.45
emplace_backMethod · 0.45

Tested by

no test coverage detected