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

Function MIOpenAllocatorCallback

tensorflow/stream_executor/rocm/rocm_dnn.cc:2633–2644  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2631};
2632
2633void* MIOpenAllocatorCallback(void* ctx, size_t size_in_bytes) {
2634 auto* mac = static_cast<MIOpenAllocatorContext*>(ctx);
2635 auto allocated = mac->scratch_allocator_->AllocateBytes(size_in_bytes);
2636
2637 DeviceMemory<uint8> scratch;
2638 if (allocated.ok()) {
2639 scratch = allocated.ValueOrDie();
2640 return scratch.opaque();
2641 } else {
2642 return nullptr;
2643 }
2644}
2645
2646void MIOpenDeallocatorCallback(void* ctx, void* mem) {
2647 // Don't need dealloactor since the TensorFlow heap will automatically reclaim

Callers

nothing calls this directly

Calls 3

opaqueMethod · 0.80
AllocateBytesMethod · 0.45
okMethod · 0.45

Tested by

no test coverage detected