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

Method AllocateRaw

tensorflow/core/common_runtime/tensorpool_allocator.cc:151–165  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

149}
150
151void* TensorPoolAllocator::AllocateRaw(size_t alignment,
152 size_t num_bytes) {
153 if (SmallAlloc(num_bytes)) {
154 auto header_size = std::max(sizeof(LightHeader), alignment);
155 auto total = num_bytes + header_size;
156 auto ptr = sub_allocator_->Alloc(alignment, total);
157 return SetLightHeader(ptr, total, header_size);
158 }
159
160 if (unlikely(stats_)) {
161 return BigAllocateStatistic(alignment, num_bytes);
162 } else {
163 return BigAllocate(alignment, num_bytes);
164 }
165}
166
167void TensorPoolAllocator::DeallocateRaw(void* ptr) {
168 auto light_header = GetLightHeader(ptr);

Callers 2

AllocateMethod · 0.45
AllocMethod · 0.45

Calls 5

SmallAllocFunction · 0.85
SetLightHeaderFunction · 0.85
maxFunction · 0.50
AllocMethod · 0.45
AllocateMethod · 0.45

Tested by

no test coverage detected