tvm
tvm copied to clipboard
[Runtime] Add runtime.contrib.set_custom_cpu_allocator to use custom memalign() and free() functions
This PR adds a new function runtime.contrib.set_custom_cpu_allocator to the registry which can be used to override the memalign() and free() functions used by CPUDeviceAPI. Upstream original PR by @trevor-m .
cc @areusch
@jsheng-jian thanks for the PR! i think this maybe deserves a broader look by the community as it could potentially impact performance. just curious, did you consider a compile-time workaround here as well? would that work for your use case, or does it need to always be available?
cc @tqchen @csullivan @junrushao1994 @jwfromm
Having an extra null pointer check is not going to be significantly affect performance, but I would be curious on the implication of user-facing API.
There could be some compile-time alternatives, for example, using macros to control which alloc
/free
methods to use. Do you think it's viable in your usecase?
Thanks a lot!
@jsheng-jian could you address the question above?