| 149 | } |
| 150 | |
| 151 | void* 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 | |
| 167 | void TensorPoolAllocator::DeallocateRaw(void* ptr) { |
| 168 | auto light_header = GetLightHeader(ptr); |
no test coverage detected