huggingface / candle

Minimalist ML framework for Rust
Apache License 2.0
15.84k stars 957 forks source link

Unable to compile candle-core under Raspberry Pi #1625

Open dayn9t opened 9 months ago

dayn9t commented 9 months ago

cat /etc/issue Debian GNU/Linux 12 \n \l

rustc -V rustc 1.77.0-nightly (d5fd09972 2024-01-22)

gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc/aarch64-linux-gnu/12/lto-wrapper Target: aarch64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Debian 12.2.0-14' --with-bugurl=file:///usr/share/doc/gcc-12/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-12 --program-prefix=aarch64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-libquadmath --disable-libquadmath-support --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --enable-fix-cortex-a53-843419 --disable-werror --enable-checking=release --build=aarch64-linux-gnu --host=aarch64-linux-gnu --target=aarch64-linux-gnu Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 12.2.0 (Debian 12.2.0-14)

The error message is as follows:

error: instruction requires: fullfp16 --> /home/jiang/.cargo/registry/src/mirrors.sjtug.sjtu.edu.cn-4f7dbcce21e258a2/gemm-common-0.17.0/src/simd.rs:1982:18 1982 "fmla {0:v}.8h, {1:v}.8h, {2:v}.h[0]", ^
EricLBuehler commented 9 months ago

Are you attempting to compile with CUDA, flash attention or anything which requires CUDA kernels?

sarah-quinones commented 9 months ago

this looks like a bug on my part. will try to fix it soon-ish

sarah-quinones commented 8 months ago

this might be a rustc bug actually, there's no feature called fullfp16 on the rust side

Pox-here commented 5 months ago

Experiencing the same. Tried to follow the thread further but found currently no solution. Was this issue solved?

    --> /home/[user]/.cargo/registry/src/index.crates.io-6f17d22bba15001f/gemm-common-0.17.1/src/simd.rs:2024:18
     |
2024 |                 "fmla {0:v}.8h, {1:v}.8h, {2:v}.h[7]",
     |                  ^
     |
note: instantiated into assembly here
    --> <inline asm>:1:2
     |
1    |     fmla v0.8h, v1.8h, v2.h[7]

Tnx

evilsocket commented 4 months ago

Can confirm this happens for any ARM target (in my case aarch64-apple-ios) even without default features enabled. I suspect the reason is this not being set as optional/conditional. As far as I can tell gemm does not support ARM.

evilsocket commented 4 months ago

Solved by adding this to my .cargo/config.toml:

[target.'cfg(any(target_arch = "arm", target_arch = "aarch64"))']
rustflags = ["-C", "target-feature=+fp16"]
gauthamk28 commented 1 month ago

Solved by adding this to my .cargo/config.toml:

[target.'cfg(any(target_arch = "arm", target_arch = "aarch64"))']
rustflags = ["-C", "target-feature=+fp16"]

After adding this in my raspberry pi 5 its still not working , can you please help me fix this ?

super-fun-surf commented 1 month ago

getting the same error trying to compile for iOS tried the rustflags solution above and it is still not working.

skyne98 commented 1 month ago

Same here!

Compiling on Windows for Android. Rustflags are set. Config is set to the Android NDK.

Is there a solution to this?

@sarah-ek

Thanks for the help in advance :)

sarah-quinones commented 1 month ago

dunno

super-fun-surf commented 1 month ago

removing gemm dependency for iOS got it to build.

gauthamk28 commented 3 weeks ago

removing gemm dependency for iOS got it to build.

Can you please tell me how did you got it to build , because when I removed gemm dependancy , I am getting the below error: gemm is used in candle-core/src/cpu_backend/mod.rs:1256:13