mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-06-01 23:30:35 +00:00
* 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
18 lines
699 B
C++
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
|