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

Class Desc

paddle/phi/core/memory/allocation/memory_block.h:65–107  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

63
64 // MemoryBlock::Desc describes a MemoryBlock.
65 struct Desc {
66 Desc(MemoryBlock::Type t,
67 size_t i,
68 size_t s,
69 size_t ts,
70 MemoryBlock* l,
71 MemoryBlock* r);
72 Desc();
73
74 // mutator for type
75 inline void set_type(const MemoryBlock::Type& type) {
76 this->type = type;
77 this->UpdateGuards();
78 }
79
80 // accessor for type
81 inline const MemoryBlock::Type& get_type() const { return this->type; }
82
83 // accessor for index
84 inline const size_t& get_index() const { return this->index; }
85
86 // accessor for size
87 inline const size_t& get_size() const { return this->size; }
88
89 // accessor for total_size
90 inline const size_t& get_total_size() const { return this->total_size; }
91
92 // Updates guard_begin and guard_end by hashes of the Metadata object.
93 void UpdateGuards();
94
95 // Checks that guard_begin and guard_end are hashes of the Metadata object.
96 bool CheckGuards() const;
97
98 // TODO(gangliao): compress this
99 size_t guard_begin = 0;
100 MemoryBlock::Type type = MemoryBlock::INVALID_CHUNK;
101 size_t index = 0;
102 size_t size = 0;
103 size_t total_size = 0;
104 MemoryBlock* left_buddy = nullptr;
105 MemoryBlock* right_buddy = nullptr;
106 size_t guard_end = 0;
107 };
108};
109
110// A cache for accessing memory block meta-data that may be expensive

Callers 3

InitMethod · 0.85
SplitMethod · 0.85
MergeMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected