ml-explore / mlx

MLX: An array framework for Apple silicon
https://ml-explore.github.io/mlx/
MIT License
15.01k stars 856 forks source link

error: "NEON intrinsics not available with the soft-float ABI. Please use -mfloat-abi=softfp or -mfloat-abi=hard" #20

Open stephanj opened 5 months ago

stephanj commented 5 months ago

When building the mlx project I'm getting an error in regards to : NEON intrinsics not available with the soft-float ABI Please use -mfloat-abi=softfp or -mfloat-abi=hard

ChatGPT suggests updating MakeFile with, but this doesn't work

CFLAGS += -mfloat-abi=softfp 

or updating CMakeLists.txt (in project root) didn't help either.

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfloat-abi=softfp")

Steps to reproduce

git clone git@github.com:ml-explore/mlx.git mlx && cd mlx

mkdir -p build && cd build
cmake .. && make -j

throws

/Library/Developer/CommandLineTools/usr/lib/clang/15.0.0/include/arm_neon.h:28:2: error: "NEON intrinsics not available with the soft-float ABI. Please use -mfloat-abi=softfp or -mfloat-abi=hard"
#error "NEON intrinsics not available with the soft-float ABI. Please use -mfloat-abi=softfp or -mfloat-abi=hard"
 ^
/Users/stephan/projects/mlx/mlx/backend/accelerate/softmax.cpp:59:8: error: unknown type name 'float16x8_t'; did you mean 'float16_t'?
inline float16x8_t neon_fast_exp(float16x8_t x) {
       ^~~~~~~~~~~
       float16_t
/Users/stephan/projects/mlx/mlx/types/half_types.h:16:29: note: 'float16_t' declared here
typedef struct _MLX_Float16 float16_t;
                            ^
/Users/stephan/projects/mlx/mlx/backend/accelerate/softmax.cpp:59:34: error: unknown type name 'float16x8_t'; did you mean 'float16_t'?
inline float16x8_t neon_fast_exp(float16x8_t x) {
                                 ^~~~~~~~~~~
                                 float16_t
...

Apple M1 Max I'm on Sonoma 14.1.1 (23B81) cmake version 3.27.9 Python 3.10.5

stephanj commented 5 months ago

Full error list:

/Library/Developer/CommandLineTools/usr/lib/clang/15.0.0/include/arm_neon.h:28:2: error: "NEON intrinsics not available with the soft-float ABI. Please use -mfloat-abi=softfp or -mfloat-abi=hard"
#error "NEON intrinsics not available with the soft-float ABI. Please use -mfloat-abi=softfp or -mfloat-abi=hard"
 ^
/Users/stephan/projects/mlx/mlx/backend/accelerate/softmax.cpp:59:8: error: unknown type name 'float16x8_t'; did you mean 'float16_t'?
inline float16x8_t neon_fast_exp(float16x8_t x) {
       ^~~~~~~~~~~
       float16_t
/Users/stephan/projects/mlx/mlx/types/half_types.h:16:29: note: 'float16_t' declared here
typedef struct _MLX_Float16 float16_t;
                            ^
/Users/stephan/projects/mlx/mlx/backend/accelerate/softmax.cpp:59:34: error: unknown type name 'float16x8_t'; did you mean 'float16_t'?
inline float16x8_t neon_fast_exp(float16x8_t x) {
                                 ^~~~~~~~~~~
                                 float16_t
/Users/stephan/projects/mlx/mlx/types/half_types.h:16:29: note: 'float16_t' declared here
typedef struct _MLX_Float16 float16_t;
                            ^
/Users/stephan/projects/mlx/mlx/backend/accelerate/softmax.cpp:60:20: error: use of undeclared identifier 'vdupq_n_f16'
  x = vmulq_f16(x, vdupq_n_f16(1.442695)); // multiply with log_2(e)
                   ^
/Users/stephan/projects/mlx/mlx/backend/accelerate/softmax.cpp:61:20: error: use of undeclared identifier 'vdupq_n_f16'
  x = vmaxq_f16(x, vdupq_n_f16(-14)); // clamp under with -14
                   ^
/Users/stephan/projects/mlx/mlx/backend/accelerate/softmax.cpp:62:20: error: use of undeclared identifier 'vdupq_n_f16'
  x = vminq_f16(x, vdupq_n_f16(14)); // clamp over with 14
                   ^
/Users/stephan/projects/mlx/mlx/backend/accelerate/softmax.cpp:64:3: error: unknown type name 'float16x8_t'; did you mean 'float16_t'?
  float16x8_t ipart = vrndmq_f16(vaddq_f16(x, vdupq_n_f16(0.5)));
  ^~~~~~~~~~~
  float16_t
/Users/stephan/projects/mlx/mlx/types/half_types.h:16:29: note: 'float16_t' declared here
typedef struct _MLX_Float16 float16_t;
                            ^
/Users/stephan/projects/mlx/mlx/backend/accelerate/softmax.cpp:64:47: error: use of undeclared identifier 'vdupq_n_f16'
  float16x8_t ipart = vrndmq_f16(vaddq_f16(x, vdupq_n_f16(0.5)));
                                              ^
/Users/stephan/projects/mlx/mlx/backend/accelerate/softmax.cpp:65:3: error: unknown type name 'float16x8_t'; did you mean 'float16_t'?
  float16x8_t fpart = vsubq_f16(x, ipart);
  ^~~~~~~~~~~
  float16_t
/Users/stephan/projects/mlx/mlx/types/half_types.h:16:29: note: 'float16_t' declared here
typedef struct _MLX_Float16 float16_t;
                            ^
/Users/stephan/projects/mlx/mlx/backend/accelerate/softmax.cpp:65:23: error: use of undeclared identifier 'vsubq_f16'
  float16x8_t fpart = vsubq_f16(x, ipart);
                      ^
/Users/stephan/projects/mlx/mlx/backend/accelerate/softmax.cpp:67:7: error: use of undeclared identifier 'vdupq_n_f16'
  x = vdupq_n_f16(1.535336188319500e-4f);
      ^
/Users/stephan/projects/mlx/mlx/backend/accelerate/softmax.cpp:68:17: error: use of undeclared identifier 'vdupq_n_f16'
  x = vfmaq_f16(vdupq_n_f16(1.339887440266574e-3f), x, fpart);
                ^
/Users/stephan/projects/mlx/mlx/backend/accelerate/softmax.cpp:69:17: error: use of undeclared identifier 'vdupq_n_f16'
  x = vfmaq_f16(vdupq_n_f16(1.339887440266574e-3f), x, fpart);
                ^
/Users/stephan/projects/mlx/mlx/backend/accelerate/softmax.cpp:70:17: error: use of undeclared identifier 'vdupq_n_f16'
  x = vfmaq_f16(vdupq_n_f16(9.618437357674640e-3f), x, fpart);
                ^
/Users/stephan/projects/mlx/mlx/backend/accelerate/softmax.cpp:71:17: error: use of undeclared identifier 'vdupq_n_f16'
  x = vfmaq_f16(vdupq_n_f16(5.550332471162809e-2f), x, fpart);
                ^
/Users/stephan/projects/mlx/mlx/backend/accelerate/softmax.cpp:72:17: error: use of undeclared identifier 'vdupq_n_f16'
  x = vfmaq_f16(vdupq_n_f16(2.402264791363012e-1f), x, fpart);
                ^
/Users/stephan/projects/mlx/mlx/backend/accelerate/softmax.cpp:73:17: error: use of undeclared identifier 'vdupq_n_f16'
  x = vfmaq_f16(vdupq_n_f16(6.931472028550421e-1f), x, fpart);
                ^
/Users/stephan/projects/mlx/mlx/backend/accelerate/softmax.cpp:74:17: error: use of undeclared identifier 'vdupq_n_f16'
  x = vfmaq_f16(vdupq_n_f16(1.000000000000000f), x, fpart);
                ^
/Users/stephan/projects/mlx/mlx/backend/accelerate/softmax.cpp:78:3: error: unknown type name 'int16x8_t'; did you mean 'int16_t'?
  int16x8_t epart = vcvtq_s16_f16(ipart);
  ^~~~~~~~~
  int16_t
/Library/Developer/CommandLineTools/SDKs/MacOSX14.0.sdk/usr/include/sys/_types/_int16_t.h:30:33: note: 'int16_t' declared here
typedef short                   int16_t;
                                ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make[2]: *** [CMakeFiles/mlx.dir/mlx/backend/accelerate/softmax.cpp.o] Error 1
make[1]: *** [CMakeFiles/mlx.dir/all] Error 2
make: *** [all] Error 2
jagrit06 commented 5 months ago

Can you tell me what the results are when you run xcode-select -p ? Looking at the path /Library/Developer/CommandLineTools, it looks like you might not have Xcode installed or maybe it is not set to the default developer dir - we will update the docs to reflect that Xcode is needed to build from source

The problem might be resolved if you install Xcode (from the app store should be fine) and then try building again

artificalaudio commented 5 months ago

I can confirm it's fine to build on M1 Mac (Ventura 13.4) @jagrit06 . I built here on M1 Air with cmake version 3.27.4, Python 3.10.13 (and xcode and command line tools installed). So it's totally possible @stephanj

awni commented 5 months ago

Please reopen if this is still unresolved.

stephanj commented 5 months ago

I have xcode installed (Version 15.0.1 (15A507))

$ xcode-select -p /Applications/Xcode.app/Contents/Developer

Please re-open issue and thx for your help!

stephanj commented 5 months ago

FYI - The complete install worked on a Mac Studio (Apple M1 Ultra) but not on a MacBook Pro (Apple M1 Max)

fozziethebeat commented 5 months ago

I also have this problem. The key issue is the same:

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/15.0.0/include/arm_neon.h:28:2: error: "NEON intrinsics not available with the soft-float ABI. Please use -mfloat-abi=softfp or -mfloat-abi=hard"

I'm running Sonoma 14.1.2 with a Macbookpro M2.

Cmake is version 3.27.1

xcode-select-p reports

/Applications/Xcode.app/Contents/Developer

Also with version 15.0.1

awni commented 5 months ago

Sorry closed this prematurely, reopened.

jagrit06 commented 5 months ago

Would you mind adding the following to the CMakeLists.txt in root (around line 79) and building again ?

message(STATUS "Building for processor ${CMAKE_SYSTEM_PROCESSOR}")
add_compile_options(-mfloat-abi=softfp -mfpu=neon)

What's happening is arm float16 isn't available - which it shouldn't be the case on M1 chips - if it still doesn't build correctly, we will add a Patch that builds those primitives without arm neon to be safe

fozziethebeat commented 5 months ago

I tried this with my M2 chip and it still doesn't compile for me.

awni commented 5 months ago

Duplicate https://github.com/ml-explore/mlx/issues/51

jagrit06 commented 5 months ago

I tried this with my M2 chip and it still doesn't compile for me.

Just to be sure, did the CMake build messages say “Building for arm” ?

it would be great if you could paste in all the results from the build command (add a -v option if doing a pip install from source)

fozziethebeat commented 5 months ago

That's probably the problem. It's building for x86_64

-- Building METAL sources
-- Building with SDK for MacOS version 14.0

-- Building for processor x86_64
-- Accelerate found /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/Accelerate.framework
CMake Deprecation Warning at build/_deps/doctest-src/CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 3.5 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.

-- Configuring done (0.8s)
-- Generating done (0.0s)
-- Build files have been written to: /Users/fozziethebeat/devel/mlx/build
[  1%] Building gemv.air
[  2%] Building arange.air
[  3%] Building random.air
[  4%] Building gemm.air
[  5%] Building copy.air
[  8%] Building indexing.air
[  8%] Building unary.air
[  9%] Building softmax.air
[ 10%] Building sort.air
[ 11%] Building arg_reduce.air
[ 12%] Building binary.air
[ 13%] Building conv.air
[ 15%] Building reduce.air
[ 16%] Building scan.air
[ 17%] Building mlx.metallib
[ 17%] Built target mlx-metallib
[ 18%] Building CXX object CMakeFiles/mlx.dir/mlx/allocator.cpp.o
[ 19%] Building CXX object CMakeFiles/mlx.dir/mlx/device.cpp.o
[ 20%] Building CXX object CMakeFiles/mlx.dir/mlx/array.cpp.o
[ 22%] Building CXX object CMakeFiles/mlx.dir/mlx/fft.cpp.o
[ 23%] Building CXX object CMakeFiles/mlx.dir/mlx/random.cpp.o
[ 24%] Building CXX object CMakeFiles/mlx.dir/mlx/ops.cpp.o
[ 25%] Building CXX object CMakeFiles/mlx.dir/mlx/primitives.cpp.o
[ 26%] Building CXX object CMakeFiles/mlx.dir/mlx/dtype.cpp.o
[ 27%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/common/arg_reduce.cpp.o
[ 29%] Building CXX object CMakeFiles/mlx.dir/mlx/graph_utils.cpp.o
[ 30%] Building CXX object CMakeFiles/mlx.dir/mlx/load.cpp.o
[ 31%] Building CXX object CMakeFiles/mlx.dir/mlx/scheduler.cpp.o
[ 32%] Building CXX object CMakeFiles/mlx.dir/mlx/transforms.cpp.o
[ 33%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/common/erf.cpp.o
[ 34%] Building CXX object CMakeFiles/mlx.dir/mlx/utils.cpp.o
[ 36%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/common/copy.cpp.o
[ 37%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/common/conv.cpp.o
[ 39%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/common/reduce.cpp.o
[ 40%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/common/binary.cpp.o
[ 41%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/common/scan.cpp.o
[ 41%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/common/fft.cpp.o
[ 43%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/common/indexing.cpp.o
[ 44%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/common/load.cpp.o
[ 45%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/common/softmax.cpp.o
[ 46%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/common/primitives.cpp.o
[ 47%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/common/threefry.cpp.o
[ 50%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/accelerate/matmul.cpp.o
[ 48%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/accelerate/conv.cpp.o
[ 51%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/accelerate/primitives.cpp.o
[ 52%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/common/sort.cpp.o
[ 54%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/metal/conv.cpp.o
[ 55%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/metal/copy.cpp.o
[ 55%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/accelerate/reduce.cpp.o
[ 56%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/metal/allocator.cpp.o
[ 58%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/metal/fft.cpp.o
[ 59%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/metal/scan.cpp.o
[ 60%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/accelerate/softmax.cpp.o
[ 61%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/metal/primitives.cpp.o
[ 62%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/metal/reduce.cpp.o
[ 63%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/metal/metal.cpp.o
[ 65%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/metal/indexing.cpp.o
[ 66%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/metal/matmul.cpp.o
[ 67%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/metal/sort.cpp.o
[ 68%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/metal/device.cpp.o
[ 69%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/metal/softmax.cpp.o
In file included from /Users/fozziethebeat/devel/mlx/mlx/backend/accelerate/softmax.cpp:6:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/15.0.0/include/arm_neon.h:28:2: error: "NEON intrinsics not available with the soft-float ABI. Please use -mfloat-abi=softfp or -mfloat-abi=hard"
#error "NEON intrinsics not available with the soft-float ABI. Please use -mfloat-abi=softfp or -mfloat-abi=hard"
 ^
/Users/fozziethebeat/devel/mlx/mlx/backend/accelerate/softmax.cpp:59:8: error: unknown type name 'float16x8_t'; did you mean 'float16_t'?
inline float16x8_t neon_fast_exp(float16x8_t x) {
       ^~~~~~~~~~~
       float16_t
/Users/fozziethebeat/devel/mlx/mlx/types/half_types.h:16:29: note: 'float16_t' declared here
typedef struct _MLX_Float16 float16_t;
                            ^
/Users/fozziethebeat/devel/mlx/mlx/backend/accelerate/softmax.cpp:59:34: error: unknown type name 'float16x8_t'; did you mean 'float16_t'?
inline float16x8_t neon_fast_exp(float16x8_t x) {
                                 ^~~~~~~~~~~
                                 float16_t
/Users/fozziethebeat/devel/mlx/mlx/types/half_types.h:16:29: note: 'float16_t' declared here
typedef struct _MLX_Float16 float16_t;
                            ^
/Users/fozziethebeat/devel/mlx/mlx/backend/accelerate/softmax.cpp:60:20: error: use of undeclared identifier 'vdupq_n_f16'
  x = vmulq_f16(x, vdupq_n_f16(1.442695)); // multiply with log_2(e)
                   ^
/Users/fozziethebeat/devel/mlx/mlx/backend/accelerate/softmax.cpp:61:20: error: use of undeclared identifier 'vdupq_n_f16'
  x = vmaxq_f16(x, vdupq_n_f16(-14)); // clamp under with -14
                   ^
/Users/fozziethebeat/devel/mlx/mlx/backend/accelerate/softmax.cpp:62:20: error: use of undeclared identifier 'vdupq_n_f16'
  x = vminq_f16(x, vdupq_n_f16(14)); // clamp over with 14
                   ^
/Users/fozziethebeat/devel/mlx/mlx/backend/accelerate/softmax.cpp:64:3: error: unknown type name 'float16x8_t'; did you mean 'float16_t'?
  float16x8_t ipart = vrndmq_f16(vaddq_f16(x, vdupq_n_f16(0.5)));
  ^~~~~~~~~~~
  float16_t
/Users/fozziethebeat/devel/mlx/mlx/types/half_types.h:16:29: note: 'float16_t' declared here
typedef struct _MLX_Float16 float16_t;
                            ^
/Users/fozziethebeat/devel/mlx/mlx/backend/accelerate/softmax.cpp:64:47: error: use of undeclared identifier 'vdupq_n_f16'
  float16x8_t ipart = vrndmq_f16(vaddq_f16(x, vdupq_n_f16(0.5)));
                                              ^
/Users/fozziethebeat/devel/mlx/mlx/backend/accelerate/softmax.cpp:65:3: error: unknown type name 'float16x8_t'; did you mean 'float16_t'?
  float16x8_t fpart = vsubq_f16(x, ipart);
  ^~~~~~~~~~~
  float16_t
/Users/fozziethebeat/devel/mlx/mlx/types/half_types.h:16:29: note: 'float16_t' declared here
typedef struct _MLX_Float16 float16_t;
                            ^
/Users/fozziethebeat/devel/mlx/mlx/backend/accelerate/softmax.cpp:65:23: error: use of undeclared identifier 'vsubq_f16'
  float16x8_t fpart = vsubq_f16(x, ipart);
                      ^
/Users/fozziethebeat/devel/mlx/mlx/backend/accelerate/softmax.cpp:67:7: error: use of undeclared identifier 'vdupq_n_f16'
  x = vdupq_n_f16(1.535336188319500e-4f);
      ^
/Users/fozziethebeat/devel/mlx/mlx/backend/accelerate/softmax.cpp:68:17: error: use of undeclared identifier 'vdupq_n_f16'
  x = vfmaq_f16(vdupq_n_f16(1.339887440266574e-3f), x, fpart);
                ^
/Users/fozziethebeat/devel/mlx/mlx/backend/accelerate/softmax.cpp:69:17: error: use of undeclared identifier 'vdupq_n_f16'
  x = vfmaq_f16(vdupq_n_f16(1.339887440266574e-3f), x, fpart);
                ^
/Users/fozziethebeat/devel/mlx/mlx/backend/accelerate/softmax.cpp:70:17: error: use of undeclared identifier 'vdupq_n_f16'
  x = vfmaq_f16(vdupq_n_f16(9.618437357674640e-3f), x, fpart);
                ^
/Users/fozziethebeat/devel/mlx/mlx/backend/accelerate/softmax.cpp:71:17: error: use of undeclared identifier 'vdupq_n_f16'
  x = vfmaq_f16(vdupq_n_f16(5.550332471162809e-2f), x, fpart);
                ^
/Users/fozziethebeat/devel/mlx/mlx/backend/accelerate/softmax.cpp:72:17: error: use of undeclared identifier 'vdupq_n_f16'
  x = vfmaq_f16(vdupq_n_f16(2.402264791363012e-1f), x, fpart);
                ^
/Users/fozziethebeat/devel/mlx/mlx/backend/accelerate/softmax.cpp:73:17: error: use of undeclared identifier 'vdupq_n_f16'
  x = vfmaq_f16(vdupq_n_f16(6.931472028550421e-1f), x, fpart);
                ^
/Users/fozziethebeat/devel/mlx/mlx/backend/accelerate/softmax.cpp:74:17: error: use of undeclared identifier 'vdupq_n_f16'
  x = vfmaq_f16(vdupq_n_f16(1.000000000000000f), x, fpart);
                ^
/Users/fozziethebeat/devel/mlx/mlx/backend/accelerate/softmax.cpp:78:3: error: unknown type name 'int16x8_t'; did you mean 'int16_t'?
  int16x8_t epart = vcvtq_s16_f16(ipart);
  ^~~~~~~~~
  int16_t
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/usr/include/sys/_types/_int16_t.h:30:33: note: 'int16_t' declared here
typedef short                   int16_t;
                                ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make[2]: *** [CMakeFiles/mlx.dir/mlx/backend/accelerate/softmax.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [CMakeFiles/mlx.dir/all] Error 2
isaka commented 5 months ago

I run into this issue, just trying it out on an M3 Pro device. By prepending the processor setting, I get the build to succeed on my machine. The build does issue a bunch of warnings, but may be worth trying:

CMAKE_SYSTEM_PROCESSOR=arm6 cmake .. && make -j 10

jagrit06 commented 5 months ago

I run into this issue, just trying it out on an M3 Pro device. By prepending the processor setting, I get the build to succeed on my machine. The build does issue a bunch of warnings, but may be worth trying:

CMAKE_SYSTEM_PROCESSOR=arm6 cmake .. && make -j 10

Hi! Quick question, could you maybe share what warnings you get ?

isaka commented 5 months ago

I run into this issue, just trying it out on an M3 Pro device. By prepending the processor setting, I get the build to succeed on my machine. The build does issue a bunch of warnings, but may be worth trying: CMAKE_SYSTEM_PROCESSOR=arm6 cmake .. && make -j 10

Hi! Quick question, could you maybe share what warnings you get ?

Certainly. I run a clean then rerun the build, here is the output:

√ isakatraore@Affinis in ~/code/applePlatforms/mlx/build => CMAKE_SYSTEM_PROCESSOR=arm6 cmake .. && make -j 10 12:56:14 -- Building METAL sources -- Building with SDK for MacOS version 14.2

-- Building for processor arm64 -- Accelerate found /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Accelerate.framework CMake Deprecation Warning at build/_deps/doctest-src/CMakeLists.txt:1 (cmake_minimum_required): Compatibility with CMake < 3.5 will be removed from a future version of CMake.

Update the VERSION argument value or use a ... suffix to tell CMake that the project does not need compatibility with older versions.

-- Configuring done (0.8s) -- Generating done (0.0s) -- Build files have been written to: /Users/isakatraore/code/applePlatforms/mlx/build [ 17%] Built target mlx-metallib [ 70%] Built target mlx [ 77%] Built target linear_regression [ 77%] Built target logistic_regression [ 77%] Built target tutorial [100%] Built target tests √ isakatraore@Affinis in ~/code/applePlatforms/mlx/build => make .. clean 12:56:25 √ isakatraore@Affinis in ~/code/applePlatforms/mlx/build => CMAKE_SYSTEM_PROCESSOR=arm6 cmake .. && make -j 10 12:56:44 -- Building METAL sources -- Building with SDK for MacOS version 14.2

-- Building for processor arm64 -- Accelerate found /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Accelerate.framework CMake Deprecation Warning at build/_deps/doctest-src/CMakeLists.txt:1 (cmake_minimum_required): Compatibility with CMake < 3.5 will be removed from a future version of CMake.

Update the VERSION argument value or use a ... suffix to tell CMake that the project does not need compatibility with older versions.

-- Configuring done (0.8s) -- Generating done (0.0s) -- Build files have been written to: /Users/isakatraore/code/applePlatforms/mlx/build [ 1%] Building random.air [ 2%] Building softmax.air [ 3%] Building arange.air [ 4%] Building unary.air [ 6%] Building scan.air [ 6%] Building indexing.air [ 11%] Building gemm.air [ 11%] Building reduce.air [ 11%] Building gemv.air [ 11%] Building sort.air [ 12%] Building copy.air [ 13%] Building conv.air [ 15%] Building binary.air [ 16%] Building arg_reduce.air [ 17%] Building mlx.metallib [ 17%] Built target mlx-metallib [ 18%] Building CXX object CMakeFiles/mlx.dir/mlx/dtype.cpp.o [ 20%] Building CXX object CMakeFiles/mlx.dir/mlx/fft.cpp.o [ 20%] Building CXX object CMakeFiles/mlx.dir/mlx/array.cpp.o [ 23%] Building CXX object CMakeFiles/mlx.dir/mlx/ops.cpp.o [ 23%] Building CXX object CMakeFiles/mlx.dir/mlx/graph_utils.cpp.o [ 24%] Building CXX object CMakeFiles/mlx.dir/mlx/device.cpp.o [ 25%] Building CXX object CMakeFiles/mlx.dir/mlx/random.cpp.o [ 27%] Building CXX object CMakeFiles/mlx.dir/mlx/load.cpp.o [ 27%] Building CXX object CMakeFiles/mlx.dir/mlx/allocator.cpp.o [ 29%] Building CXX object CMakeFiles/mlx.dir/mlx/primitives.cpp.o [ 30%] Building CXX object CMakeFiles/mlx.dir/mlx/transforms.cpp.o [ 31%] Building CXX object CMakeFiles/mlx.dir/mlx/scheduler.cpp.o [ 32%] Building CXX object CMakeFiles/mlx.dir/mlx/utils.cpp.o [ 33%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/common/arg_reduce.cpp.o [ 34%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/common/binary.cpp.o [ 36%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/common/conv.cpp.o [ 37%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/common/copy.cpp.o [ 38%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/common/erf.cpp.o [ 39%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/common/fft.cpp.o [ 40%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/common/primitives.cpp.o [ 41%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/common/reduce.cpp.o [ 43%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/common/scan.cpp.o [ 44%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/common/softmax.cpp.o [ 45%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/common/sort.cpp.o [ 46%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/common/threefry.cpp.o [ 47%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/common/indexing.cpp.o [ 48%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/common/load.cpp.o [ 50%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/accelerate/conv.cpp.o [ 51%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/accelerate/matmul.cpp.o [ 52%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/accelerate/primitives.cpp.o [ 53%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/accelerate/reduce.cpp.o [ 54%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/accelerate/softmax.cpp.o [ 55%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/metal/allocator.cpp.o [ 56%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/metal/conv.cpp.o [ 58%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/metal/copy.cpp.o [ 59%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/metal/device.cpp.o [ 60%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/metal/fft.cpp.o [ 61%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/metal/indexing.cpp.o [ 62%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/metal/matmul.cpp.o [ 63%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/metal/metal.cpp.o [ 65%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/metal/primitives.cpp.o [ 66%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/metal/scan.cpp.o [ 67%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/metal/softmax.cpp.o [ 68%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/metal/sort.cpp.o [ 69%] Building CXX object CMakeFiles/mlx.dir/mlx/backend/metal/reduce.cpp.o [ 70%] Linking CXX static library libmlx.a [ 70%] Built target mlx [ 73%] Building CXX object examples/cpp/CMakeFiles/tutorial.dir/tutorial.cpp.o [ 73%] Building CXX object tests/CMakeFiles/tests.dir/allocator_tests.cpp.o [ 74%] Building CXX object tests/CMakeFiles/tests.dir/tests.cpp.o [ 75%] Building CXX object examples/cpp/CMakeFiles/linear_regression.dir/linear_regression.cpp.o [ 76%] Building CXX object tests/CMakeFiles/tests.dir/blas_tests.cpp.o [ 77%] Building CXX object tests/CMakeFiles/tests.dir/autograd_tests.cpp.o [ 79%] Building CXX object examples/cpp/CMakeFiles/logistic_regression.dir/logistic_regression.cpp.o [ 80%] Building CXX object tests/CMakeFiles/tests.dir/array_tests.cpp.o [ 81%] Building CXX object tests/CMakeFiles/tests.dir/arg_reduce_tests.cpp.o [ 82%] Building CXX object tests/CMakeFiles/tests.dir/creations_tests.cpp.o clangclang: : clangwarning: : argument unused during compilation: '-mfloat-abi=softfp' [-Wunused-command-line-argument]warning: argument unused during compilation: '-mfloat-abi=softfp' [-Wunused-command-line-argument]clang : clang: warning: argument unused during compilation: '-mfpu=neon' [-Wunused-command-line-argument] clang: warning: argument unused during compilation: '-mfloat-abi=softfp' [-Wunused-command-line-argument] clang: warning: argument unused during compilation: '-mfpu=neon' [-Wunused-command-line-argument] clang: warning: argument unused during compilation: '-mfloat-abi=softfp' [-Wunused-command-line-argument] clang: warning: argument unused during compilation: '-mfpu=neon' [-Wunused-command-line-argument] argument unused during compilation: '-mfpu=neon' [-Wunused-command-line-argument]nd-line-argument]warning:

clang: warning: argument unused during compilation: '-mfpu=neon' [-Wunused-command-line-argument] clang: warning: argument unused during compilation: '-mfloat-abi=softfp' [-Wunused-command-line-argument] clang: warning: argument unused during compilation: '-mfpu=neon' [-Wunused-command-line-argument] clang: warning: argument unused during compilation: '-mfloat-abi=softfp' [-Wunused-command-line-argument] clang: warning: argument unused during compilation: '-mfpu=neon' [-Wunused-command-line-argument] clang: warning: argument unused during compilation: '-mfloat-abi=softfp' [-Wunused-command-line-argument] clang: warning: argument unused during compilation: '-mfpu=neon' [-Wunused-command-line-argument] clang: warning: argument unused during compilation: '-mfloat-abi=softfp' [-Wunused-command-line-argument] clang: warning: argument unused during compilation: '-mfpu=neon' [-Wunused-command-line-argument] clang: warning: argument unused during compilation: '-mfloat-abi=softfp' [-Wunused-command-line-argument] clang: warning: argument unused during compilation: '-mfpu=neon' [-Wunused-command-line-argument] [ 83%] Building CXX object tests/CMakeFiles/tests.dir/device_tests.cpp.o clang: warning: argument unused during compilation: '-mfloat-abi=softfp' [-Wunused-command-line-argument] clang: warning: argument unused during compilation: '-mfpu=neon' [-Wunused-command-line-argument] [ 84%] Linking CXX executable linear_regression [ 86%] Building CXX object tests/CMakeFiles/tests.dir/eval_tests.cpp.o [ 87%] Building CXX object tests/CMakeFiles/tests.dir/fft_tests.cpp.o clang: warning: argument unused during compilation: '-mfloat-abi=softfp' [-Wunused-command-line-argument] clang: warning: argument unused during compilation: '-mfpu=neon' [-Wunused-command-line-argument] [ 88%] Linking CXX executable tutorial [ 89%] Linking CXX executable logistic_regression clang: warning: argument unused during compilation: '-mfloat-abi=softfp' [-Wunused-command-line-argument] clang: warning: argument unused during compilation: '-mfpu=neon' [-Wunused-command-line-argument] [ 90%] Building CXX object tests/CMakeFiles/tests.dir/graph_optimize_tests.cpp.o clang: warning: argument unused during compilation: '-mfloat-abi=softfp' [-Wunused-command-line-argument] clang: warning: argument unused during compilation: '-mfpu=neon' [-Wunused-command-line-argument] [ 91%] Building CXX object tests/CMakeFiles/tests.dir/load_tests.cpp.o clang: warning: argument unused during compilation: '-mfloat-abi=softfp' [-Wunused-command-line-argument] clang: warning: argument unused during compilation: '-mfpu=neon' [-Wunused-command-line-argument] [ 93%] Building CXX object tests/CMakeFiles/tests.dir/ops_tests.cpp.o clang: warning: argument unused during compilation: '-mfloat-abi=softfp' [-Wunused-command-line-argument] clang: warning: argument unused during compilation: '-mfpu=neon' [-Wunused-command-line-argument] [ 94%] Building CXX object tests/CMakeFiles/tests.dir/random_tests.cpp.o clang: warning: argument unused during compilation: '-mfloat-abi=softfp' [-Wunused-command-line-argument] clang: warning: argument unused during compilation: '-mfpu=neon' [-Wunused-command-line-argument] [ 95%] Building CXX object tests/CMakeFiles/tests.dir/utils_tests.cpp.o [ 96%] Building CXX object tests/CMakeFiles/tests.dir/scheduler_tests.cpp.o clang: warning: argument unused during compilation: '-mfloat-abi=softfp' [-Wunused-command-line-argument] clang: warning: argument unused during compilation: '-mfpu=neon' [-Wunused-command-line-argument] clang: warning: argument unused during compilation: '-mfloat-abi=softfp' [-Wunused-command-line-argument] clang: warning: argument unused during compilation: '-mfpu=neon' [-Wunused-command-line-argument] [ 97%] Building CXX object tests/CMakeFiles/tests.dir/vmap_tests.cpp.o clang: warning: argument unused during compilation: '-mfloat-abi=softfp' [-Wunused-command-line-argument] clang: warning: argument unused during compilation: '-mfpu=neon' [-Wunused-command-line-argument] [ 98%] Building CXX object tests/CMakeFiles/tests.dir/metal_tests.cpp.o clang: warning: argument unused during compilation: '-mfloat-abi=softfp' [-Wunused-command-line-argument] clang: warning: argument unused during compilation: '-mfpu=neon' [-Wunused-command-line-argument] [ 98%] Built target tutorial [ 98%] Built target linear_regression [ 98%] Built target logistic_regression [100%] Linking CXX executable tests [100%] Built target tests √ isakatraore@Affinis in ~/code/applePlatforms/mlx/build

fozziethebeat commented 5 months ago

I just updated to HEAD and building the C++ library from source worked without problem.

This is fixed for me.