Halide::Runtime::Buffer does not use halide_malloc and halide_free. #6171
Replies: 4 comments 7 replies
-
It's awkward, but you should be able to avoid this by calling the ctor with a NULL data ptr, then an explicit call to allocate(), eg
|
Beta Was this translation helpful? Give feedback.
-
@alexreinking Why was this closed? I'm again running in this problem. Why does it not respect the custom allocator set in the Runtime? |
Beta Was this translation helpful? Give feedback.
-
Tagging @abadams |
Beta Was this translation helpful? Give feedback.
-
Halide::Runtime::Buffer is used in contexts where there is no runtime linked. Specifically, it's what backs Halide::Buffer, which is what is used when using Halide as a JIT compiler. |
Beta Was this translation helpful? Give feedback.
-
Halide/src/runtime/HalideBuffer.h
Line 743 in a914574
The documentation of the class says that the default allocator functions are malloc and free, whereas the HalideRuntime.h specifies halide_malloc and halide_free for memory management.
Additionally, Halide::Runtime::Buffer does not allow for creating buffers with other allocators. You always go through an allocate() call using the default malloc/free, which is wasteful if you want to use a custom allocator afterwards.
Beta Was this translation helpful? Give feedback.
All reactions