| 280 | } |
| 281 | |
| 282 | GPUTensorPoolAllocator::SmallBin::SmallBin(size_t len, |
| 283 | size_t chunk_size, size_t alignment, void* begin) { |
| 284 | auto rounded_bytes = RoundedBytes(chunk_size, alignment); |
| 285 | auto buffer_size = rounded_bytes * len; |
| 286 | begin_ = begin; |
| 287 | if (begin != nullptr) { |
| 288 | end_ = static_cast<char*>(begin) + buffer_size; |
| 289 | } else { |
| 290 | end_ = nullptr; |
| 291 | } |
| 292 | |
| 293 | for (auto i = 0; i < len; ++i) { |
| 294 | buffer_.emplace(static_cast<char*>(begin) + rounded_bytes *i); |
| 295 | } |
| 296 | } |
| 297 | |
| 298 | void* GPUTensorPoolAllocator::SmallBin::AllocateRaw() { |
| 299 | std::lock_guard<spin_lock> l(lock_); |
nothing calls this directly
no test coverage detected