-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Framework] Support custom allocator #10013
[Framework] Support custom allocator #10013
Conversation
Thanks for your contribution! |
CustomAllocator GetCustomAllocator() { return custom_allocator_; } | ||
|
||
private: | ||
CustomAllocator custom_allocator_; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
是否有必要进行初始化?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不需要初始化,用的Lazy Singleton,实际使用的时候才初始化。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CustomAllocator本身也已经初始化
struct LITE_API CustomAllocator {
void* (*alloc)(size_t size, size_t alignment) = nullptr;
void (*free)(void* ptr) = nullptr;
};
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
PR devices
Framework
PR types
New features
PR changes
API
Description
新增外部 API 用于设置 Allocator,其中 PaddleLite 框架传入默认 alignment 值为64,用于Byte alignment,用户可自定义。
使用方法: