Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker : fix CPU ARM build #11403

Merged
merged 2 commits into from
Jan 25, 2025
Merged

docker : fix CPU ARM build #11403

merged 2 commits into from
Jan 25, 2025

Conversation

slaren
Copy link
Collaborator

@slaren slaren commented Jan 25, 2025

This should fix the CPU docker images for ARM. The build will only be optimized for the machine running the build (GGML_NATIVE is enabled).

@slaren slaren requested a review from ngxson as a code owner January 25, 2025 00:22
@github-actions github-actions bot added the devops improvements to build systems and github actions label Jan 25, 2025
RUN if [ "$TARGETARCH" = "amd64" ]; then \
cmake -S . -B build -DGGML_BACKEND_DL=ON -DGGML_NATIVE=OFF -DGGML_CPU_ALL_VARIANTS=ON -DLLAMA_CURL=ON -DCMAKE_BUILD_TYPE=Release; \
else \
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release; \
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be add back -DLLAMA_CURL=ON ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Forgot about that, added.

@ngxson ngxson merged commit 20a7581 into master Jan 25, 2025
2 checks passed
@slaren slaren deleted the sl/fix-docker-arm branch January 25, 2025 14:23
@ngxson
Copy link
Collaborator

ngxson commented Jan 25, 2025

I triggered the CI for building docker: https://github.com/ggerganov/llama.cpp/actions/runs/12965742642

@slaren
Copy link
Collaborator Author

slaren commented Jan 25, 2025

Do you know how the docker CI is able to build arm containers? When I try docker build --platform=linux/arm64 it fails on the first RUN with exec /bin/sh: exec format error.

Looks like QEMU needs to be installed first.

@ngxson
Copy link
Collaborator

ngxson commented Jan 25, 2025

Hmm ok the CI fails due to internal compiler error: Segmentation fault signal terminated program cc1

@ngxson
Copy link
Collaborator

ngxson commented Jan 25, 2025

I think it's missing the apt install qemu-user-static step. I'm not sure why but from my other project, I have it on top of docker/setup-qemu-action@v2. Testing it now..

@slaren
Copy link
Collaborator Author

slaren commented Jan 25, 2025

It is an issue of the ARM build with gcc. The actual error is a bit earlier than that:
cc1: error: unknown value 'native+nodotprod+noi8mm+nosve' for '-mcpu'

I can fix it, but we need to choose an arm version to build for. The problem is that the only version that makes sense for a generic container is the most generic build without any features enabled, and performance is going to be very bad. So I am not sure that it is even worth to make ARM images, until support is added for building multiple versions of the CPU backend, as is done for x86. Until then, people should build their own images, optimized for their hardware.

@ngxson
Copy link
Collaborator

ngxson commented Jan 25, 2025

Hmm ok I don't have the hardware to test it either, so I think we can disable it now and see if the community can help.

If we ever bring this back in the future, probably target commonly known HW like raspberry pi or Ampere cpus.

@slaren
Copy link
Collaborator Author

slaren commented Jan 25, 2025

I will change it so that there is an argument to select the ARM architecture to build for, set to armv8-a by default (seems to be the oldest supported in docker). Otherwise we would need to delete all current ARM images to stop people from trying to use a broken docker image.

anagri pushed a commit to BodhiSearch/llama.cpp that referenced this pull request Jan 26, 2025
* docker : fix CPU ARM build

* add CURL to other builds
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
devops improvements to build systems and github actions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants