MCPcopy Create free account
hub / github.com/PaddlePaddle/Paddle / LoadDesc

Method LoadDesc

paddle/phi/core/memory/allocation/meta_cache.cc:23–45  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21MetadataCache::MetadataCache(bool uses_gpu) : uses_gpu_(uses_gpu) {}
22
23MemoryBlock::Desc* MetadataCache::LoadDesc(MemoryBlock* block) {
24 if (uses_gpu_) {
25 auto iter = cache_.find(block);
26 PADDLE_ENFORCE_NE(
27 iter,
28 cache_.end(),
29 common::errors::NotFound("The memory block is not found in cache"));
30 auto* desc = &(iter->second);
31 PADDLE_ENFORCE_EQ(
32 desc->CheckGuards(),
33 true,
34 common::errors::InvalidArgument("Invalid CPU memory access"));
35 return desc;
36 } else {
37 auto* desc = reinterpret_cast<MemoryBlock::Desc*>(block);
38 VLOG(10) << "Load MemoryBlock::Desc type=" << desc->type;
39 PADDLE_ENFORCE_EQ(
40 desc->CheckGuards(),
41 true,
42 common::errors::InvalidArgument("Invalid CPU memory access"));
43 return reinterpret_cast<MemoryBlock::Desc*>(block);
44 }
45}
46
47void MetadataCache::Save(MemoryBlock* block,
48 const MemoryBlock::Desc& original_desc) {

Callers 8

GetLeftBuddyMethod · 0.80
GetRightBuddyMethod · 0.80
SplitMethod · 0.80
MergeMethod · 0.80
MarkAsFreeMethod · 0.80
~BuddyAllocatorMethod · 0.80
FreeMethod · 0.80
SplitToAllocMethod · 0.80

Calls 3

CheckGuardsMethod · 0.80
findMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected