diff --git a/mlx/backend/cpu/make_compiled_preamble.sh b/mlx/backend/cpu/make_compiled_preamble.sh index 04c7ff0c4..88b4c4615 100644 --- a/mlx/backend/cpu/make_compiled_preamble.sh +++ b/mlx/backend/cpu/make_compiled_preamble.sh @@ -18,13 +18,16 @@ if [ "$CLANG" = "TRUE" ]; then #include #include #include +#ifdef __ARM_FEATURE_FP16_SCALAR_ARITHMETIC +#include +#endif EOM -CC_FLAGS="-arch ${ARCH}" +CC_FLAGS="-arch ${ARCH} -nobuiltininc -nostdinc" else CC_FLAGS="-std=c++17" fi -CONTENT=$($GCC $CC_FLAGS -I "$SRCDIR" -E "$SRCDIR/mlx/backend/cpu/compiled_preamble.h" 2>/dev/null) +CONTENT=$($GCC $CC_FLAGS -I "$SRCDIR" -E -P "$SRCDIR/mlx/backend/cpu/compiled_preamble.h" 2>/dev/null) cat << EOF > "$OUTPUT_FILE" const char* get_kernel_preamble() { diff --git a/python/tests/test_compile.py b/python/tests/test_compile.py index ed283317e..8cf3b4e08 100644 --- a/python/tests/test_compile.py +++ b/python/tests/test_compile.py @@ -953,6 +953,7 @@ class TestCompile(mlx_tests.MLXTestCase): self.assertEqual(out[1].shape, (2, 2, 5)) def test_leaks(self): + gc.collect() if mx.metal.is_available(): mem_pre = mx.metal.get_active_memory() else: