onnxruntime/onnxruntime/core/framework/func_kernel.cc
Ryan Hill 3a32b0eb99
Change function kernels to use CustomOp APIs (#1020)
* Change function signature
* Convert compute to use custom op style APIs
* Remove dead CustomOp function
* Use CustomOp API in TensorRT EP
* Switch to new API in ngraph
2019-05-20 14:57:43 -07:00

18 lines
699 B
C++

#include "core/framework/func_kernel.h"
#include "core/framework/allocator.h"
namespace onnxruntime {
void* allocate_helper_func(void* allocator, size_t alignment, size_t size) {
// Here we only align the size, we expect the underline device allocator will
// guarantee the address alignment.
// We may update lotus' IAllocator interface to support alignment.
size_t rounded_bytes = (alignment * ((size + alignment - 1) / alignment));
auto* alloc = static_cast<IAllocator*>(allocator);
return alloc->Alloc(rounded_bytes);
}
void release_helper_func(void* allocator, void* p) {
auto* alloc = static_cast<IAllocator*>(allocator);
return alloc->Free(p);
}
} // namespace onnxruntime