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

Method Buffer

tensorflow/core/common_runtime/gpu_tensorpool_allocator.cc:345–359  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

343}
344
345GPUTensorPoolAllocator::Buffer::Buffer(size_t len, size_t chunk_size,
346 size_t alignment, void* begin) {
347 auto rounded_bytes = RoundedBytes(chunk_size, alignment);
348 auto buffer_size = rounded_bytes * len;
349 begin_ = begin;
350 if (begin != nullptr) {
351 end_ = static_cast<char*>(begin) + buffer_size;
352 } else {
353 end_ = nullptr;
354 }
355
356 for (auto i = 0; i < len; ++i) {
357 buffer_.emplace(static_cast<char*>(begin) + rounded_bytes *i);
358 }
359}
360
361void* GPUTensorPoolAllocator::Buffer::Allocate() {
362 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