Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use aligned_alloc() as default allocator for HalideBuffer.h on most p…
…latforms (halide#7190) Use aligned_alloc() as default allocator for HalideBuffer.h on most platforms (See also halide#7189) Modify H::R::Buffer to default to using `aligned_alloc()` instead of `malloc()`, except: - If user code passes a non-null `allocate_fn` or `deallocate_fn`, we always use those (and/or malloc/free) - If the code is compiling under MSVC, never use `aligned_alloc` (Windows doesn't support it) - If HALIDE_RUNTIME_BUFFER_USE_ALIGNED_ALLOC is defined to be 0, never use `aligned_alloc` (this is to allow for usage on e.g. older Android and OSX versions which don't provide `aligned_alloc()` in the stdlib, regardless of C++ versions.) Also, as with halide#7189, this ensures that the allocated space has the start of the host data as 128-aligned, and also now ensures that the size allocated 128-aligned (rounding up as needed).
- Loading branch information