From ebfd3618b0e64721cccd992d9859908cc75fcf74 Mon Sep 17 00:00:00 2001 From: David Koski <46639364+davidkoski@users.noreply.github.com> Date: Sun, 4 Feb 2024 12:29:17 -0800 Subject: [PATCH] fixes for building and running on iOS (#619) * fixes for building and running on iOS * per suggestion just use Accelerate --- mlx/backend/common/conv.cpp | 2 +- mlx/backend/common/default_primitives.cpp | 2 +- mlx/backend/common/qrf.cpp | 2 +- mlx/backend/metal/device.cpp | 3 ++- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/mlx/backend/common/conv.cpp b/mlx/backend/common/conv.cpp index bd8fe23ca..3f4f09d0c 100644 --- a/mlx/backend/common/conv.cpp +++ b/mlx/backend/common/conv.cpp @@ -3,7 +3,7 @@ #include #ifdef ACCELERATE_NEW_LAPACK -#include +#include #else #include #endif diff --git a/mlx/backend/common/default_primitives.cpp b/mlx/backend/common/default_primitives.cpp index bcb8bd7b4..d9023fe9b 100644 --- a/mlx/backend/common/default_primitives.cpp +++ b/mlx/backend/common/default_primitives.cpp @@ -1,7 +1,7 @@ // Copyright © 2023-2024 Apple Inc. #ifdef ACCELERATE_NEW_LAPACK -#include +#include #else #include #endif diff --git a/mlx/backend/common/qrf.cpp b/mlx/backend/common/qrf.cpp index 41561cbad..4171398fd 100644 --- a/mlx/backend/common/qrf.cpp +++ b/mlx/backend/common/qrf.cpp @@ -5,7 +5,7 @@ #include "mlx/primitives.h" #ifdef ACCELERATE_NEW_LAPACK -#include +#include #else #include #endif diff --git a/mlx/backend/metal/device.cpp b/mlx/backend/metal/device.cpp index 999c67084..7c61e68ae 100644 --- a/mlx/backend/metal/device.cpp +++ b/mlx/backend/metal/device.cpp @@ -26,7 +26,8 @@ static constexpr const char* default_mtllib_path = METAL_PATH; auto load_device() { auto devices = MTL::CopyAllDevices(); - auto device = static_cast(devices->object(0)); + auto device = static_cast(devices->object(0)) + ?: MTL::CreateSystemDefaultDevice(); if (!device) { throw std::runtime_error("Failed to load device"); }