Repository navigation
ci(llama-cpp): compile the GPU backend once per image - #13526
Merged
Merged
Conversation
Each llama.cpp-family image built two full trees: the cpu-all tree
(GGML_BACKEND_DL, loader plus GPU backend) and a static tree for
llama-cpp-grpc and llama-cpp-rpc-server. The static tree compiled the
whole CUDA or HIP backend again for every arch. In the ROCm llama-cpp job
of master run 45793596845 each tree took 2h26m of the 4h52m compile
step, and ccache could not help: the two trees use different defines and
-fPIC, and HIP objects had no compiler launcher.
Build the RPC backend and ggml-rpc-server in the cpu-all tree instead
(CPU_ALL_RPC=ON) and copy that tree's grpc-server to llama-cpp-grpc.
grpc-server finds the RPC backend through ggml_backend_reg_by_name("RPC")
and rpc-server.cpp calls ggml_backend_load_all() first, in upstream and
in the bonsai, turboquant and olala pins, so a DL tree serves both.
The file names in the image stay the same. The two RPC binaries now link
the bundled shared ggml libraries and use the best CPU variant for the
host, as llama-cpp-cpu-all does, instead of a static build with AVX off.
The CUDA arch list, AMDGPU_TARGETS and the CPU variants do not change.
The Darwin and Windows builds do not set CPU_ALL_RPC and keep the static
llama-cpp-grpc target.
Assisted-by: Claude:claude-sonnet-5-5
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
Hosted runners kill a job at 6h. The ROCm bonsai and llama-cpp images took 5h10m and 5h13m on master and timed out on PRs, and nothing showed the drift until a job died. Add a build-timings job to backend.yml and backend_pr.yml. It reads the jobs of the run, writes the 20 slowest image builds to the run summary, and fails when a llama-cpp, ik-llama-cpp, turboquant, bonsai or olala build ran longer than 4h. Assisted-by: Claude:claude-sonnet-5-5 Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
llama-cpp-grpc and llama-cpp-rpc-server now come from the GGML_BACKEND_DL tree and load libggml-rpc.so and the CPU variants from lib/ at run time. No test started either binary, so a packaging gap would only show on a user's worker. The new test-extra-backend-llama-cpp-rpc target starts the worker from the image through run.sh (LLAMACPP_BINARY), runs the e2e backend suite with LLAMACPP_GRPC_SERVERS pointing at it, and checks that the worker accepted the connection. tests-llama-cpp-grpc runs it. Assisted-by: Claude:claude-sonnet-5-5 Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Each llama.cpp-family image (llama-cpp, bonsai, turboquant, olala) built two full trees: the
cpu-alltree (GGML_BACKEND_DL, loader plus GPU backend) and a static tree for*-grpcand*-rpc-server. The static tree compiled the whole CUDA or HIP backend a second time for every arch. In the ROCm llama-cpp job of master run 45793596845, each tree took 2h26m of the 4h52m compile step. The ROCm bonsai and llama-cpp images ran 5h10m and 5h13m on master and hit the 6h limit on PRs.Changes:
CPU_ALL_RPC=ONbuilds the RPC backend andggml-rpc-serverin thecpu-alltree. The*-grpcbinary is that tree'sgrpc-server. The image compile scripts set it. Both binaries find the RPC backend through the backend registry (ggml_backend_reg_by_name("RPC"), andrpc-server.cppcallsggml_backend_load_all()). This holds in upstream and in the three fork pins.build-timingsjob inbackend.ymlandbackend_pr.ymlwrites the slowest image jobs to the run summary. It fails when a llama.cpp-family build ran longer than 4h.What does not change: the file names in each image, the CUDA arch list,
AMDGPU_TARGETSand the CPU variants. The Darwin and Windows builds keep the static grpc target.What changes for users:
*-grpcand*-rpc-servernow link the bundled shared ggml libraries and use the best CPU variant for the host, as*-cpu-allalready does. Before, they were static builds with AVX off.This PR runs the changed builds so the before and after durations can be compared.
🤖 Generated with Claude Code
https://claude.ai/code/session_01DjrQykNTTf8SGGXmfHpyDA