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

Method AllocateRaw

tensorflow/core/framework/ev_allocator.h:636–656  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

634 string Name() override { return ""; }
635
636 void* AllocateRaw(size_t alignment, size_t num_bytes) override {
637 num_bytes = AlignedSize(num_bytes);
638
639 if (num_bytes > kChunkSize) {
640 LOG(FATAL) << "Allocation of " << num_bytes << " exceeds "
641 << kChunkSize << " in EVAllocator.";
642 }
643
644 void* p = impl_.Allocate(num_bytes);
645 if (ev_allocator_collect_stats) {
646 const std::size_t alloc_size = impl_.AllocatedSize(p);
647 mutex_lock l(mu_);
648 ++stats_.num_allocs;
649 stats_.bytes_in_use += alloc_size;
650 stats_.peak_bytes_in_use =
651 std::max<int64>(stats_.peak_bytes_in_use, stats_.bytes_in_use);
652 stats_.largest_alloc_size =
653 std::max<int64>(stats_.largest_alloc_size, alloc_size);
654 }
655 return p;
656 }
657
658 size_t BatchAllocateRaw(size_t num, size_t alignment,
659 size_t num_bytes, void** ret) override {

Callers

nothing calls this directly

Calls 2

AllocateMethod · 0.45
AllocatedSizeMethod · 0.45

Tested by

no test coverage detected