| 2631 | }; |
| 2632 | |
| 2633 | void* 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 | |
| 2646 | void MIOpenDeallocatorCallback(void* ctx, void* mem) { |
| 2647 | // Don't need dealloactor since the TensorFlow heap will automatically reclaim |
nothing calls this directly
no test coverage detected