Ios compile (#784)

* try to fix build for ios

* skip cpu compile

* fix namespace

* fix namespace

* Use CMake for platform specific cpu compile

---------

Co-authored-by: Angelos Katharopoulos <a_katharopoulos@apple.com>
This commit is contained in:
Awni Hannun
2024-03-04 20:02:26 -08:00
committed by GitHub
parent 6686e61ca4
commit 7b463ffb07
8 changed files with 481 additions and 415 deletions

View File

@@ -7,6 +7,7 @@
#include "mlx/allocator.h"
#include "mlx/compile.h"
#include "mlx/compile_impl.h"
#include "mlx/primitives.h"
#include "mlx/transforms.h"
#include "mlx/transforms_impl.h"
@@ -765,7 +766,8 @@ std::function<std::vector<array>(const std::vector<array>&)> compile(
size_t fun_id,
bool shapeless /* = false */,
std::vector<uint64_t> constants /* = {} */) {
if (compile_mode() == CompileMode::disabled) {
if (compile_mode() == CompileMode::disabled ||
!(compile_available_for_device(default_device()))) {
return fun;
}
return [fun, fun_id, shapeless, constants = std::move(constants)](