fix cpu compile (#1897)

This commit is contained in:
Awni Hannun 2025-02-24 14:10:30 -08:00 committed by GitHub
parent a44dc4bdb0
commit 7face5d9fd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 2 deletions

View File

@ -18,13 +18,16 @@ if [ "$CLANG" = "TRUE" ]; then
#include <complex> #include <complex>
#include <cstdint> #include <cstdint>
#include <vector> #include <vector>
#ifdef __ARM_FEATURE_FP16_SCALAR_ARITHMETIC
#include <arm_fp16.h>
#endif
EOM EOM
CC_FLAGS="-arch ${ARCH}" CC_FLAGS="-arch ${ARCH} -nobuiltininc -nostdinc"
else else
CC_FLAGS="-std=c++17" CC_FLAGS="-std=c++17"
fi 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" cat << EOF > "$OUTPUT_FILE"
const char* get_kernel_preamble() { const char* get_kernel_preamble() {

View File

@ -953,6 +953,7 @@ class TestCompile(mlx_tests.MLXTestCase):
self.assertEqual(out[1].shape, (2, 2, 5)) self.assertEqual(out[1].shape, (2, 2, 5))
def test_leaks(self): def test_leaks(self):
gc.collect()
if mx.metal.is_available(): if mx.metal.is_available():
mem_pre = mx.metal.get_active_memory() mem_pre = mx.metal.get_active_memory()
else: else: