Index: Bitcode/simd_ops/halide_buffer.h =================================================================== --- Bitcode/simd_ops/halide_buffer.h +++ Bitcode/simd_ops/halide_buffer.h @@ -1,6 +1,9 @@ #include #include #include +#if !defined(__APPLE__) +#include +#endif #ifndef HALIDE_ATTRIBUTE_ALIGN #ifdef _MSC_VER #define HALIDE_ATTRIBUTE_ALIGN(x) __declspec(align(x)) Index: Bitcode/simd_ops/simd_ops.cpp =================================================================== --- Bitcode/simd_ops/simd_ops.cpp +++ Bitcode/simd_ops/simd_ops.cpp @@ -12,7 +12,12 @@ template buffer_t make_buffer(int w, int h) { - T *mem = new T[w*h]; +#if defined(__APPLE__) + T *mem; + int err = posix_memalign((void **)&mem, 128, w*h*sizeof(T)); +#else + T *mem = (T *)memalign(128, w*h*sizeof(T)); +#endif buffer_t buf = {0}; buf.host = (uint8_t *)mem; buf.extent[0] = w;