Repository navigation
Studio: ship ggml-rpc-server with the llama.cpp bundle and locate it - #18276
danielhanchen wants to merge 4 commits into
Conversation
Prebuilt installs keep ggml-rpc-server (and the legacy rpc-server name) from the bundle, set its exec bit, and re-extract a tag-matching install that has the ggml-rpc client library but lost the server. Source builds turn on GGML_RPC and build the rpc-server target, including a reused build that predates it. studio/llama_rpc.py finds the server the same way the installer places it.
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5671d1b7cc
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if ! grep -q '^GGML_RPC:BOOL=ON' "$_dir/build/CMakeCache.txt"; then | ||
| run_quiet_no_exit "enable GGML_RPC (existing install)" cmake -S "$_dir" -B "$_dir/build" -DGGML_RPC=ON -DGGML_RPC_RDMA=OFF || true | ||
| fi | ||
| if run_quiet_no_exit "build $_target (existing install)" cmake --build "$_dir/build" --config Release --target "$_target" -j"$_jobs"; then |
There was a problem hiding this comment.
Handle relocated build caches before backfilling RPC
For an existing source install created by setup.sh, this backfill cannot reuse the configured build directory: the source-build section configures under ${LLAMA_CPP_DIR}.build.$$ and then moves that tree to $LLAMA_CPP_DIR, leaving absolute temporary paths in CMakeCache.txt and the generated build files. Reproducing that configure/move/backfill sequence makes CMake reject this reconfiguration because the source and cache directories have changed, and the subsequent build cannot build the missing target. Consequently, managed source installations predating this change remain without the RPC server on every setup rerun, even when CMake is available. Handle the relocated cache or configure a fresh build directory while preserving the existing backend options.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Confirmed: source builds are staged in llama.cpp.build. and moved, so cmake refuses the moved cache (reproduced with a real cmake in test_cmake_really_refuses_a_moved_build_and_the_check_sees_it). Fixed in e5343ff: setup.sh and setup.ps1 detect a moved build that never enabled RPC and rebuild once through the normal source build, the in-place backfill no longer runs cmake against a moved cache, and the macOS no-RPC fallback marks its build so it is not rebuilt on every run.
…t in place Source builds are configured in llama.cpp.build.<pid> and moved into place, so their CMakeCache still names the staging directory and cmake refuses to reconfigure or build there. A reused build that predates ggml-rpc-server could therefore never gain it. setup.sh and setup.ps1 now notice a moved build directory that never enabled RPC and rebuild once, the backfill no longer runs cmake against a moved cache, and the macOS no-RPC fallback marks its build so it is not rebuilt on every run.
|
@codex review |
|
Codex Review: Didn't find any major issues. What shall we delve into next? Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9f4af2ae3f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| override = (os.environ.get("UNSLOTH_LLAMA_CPP_PATH") or "").strip() | ||
| if override: | ||
| return Path(override).expanduser() | ||
| root = _studio_root() |
There was a problem hiding this comment.
Honor UNSLOTH_HOME when locating the managed RPC server
For installations configured with UNSLOTH_HOME=/custom/root, without an explicit UNSLOTH_LLAMA_CPP_PATH, this resolver searches the wrong bundle directory. setup.sh selects _MASTER_ROOT ahead of the Studio home and installs into $UNSLOTH_HOME/llama.cpp, but this helper ignores that variable and returns either ~/.unsloth/llama.cpp or <studio home>/llama.cpp. Consequently, rpc_server_binary() returns None for an installed executable (or selects an unrelated fallback). Honor the installer's master-root precedence before deriving the bundle from the Studio home.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in c2ec612. llama_bundle_dir() now checks the master root before the Studio home, the same way storage_roots.unsloth_home() does: UNSLOTH_HOME (blank counts as unset), else the root setup recorded in <studio>/share/.unsloth-master-root, but only while that root exists and contains Studio. An explicit UNSLOTH_LLAMA_CPP_PATH still comes first. Tests in tests/studio/test_llama_rpc_binary.py cover UNSLOTH_HOME, the recorded note and a note that does not contain Studio. Two of them fail on the previous head.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9f4af2ae3f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if [ "$BUILD_OK" = true ]; then | ||
| run_quiet_no_exit "build llama-quantize (no rpc)" cmake --build "$_BUILD_TMP/build" --config Release --target llama-quantize -j"$NCPU" || true | ||
| run_quiet_no_exit "build diffusion visual server (no rpc)" cmake --build "$_BUILD_TMP/build" --config Release --target llama-diffusion-gemma-visual-server -j"$NCPU" || true | ||
| fi |
There was a problem hiding this comment.
Rebuild the Metal memory probe after clearing the build tree
On macOS, when the RDMA gate triggers the no-RPC rebuild, deleting build also deletes the llama-fit-params executable built immediately before this helper runs. This replacement build restores the server, quantizer and visual server, but never restores that probe. Consequently, an otherwise successful Metal installation loses its measured-memory fitting behavior: _metal_demand_paged_embedding_bytes() in studio/backend/core/inference/llama_cpp.py keeps input embeddings charged when the probe is absent, reducing the usable model/context budget. Rebuild llama-fit-params in this fallback as well.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in c2ec612. The no-RPC rebuild only runs on macOS, and it wipes the build directory, so it now rebuilds llama-fit-params after llama-quantize, best-effort like the first pass. test_macos_rdma_leak_rebuilds_without_rpc_from_the_active_args now expects that target in the rebuild and fails without the change.
…ams on the macOS no-RPC rebuild
|
@codex review |
|
Codex Review: Didn't find any major issues. Keep them coming! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
First PR of the multi-machine serving stack (#4858). It only makes sure
ggml-rpc-serveris installed besidellama-serverand can be found. This was previously part of #10280, which also carries the DGX Spark toolkit; that toolkit is now optional and stacked on top of this PR.What changes
studio/install_llama_prebuilt.py):ggml-rpc-server(and the olderrpc-servername) from the bundle;ggml-rpcclient library and not the server. This is the same backfill path as the DiffusionGemma visual server:bundle_backfill_reasonnames what is missing.setup.shandsetup.ps1configure with-DGGML_RPC=ON -DGGML_RPC_RDMA=OFF.tools/rpc/CMakeLists.txt(ggml-rpc-server, orrpc-serveron older trees).librdmaeven withGGML_RPC_RDMA=OFF, setup rebuilds without RPC and marks the build, so later runs do not try again. That rebuild still producesllama-server,llama-quantize,llama-fit-paramsand the diffusion visual server.studio/llama_rpc.pyresolves it the way the installer places it:UNSLOTH_LLAMA_CPP_PATH, else the master root (UNSLOTH_HOME, or the root setup recorded in the Studio tree), else the Studio root. Then it tries~/src/llamacpp-rpc, thenPATH;build/bin,build/bin/Release,binand the root in that order;Nothing runs the server yet. The next PR in the stack uses it to split a GGUF across machines.
Tests
tests/studio/install/test_source_build_rpc_server.py: the shell and PowerShell target detection, a reused build that predates the target, and the messages when it cannot be built.test_install_llama_prebuilt_logic.py:llama_rpcfinds it.tests/studio/test_llama_rpc_binary.py: on Windows the.exewins over a stray extensionless file and a non-executable file is rejected; POSIX requires the exec bit; the search order follows the platform.tests/studio/installdirectory: 10517 passed, 118 skipped. 21 failures intest_dependency_pass_skips.pyfail the same way on current main on this host.setup.shuses, the target detected from the llama.cpp tree (ggml-rpc-server) builds and--helpruns.llama_rpc.rpc_server_binary()then returns that binary.