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

Method DiscardEntryRefLocked

tensorflow/compiler/xrt/xrt_compilation_cache.cc:101–123  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

99}
100
101void XRTCompilationCache::DiscardEntryRefLocked(CompiledSubgraph* entry) {
102 if (entry->RefCountIsOne()) {
103 // The last reference to this entry is going away, so really delete it from
104 // the cache in such a way that it can't be restored by being looked up
105 // again.
106
107 // Sanity-check that it has been marked for eviction.
108 CHECK(entries_by_last_use_.find(entry->last_use) ==
109 entries_by_last_use_.end());
110 // Update the counter tracking how much space is taken up by entries that
111 // are marked for eviction.
112 --marked_for_eviction_entries_;
113
114 // Remove the entry from the cache.
115 auto erased = cache_.erase(entry->key);
116 if (erased == 0) {
117 LOG(FATAL) << "Tried to discard nonexistent cache entry";
118 }
119 erased = entries_by_uid_.erase(entry->uid);
120 CHECK_EQ(erased, 1);
121 }
122 entry->Unref();
123}
124
125void XRTCompilationCache::MarkOldestEntryForEviction() {
126 CompiledSubgraph* entry_to_mark = entries_by_last_use_.begin()->second;

Callers

nothing calls this directly

Calls 5

RefCountIsOneMethod · 0.45
findMethod · 0.45
endMethod · 0.45
eraseMethod · 0.45
UnrefMethod · 0.45

Tested by

no test coverage detected