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

Method AddToCache

tensorflow/compiler/xla/service/gpu/gpu_graph_util.cc:21–37  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19namespace gpu {
20
21bool MutexedGraphExecCache::AddToCache(BufferAllocations::KeyType key,
22 void* gpu_exec_graph) {
23 tensorflow::mutex_lock lock(exec_graph_cache_mu_);
24 bool has_max_cache_size_reached = false;
25 gpu_exec_graphs_.push_front(gpu_exec_graph);
26 if (gpu_exec_graphs_.size() > cache_size_.load()) {
27 has_max_cache_size_reached = true;
28 auto* exec_graph =
29 reinterpret_cast<stream_executor::gpu::GpuGraphExecHandle*>(
30 &gpu_exec_graphs_.back());
31 using stream_executor::gpu::GpuDriver;
32 GpuDriver::DestroyExecutableGraph(gpu_context_, exec_graph);
33 gpu_exec_graphs_.pop_back();
34 }
35 gpu_key_to_exec_graphs_map_[key] = gpu_exec_graphs_.begin();
36 return has_max_cache_size_reached;
37}
38
39void* MutexedGraphExecCache::GetExecGraph(BufferAllocations::KeyType key) {
40 tensorflow::mutex_lock lock(exec_graph_cache_mu_);

Callers 1

ExecuteThunksMethod · 0.45

Calls 6

push_frontMethod · 0.80
pop_backMethod · 0.80
sizeMethod · 0.45
loadMethod · 0.45
backMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected