| 201 | } |
| 202 | |
| 203 | void* GPUTensorPoolAllocator::AllocateRaw(size_t alignment, |
| 204 | size_t num_bytes) { |
| 205 | if (!inited_.load()) { |
| 206 | auto ptr = sub_allocator_->Alloc(alignment, num_bytes); |
| 207 | mem_planner_->TrackAllocate(alignment, num_bytes, ptr); |
| 208 | return ptr; |
| 209 | } |
| 210 | |
| 211 | if (SmallAlloc(num_bytes)) { |
| 212 | return SmallAllocate(alignment, num_bytes); |
| 213 | } |
| 214 | if (unlikely(stats_)) { |
| 215 | return BigAllocateStatistic(alignment, num_bytes); |
| 216 | } else { |
| 217 | return BigAllocate(alignment, num_bytes); |
| 218 | } |
| 219 | } |
| 220 | |
| 221 | void GPUTensorPoolAllocator::DeallocateRaw(void* ptr) { |
| 222 | if (!inited_.load()) { |
no test coverage detected