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

Method SmallBin

tensorflow/core/common_runtime/gpu_tensorpool_allocator.cc:282–296  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

280}
281
282GPUTensorPoolAllocator::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
298void* GPUTensorPoolAllocator::SmallBin::AllocateRaw() {
299 std::lock_guard<spin_lock> l(lock_);

Callers

nothing calls this directly

Calls 2

RoundedBytesFunction · 0.70
emplaceMethod · 0.45

Tested by

no test coverage detected