Repository navigation
Fork RPC: refuse stock peers whose op numbers differ - #6
Draft
LeoBorcherding wants to merge 1 commit into
Draft
LeoBorcherding wants to merge 1 commit into
LeoBorcherding wants to merge 1 commit into
Conversation
GGML_OP_FLASH_ATTN_EXT_BANDED sits in the middle of enum ggml_op, so every op after it has a different number than in stock llama.cpp, while both sides still reported RPC 8.0.x and the client only compared major and an older minor. A fork client and a stock server (or the other way round) passed the handshake and then ran the wrong ops. Bump the minor version, which stock clients refuse as newer, and have the client require the server's minor and patch to match its own, so a fork client refuses a stock server as well.
Owner
Author
|
@codex review |
Codex Review SummaryThis 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: Didn't find any major issues. Can't wait for the next one! 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". |
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.
Audit finding
GL-3(P2, confirmed-ran). Fork RPC: a fork build and a stock one passed each other's handshake while numbering their ops differently.Base of this PR. The op renumbering comes from the Inkling pin (
ggml-org/llama.cpp#25731, pinned inscripts/unsloth/pr-set.jsonat534c32182, which is also that PR's current head), not the fork's master tree, and that pin also edits theggml-rpc.hlines this touches. So this PR targetsnight-shift-tester/audit-pin-inkling-534c321(that pin commit) rather thannight-shift-tester/audit-base, which keeps the diff to the fix. Landing it means a separate fix pin (anunslothai/llama.cppPR listed right after the Inkling pin), not a commit on the Inkling PR: the minor bump below is a fork marker, and upstream wouldn't take it. Drop the fix pin together with the Inkling pin once a base tag carries Inkling.What's wrong
The Inkling pin inserts
GGML_OP_FLASH_ATTN_EXT_BANDEDafterGGML_OP_FLASH_ATTN_EXT(ggml/include/ggml.h:576at534c32182), so every op after it moves up by one, and only bumps the patch version (ggml/include/ggml-rpc.h:9-11):The client only rejects a different major or a newer minor, and the server never checks the client at all (
ggml/src/ggml-rpc/ggml-rpc.cpp:427):The server then copies the op number as-is (
ggml-rpc.cpp:1661,result->op = (ggml_op) tensor->op;). So a forkllama-server --rpcwith a stockrpc-server, or the reverse, connects and runs the wrong ops (stockUNARY91 isDSV4_HC_POSTon the fork). Every Unsloth bundle is built withGGML_RPC=ONand Unsloth Studio passes--rpcthrough, and the mix reports the same build number as stock, so nothing tells the user the two sides differ.Fix
RPC_PROTO_MINOR_VERSIONgoes to 1. Stock clients already refuse a server with a newer minor, so they now refuse a fork server.GGML_OP_COUNTchanges (thestatic_assertright below says so), so a matching patch is the only sign the op numbers line up. That makes a fork client refuse a stock server, and the error now prints both versions.I picked this over moving
GGML_OP_FLASH_ATTN_EXT_BANDEDto just beforeGGML_OP_COUNT: the move would also need the positional name and symbol tables inggml.creordered inside upstream's PR, it would still leave a stock server receiving op 101 (itsGGML_OP_COUNT), and every later upstream push to that PR would conflict with it.Tradeoff: fork and stock RPC peers can no longer be mixed at all (they never worked correctly), and two fork builds with different patch versions now refuse each other where they used to connect.
Test
No RPC test builds on Windows (
test-rpc-multi-serveris UNIX-only), and a single binary can't stand in for a stock peer, so the check is two real builds talking to each other: stockggml-rpc-serverandllama-clifromfcac19079(the ggml-org master commit the Inkling pin last merged), and the pin's, withllama-cli --rpc 127.0.0.1:<port> --list-devicesas the client. CPU, Windows 11, MSVC static builds with-DGGML_RPC=ON.Red, at the pin. Both directions connect:
Green, with the fix (server now reports v8.1.1). Both mixed directions refuse at connect, fork to fork still connects:
Testing on Linux, with a real model (Colab)
Colab L4 VM, CPU builds only (
-DGGML_RPC=ON -DGGML_CUDA=OFF), gcc 13.3.0, cmake 3.31.10, Ubuntu 24.04.4, 12 vCPU. Stockfcac19079f(proto 8.0.0,GGML_OP_COUNT101), pin534c321824(8.0.1, 102), fix20fd7f90f9(8.1.1). Every client and server pair withllama-cli --rpc 127.0.0.1:<port> --list-devices, thenllama-completiononSmolLM2-135M-Instruct-Q8_0.ggufwith-ngl 99 --device RPC0, so the whole graph runs on the RPC server.RPC server version mismatch: 8.1.1RPC server version mismatch: 8.1.1RPC server version mismatch: 8.0.0, client is 8.1.18.0.1, client is 8.1.1The mixed pair on a real model, pin client and stock server:
ggml-cpu.c:2502atfcac19079is thecase GGML_OP_COUNT: GGML_ABORT("fatal error")arm: the stock server got op 101, its ownGGML_OP_COUNT, from the pin client. Fix client to fix server finished all 23 decode steps with no error.Not tested
llama-server --rpc(the Linux run usedllama-completion); the handshake is the same code for every client.GGML_ABORTin the existing connect path), as any version mismatch already did; turning that into a clean error is out of scope here.