Repository navigation
llama: split the DSpark drafter's head by vocabulary rows under a tensor split - #27
Conversation
A gather (ggml_backend_meta_gather) moves values rather than summing partial results: every device but one adds zeros. The CUDA internal all-reduce rounded every F32 tensor through BF16 (GGML_CUDA_AR_BF16_THRESHOLD defaults to 1), and the direct NCCL all-reduce and the opt-in BF16 NCCL wire did the same from 32768 elements, so a gathered tensor came back rounded: logits, and token ids above 256 (64122 came back as 64000). The RPC comm path already kept gathers in F32. The check moves to ggml-impl.h as ggml_is_meta_gather, and all four reductions keep a gather in its own type. test-meta-gather-exact gathers a product split across two copies of one device and compares it bit for bit with the whole product, logits and token ids above 100000.
…sor split On DeepSeek-V4.1 the DSpark drafter's output head (the target's Q6_K output.weight) and its Markov transition (markov_w2, BF16) are mirrored, so every device of a tensor split computes all 129280 rows. Each device now multiplies a view of its own rows of the copy it already holds (ggml_backend_meta_rows, no second copy of the weights), and the draft chain takes each position's first max from one (value, index) pair per device (ggml_argmax_part, gathered, then ggml_argmax_merge): the lowest index on a tie, and token 0 when the row's first logit is a NaN, as the greedy sampler picks. The rows the host reads are one-hot at the pick. Without a tensor split the graph is unchanged. test-argmax-split checks the split product bit for bit against the whole one and the picks against a CPU reference, with ties across and inside devices.
Rows whose every value appears twice, so each row's max ties and the first index must win, at the drafter's shapes (43094 and 129280 columns); pairs with few distinct values and the -1 sentinel for the merge.
… RPC protocol to 9.0.0 Inserted after TOP_K_MASK, the two ops renumbered UNARY and every op after it. RPC sends ops by number and its handshake compares only the major and minor, so a peer built before them connected to one built after and ran the other's ops as different ones: on loopback an old server crashed (abort) on a new client's first graph, and a new server segfaulted on an old client's. Appended, they leave every older op's number alone, and with the major at 9 the two refuse each other at connect (RPC server version mismatch) before any graph runs.
…no rows A device with no rows of the split computes nothing, so its ggml_argmax_part pair was left unwritten: on the CPU meta backend, with the logits below 0, the merge picked the stale (0, 0) pair (token 0 where the first max was 5946, 12356 or 169). dspark_vocab_parts keeps the head whole when any device's share is empty, ggml_backend_meta_rows returns a view of the whole matrix in that case, and the meta split of ggml_argmax_part asserts that every device has rows. test-argmax-split adds the first and the last device empty under negative logits, Q6_K and BF16, and runs every split twice on the same buffers with other inputs.
The test set GGML_CUDA_ALLREDUCE=none, which hid that the CUDA internal all-reduce rounded the gathered pairs through BF16. With gathers exact there, two copies of a CUDA device now reduce through it and three through the butterfly.
With several sequences each draft position's view of the head steps over the other sequences' rows, a strided view of a row-split tensor that the meta backend cannot split: building the graph aborted (ggml-backend-meta.cpp handle_view). dspark_vocab_parts splits the head for one sequence only. test-argmax-split builds the Markov head's graph for one sequence over a row-split head and for two over the whole head, picks against the first max of the whole computation.
… exact With gathers kept F32 on the BF16 wire, a rank of this build and one from before would both enable the wire (the agreement byte carried the wish, not the exception) and then run a large gather as ncclFloat on one rank and ncclBfloat16 on the other. A rank now asks for the BF16 wire with a new bit (RPC_NCCL_WIRE_BF16_EXACT) and never sends the old one, so an older rank reads no wish and stays on F32, and this rank enables the wire only when both ranks set the new bit. The agreement lives in nccl-wire.h; test-rpc-nccl-wire checks every pair of builds and wishes in both rank orders.
…ab-split # Conflicts: # tests/CMakeLists.txt
There was a problem hiding this comment.
🟡 Changes recommended
Outstanding issues make default CTest runs too memory-intensive for constrained machines and cause allocation to abort for mirrored submatrix row views with nonzero offsets.
2 open issues
What changed in this PR
This PR reduces DSpark drafting work under tensor splitting by distributing vocabulary rows across devices. It builds on #26's exact gathers to combine per-device argmax pairs instead of gathering full logits.
Changes:
- Adds row views and CPU/CUDA argmax operations with deterministic tie handling.
- Integrates split heads into eligible DSpark graphs while preserving whole-head fallbacks.
- Adds regression tests and bumps the RPC protocol major version.
| File | Description |
|---|---|
tests/test-backend-ops.cpp |
Adds backend cases for both argmax operations. |
tests/test-argmax-split.cpp |
Tests split products, picks, ties, and fallback layouts. |
tests/CMakeLists.txt |
Registers the split-argmax test. |
src/models/dflash.cpp |
Splits eligible DSpark heads and constructs pick-only logits. |
src/llama-model.h |
Declares explicit-weight precision lookup. |
src/llama-model.cpp |
Resolves precision settings using the original weight. |
src/llama-graph.h |
Declares optional weight views for matrix multiplication. |
src/llama-graph.cpp |
Preserves weight transforms and precision when using views. |
ggml/src/ggml.c |
Adds argmax constructors, names, and symbols. |
ggml/src/ggml-cuda/ggml-cuda.cu |
Registers CUDA dispatch and support checks. |
ggml/src/ggml-cuda/argmax.cuh |
Declares the new CUDA entry points. |
ggml/src/ggml-cuda/argmax.cu |
Implements CUDA partial and merged argmax. |
ggml/src/ggml-cpu/ops.h |
Declares CPU argmax entry points. |
ggml/src/ggml-cpu/ops.cpp |
Implements CPU partial and merged argmax. |
ggml/src/ggml-cpu/ggml-cpu.c |
Adds CPU dispatch and task allocation. |
ggml/src/ggml-backend-meta.cpp |
Implements row views and per-device argmax offsets. |
ggml/include/ggml.h |
Exposes the new operations and APIs. |
ggml/include/ggml-rpc.h |
Bumps the protocol major version to reject incompatible peers. |
ggml/include/ggml-backend.h |
Exposes the mirrored-matrix row-view API. |
Review effort: Balanced
… the wire by wish bit The agreement bit said what the server could do, but a gather is reduced by the backend, which the server loads separately (GGML_BACKEND_DL). A new server with an old CUDA backend sent the exact bit and rounded gathers anyway. - A server now sends RPC_NCCL_WIRE_BF16_EXACT only when its backend exports ggml_backend_cuda_nccl_comm_set_wire_bf16_exact, and RPC_NCCL_WIRE_BF16 for a wish otherwise, as servers did before. - The wire is BF16 only when both ranks send the same wish bit: gathers stay F32 when both sent the exact bit, and are rounded on both ranks when both sent the old one (a pair with an older server or backend keeps the wire it had). - The CUDA backend keeps gathers F32 on the BF16 wire only after set_wire_bf16_exact; set_wire_bf16 rounds them, as an older backend does. - The server's word, agreement and setter call live in nccl-wire.h, and test-rpc-nccl-wire runs them for every ordered pair of ranks: old or new server, old or new backend, with or without GGML_NCCL_WIRE_BF16.
It ran on the CPU unless TEST_DEVICE named a device, so a CI or local run on a GPU machine never reached a GPU's all-reduce. Now it runs on every CPU and GPU device, or on TEST_DEVICE alone when that is set.
The comments said a gather was exact, but each device adds its slice to the others' zero padding, and -0.0 plus a zero is +0.0. Argmax picks are unaffected: a first max compares -0.0 and +0.0 as equal, so a tie still resolves by index. test-meta-gather-exact now gathers a split tensor of signed zeros among other values and compares it by value, and prints how many -0.0 came back +0.0.
…split path test_pairs checked a NaN as the row's first value on one backend, where every pair's origin is 0. On a meta device the check that makes a first NaN token 0 must apply only to the device whose rows start at 0: test_meta_nan puts a NaN at each later device's first row, with the max in the last row, in the first device's rows, or nowhere (every other row -inf), over two and three devices.
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved ROWS-view and ARGMAX_MERGE split-handling bugs trigger assertion failures, while NaN comparisons mask incorrect multi-part results and the default regression test requires several GiB of memory.
5 open issues
Review effort: Balanced
On the macOS CI runner the Metal device has no simdgroup reductions, so it cannot run the F32 product, and the meta backend, which does not fall back to another device, aborted on it. A device is now skipped, with the op it lacks, when it does not support the product, the gather or the add the meta backend reduces with. TEST_DEVICE still fails when the device it names is skipped.
…nd model pre-wish ranks test-meta-gather-exact: - Each gathered product is compared bit for bit with the split product read back slice by slice, as each device computed it, instead of with a whole product a backend may sum in another order. - The directly populated tensor of signed zeros grows to 65536 elements, above the direct NCCL all-reduce's 32768, with values BF16 cannot represent. - The registered test pins GGML_CUDA_AR_BF16_THRESHOLD=1 and unsets GGML_CUDA_ALLREDUCE (the platform default), and two more runs pin GGML_CUDA_ALLREDUCE=internal and =nccl. The NCCL run needs a build with NCCL and a second GPU, since NCCL takes one rank per GPU, and skips a CUDA device otherwise. test-rpc-nccl-wire: - Servers and backends from before the wire was negotiated join the model: 324 ordered pairs. - When the build has a CUDA backend with NCCL, it must export both wire setters, which a new server reads as the capability. The setters' own effect needs an NCCL communicator and stays unverified here.
There was a problem hiding this comment.
🔵 Needs a closer look
Shared tensor-view changes, CUDA kernels, and RPC negotiation require maintainer validation because CUDA runtime evidence and automated coverage of model-backed DSpark eligibility guards are missing.
No open issues 🎉
1 resolved since last review
Review effort: Balanced
|
Addressed #27 (review) on 0655376 (no code change). That review has no open issues, and the view-offset thread it lists as resolved is fixed in 0655376. Its headline asks for maintainer validation of the shared view change, the CUDA kernels and the RPC negotiation, because CUDA runtime evidence and model-backed coverage of the DSpark eligibility guards are missing. Each part is either covered here or a recorded known limitation:
This is the third automated round on this PR, and its remaining asks are for a maintainer with CUDA hardware, so I am not requesting another. CI on 0655376. CI has finished, and the description's
|
…9-dspark-vocab-split # Conflicts: # tests/CMakeLists.txt
|
Merged
|
…does not fit An RPC server deserializes a client's nodes without ggml_argmax_part's and ggml_argmax_merge's checks, and the kernels checked only their source: ARGMAX_PART wrote a pair into a destination of one value, or into rows the destination does not have, and ARGMAX_MERGE wrote one pick per source row into a shorter destination. The CPU kernels and the CUDA launchers now assert what the constructors build before writing anything: a matrix source; for ARGMAX_PART, an F32 contiguous matrix destination of an even width of at least two with one row per source row; for ARGMAX_MERGE, an even pairs width and a contiguous I32 vector of one pick per source row. GGML_ASSERT, as the neighbouring kernels (count_equal, the CUDA argmax) check their shapes, since a CPU op has no error to return and an RPC server asserts on a failed graph anyway. test-argmax-malformed builds such nodes by hand and computes each in a child process on the CPU backend, with the destination followed by canaries in memory shared with the parent: each malformed node must abort with every canary intact, and two well-formed nodes must compute their picks.
|
Fixed in 54962fe: #27 (review). That review's headline was that missing CPU and CUDA kernel validation lets RPC-deserialized ARGMAX_PART and ARGMAX_MERGE nodes write past their destinations. Both of its threads are fixed, with before and after in the replies, and resolved: Before (d7a6443). The new After (54962fe). All 8 abort at a
Mac checks: CUDA is unverified at runtime and not compiled locally: there is no CUDA toolchain on this Mac. CI's |
There was a problem hiding this comment.
🔵 Needs a closer look
Human assessment is needed because an unpublished critical finding identifies incorrect byte offsets when flattening quantized views, potentially causing out-of-bounds reads.
No open issues 🎉
2 resolved since last review
Review effort: Balanced
…lds reset (#33) A meta buffer keeps the device tensors of the views made of its tensors in two compute containers that rotate as graphs are rebuilt: a graph's views go into the current one, and each rebuild resets the other one. A meta backend reuses the split it built for a graph it computes again (same uid), and that split points at its views' device tensors in the container of its time. Another backend whose graphs view the same buffer rotates that buffer's containers with each of its own rebuilds, and its second rebuild resets the container the reused split points into and gives the memory to its own views. Since #27, DeepSeek-V4.1's DSpark drafter multiplies a rows view of the target's output head, so the drafter's graphs view the target's weight buffer. With one graph slot (LLAMA_GRAPH_SLOTS=0) the target's reused split computed a node with the drafter's rows view as its source: every RPC server aborted at ggml-cuda/binbcast.cu:417 on a MUL of a view of hc_mixes-0 with output.weight (rows), a Q6_K view. Two graph slots build splits from clones, which point into no container. Each container now counts its resets. A split records, for each buffer holding one of its nodes or of their sources outside the buffer's static container, the container it points into and that count, and a split reused without a rebuild is rebuilt when a count has moved. The rebuild makes the views again, as it already does for a reused graph's split. A split built from clones skips the check. Sources count because a scheduler computes a graph in splits whose graphs have no leafs, so a view a node reads can be made in an earlier split. test-meta-shared-views: one meta backend computes out = x * view(s, 0..n), a second allocates and computes fresh graphs that view s[n..2n), and the first computes its graph again without allocating it, whole and as a split holding the product alone. Before this change the reused graph computed x * s[n..2n) in both cases.
…16049) spiceai/llama.cpp#33 rebuilds a meta split a backend would reuse when another backend's rebuilds have reset the containers holding its views. Since spiceai/llama.cpp#27 the DSpark drafter's graphs view the target's weights, and with one graph slot (LLAMA_GRAPH_SLOTS=0) DeepSeek-V4.1 split by tensor aborted on its first or second request at ggml-cuda/binbcast.cu:417. Spice's default of two graph slots builds splits from clones and did not reach it. The ledger records the pin and a row for #33, a GAP covered by the fork's test-meta-shared-views, and the GAP count moves from 58 to 59.
…es (#16079) * deps(llama-cpp): pin llama.cpp to spiceai-b11999 at the squash of spiceai/llama.cpp#23 Moves `llama-cpp-src` from 2bedd1f7 (tag b11999-spiceai.1) to 3a536dbf, the tip of spiceai-b11999, three commits further on: - spiceai/llama.cpp#21 deletes a POOL_1D split-state handler left unused by the b11984 merge. - spiceai/llama.cpp#20 splits Mistral Large 4 and its DSpark drafter across devices. - spiceai/llama.cpp#23 reads a DSpark draft token as the row's largest logit when the drafter's CPU chain is top-k alone. `docs/dev/fork_patches.md` records the new pin and the three patches; #20 and #23 are GAP rows, #21 needs no guard. * deps(llama-cpp): move the llama.cpp pin to the squash of spiceai/llama.cpp#25 spiceai/llama.cpp#25 adds `llama_get_unsampled_logits_ith`, which reads an output's full logits row after one synchronize, or returns NULL when a backend sampler sampled the row. The DSpark drafter's pick now uses it. `docs/dev/fork_patches.md` records the new pin and adds the patch's row. * perf(llama-cpp): read a row's logits with one synchronize through llama_get_unsampled_logits_ith * docs(fork-patches): measure Mistral Large 4's layer-split cost in the tensor-split row The row said a layer split runs several times slower. Stock llama-server at f68fea35 with the DSpark drafter across three DGX Sparks measured 7.68 tok/s split by layer against 13.19 split by tensor. * deps(llama-cpp): pin llama.cpp to spiceai-b11999's tip, and keep the MTP head's state with the prompt cache (#16023) * fix(llms): the MTP head's state follows the prompt cache The MTP head pairs a prompt read's first token with the target's hidden state at the position before it, and kept the last request's: a request after another one, or a turn that reuses the previous turn's prompt, drafted differently from the same request on a fresh context (fewer tokens accepted, and with batched verification, different tokens). With the fork's state API (llama.cpp's common_speculative get/set state for its MTP head), the prompt cache saves the head's state with each checkpoint and restores it with it. A cache that can be cut anywhere stashes the head's state where a checkpoint would be, and reuses the cache up to there or up to all of it, where the head's live state is; the debug line says how many shared tokens it read again. Two integration tests on Qwen3.5-0.8B compare the drafts with a fresh context's: a request after another, and a turn after the previous turn. * test(llms): check the second request's drafts over eight requests, so the guard fails on Metal too * style(llms): rustfmt the MTP head state change * deps(llama-cpp): pin llama.cpp to spiceai-b11999 at the squash of spiceai/llama.cpp#31 The pin moves from the squash of spiceai/llama.cpp#25 to the branch's tip, which adds #22 (carrying #18 and #19 over from spiceai-b11803), #24, #26, #27, #29, #30 and #31. The ledger gets a row for each, #19's defaults go into the levers row, and the MTP head-state guards from the previous commits guard #31. * style(llama-cpp): rustfmt the MTP state bindings * fix(llms): keep the prompt cache's shared prefix for a DFlash or DSpark drafter The head-state change treated every draft model behind the speculative shim as a head that carries its state from one read to the next. A DFlash or DSpark drafter keeps none, so on a cache that can be cut anywhere nothing was ever stashed, and every request whose prompt shared only part of the cache read it all again from position 0. On Mistral Large 4 with its DSpark drafter split across three nodes, each request reused 0 of its 35 prompt tokens instead of 34, which changed its prefill batches and its replies. Only an MTP head now counts as one. * deps(llama-cpp): pin llama.cpp to the squash of spiceai/llama.cpp#33 (#16049) spiceai/llama.cpp#33 rebuilds a meta split a backend would reuse when another backend's rebuilds have reset the containers holding its views. Since spiceai/llama.cpp#27 the DSpark drafter's graphs view the target's weights, and with one graph slot (LLAMA_GRAPH_SLOTS=0) DeepSeek-V4.1 split by tensor aborted on its first or second request at ggml-cuda/binbcast.cu:417. Spice's default of two graph slots builds splits from clones and did not reach it. The ledger records the pin and a row for #33, a GAP covered by the fork's test-meta-shared-views, and the GAP count moves from 58 to 59. * test(llms-llamacpp): require at least one non-empty MTP draft in regression helpers Copilot: generate/generate_after_read could pass with every draft empty. Assert each helper produced at least one non-empty draft before returning. * test(llms-llamacpp): compare whole replies when every MTP draft matches The prompt-cache guards compared the two runs' replies only up to the shorter one. A reply grows by the step's token and the drafts the target accepted, and the final step's next token is never appended, so two runs whose final steps accepted different numbers of drafts give one reply that is a prefix of the other, and the prefix comparison passed. With the same drafts at every step the runs take the same steps, so both guards now require the whole replies to be equal once every draft matches. Watched failing: with the final step's reply one token short in one run, both guards passed before this change, and fail with it ("whose drafts match at every step").
…ceai/llama.cpp#33, and keep the MTP head's state with the prompt cache (spiceai#15922) * deps(llama-cpp): pin llama.cpp to spiceai-b11999 at the squash of spiceai/llama.cpp#23 Moves `llama-cpp-src` from 2bedd1f7 (tag b11999-spiceai.1) to 3a536dbf, the tip of spiceai-b11999, three commits further on: - spiceai/llama.cpp#21 deletes a POOL_1D split-state handler left unused by the b11984 merge. - spiceai/llama.cpp#20 splits Mistral Large 4 and its DSpark drafter across devices. - spiceai/llama.cpp#23 reads a DSpark draft token as the row's largest logit when the drafter's CPU chain is top-k alone. `docs/dev/fork_patches.md` records the new pin and the three patches; spiceai#20 and spiceai#23 are GAP rows, spiceai#21 needs no guard. * deps(llama-cpp): move the llama.cpp pin to the squash of spiceai/llama.cpp#25 spiceai/llama.cpp#25 adds `llama_get_unsampled_logits_ith`, which reads an output's full logits row after one synchronize, or returns NULL when a backend sampler sampled the row. The DSpark drafter's pick now uses it. `docs/dev/fork_patches.md` records the new pin and adds the patch's row. * perf(llama-cpp): read a row's logits with one synchronize through llama_get_unsampled_logits_ith * docs(fork-patches): measure Mistral Large 4's layer-split cost in the tensor-split row The row said a layer split runs several times slower. Stock llama-server at f68fea35 with the DSpark drafter across three DGX Sparks measured 7.68 tok/s split by layer against 13.19 split by tensor. * deps(llama-cpp): pin llama.cpp to spiceai-b11999's tip, and keep the MTP head's state with the prompt cache (spiceai#16023) * fix(llms): the MTP head's state follows the prompt cache The MTP head pairs a prompt read's first token with the target's hidden state at the position before it, and kept the last request's: a request after another one, or a turn that reuses the previous turn's prompt, drafted differently from the same request on a fresh context (fewer tokens accepted, and with batched verification, different tokens). With the fork's state API (llama.cpp's common_speculative get/set state for its MTP head), the prompt cache saves the head's state with each checkpoint and restores it with it. A cache that can be cut anywhere stashes the head's state where a checkpoint would be, and reuses the cache up to there or up to all of it, where the head's live state is; the debug line says how many shared tokens it read again. Two integration tests on Qwen3.5-0.8B compare the drafts with a fresh context's: a request after another, and a turn after the previous turn. * test(llms): check the second request's drafts over eight requests, so the guard fails on Metal too * style(llms): rustfmt the MTP head state change * deps(llama-cpp): pin llama.cpp to spiceai-b11999 at the squash of spiceai/llama.cpp#31 The pin moves from the squash of spiceai/llama.cpp#25 to the branch's tip, which adds spiceai#22 (carrying spiceai#18 and spiceai#19 over from spiceai-b11803), spiceai#24, spiceai#26, spiceai#27, spiceai#29, spiceai#30 and spiceai#31. The ledger gets a row for each, spiceai#19's defaults go into the levers row, and the MTP head-state guards from the previous commits guard spiceai#31. * style(llama-cpp): rustfmt the MTP state bindings * fix(llms): keep the prompt cache's shared prefix for a DFlash or DSpark drafter The head-state change treated every draft model behind the speculative shim as a head that carries its state from one read to the next. A DFlash or DSpark drafter keeps none, so on a cache that can be cut anywhere nothing was ever stashed, and every request whose prompt shared only part of the cache read it all again from position 0. On Mistral Large 4 with its DSpark drafter split across three nodes, each request reused 0 of its 35 prompt tokens instead of 34, which changed its prefill batches and its replies. Only an MTP head now counts as one. * deps(llama-cpp): pin llama.cpp to the squash of spiceai/llama.cpp#33 (spiceai#16049) spiceai/llama.cpp#33 rebuilds a meta split a backend would reuse when another backend's rebuilds have reset the containers holding its views. Since spiceai/llama.cpp#27 the DSpark drafter's graphs view the target's weights, and with one graph slot (LLAMA_GRAPH_SLOTS=0) DeepSeek-V4.1 split by tensor aborted on its first or second request at ggml-cuda/binbcast.cu:417. Spice's default of two graph slots builds splits from clones and did not reach it. The ledger records the pin and a row for spiceai#33, a GAP covered by the fork's test-meta-shared-views, and the GAP count moves from 58 to 59. * test(llms-llamacpp): require at least one non-empty MTP draft in regression helpers Copilot: generate/generate_after_read could pass with every draft empty. Assert each helper produced at least one non-empty draft before returning.
…n sequence (spiceai#16106) * feat(llama-cpp): decode and draft for several sequences in one context A context can hold several sequences on one shared cache (`with_n_seq_max`, `with_kv_unified`), and a batch can carry tokens of any of them (`Batch::add_seq`). Truncation and the partial state a prompt checkpoint saves now take a sequence (`truncate_seq`, `partial_state_seq`, `restore_partial_state_seq`), and refuse one the context does not hold instead of reaching the llama.cpp assertion that ends the process. The MTP shim drafts for every sequence of the target through the pinned fork's per-sequence speculative API: `begin`, `accept` and the head's saved state take a sequence, and one `draft_many` call drafts for several sequences in one pass of the head. It refuses an unknown sequence, two requests for one sequence, and a batch whose sequences are interleaved. The engine still decodes one request at a time in sequence 0; serving several requests together is spiceai#15598. * test(llms-llamacpp): a sequence's prompt checkpoint restores into that sequence beside another Sequence 1 saves its recurrent and draft-head state at a split, reuses the prefix for the next turn, and drafts and replies exactly as the turn read whole into sequence 1 of a fresh context, while sequence 0 holds another prompt in both. * feat(llms-llamacpp): decode several requests together, each in its own sequence (spiceai#16107) * feat(llms-llamacpp): decode several requests together, each in its own sequence The engine can serve up to `concurrent_requests` requests at once in one context: each step decodes one batch holding every running request's next token, and with a draft head its draft from one pass of the head, so the weights are read once for all of them. A request that arrives while others run reads its prompt into the free sequence whose cache shares the most of it, and decodes from the next step. It is admitted with room for its prompt and its whole possible reply, so a running request never runs out of cache; one that does not fit waits, and idle sequences' caches are emptied, longest unused first, to make room. A request whose client reads slowly waits rather than holding the step, and one whose client leaves frees its sequence. Each sequence keeps its own prompt cache, with checkpoints and the draft head's state saved and restored per sequence. `concurrent_requests` is an internal option that only tests set: the engine still serves one request at a time until continuous batching is enabled (spiceai#15598). * fix(llms-llamacpp): idle caches give up their room even when no request runs A request admitted while every sequence was idle skipped making room, so the other sequences' idle caches kept their cells and a prompt that needed them failed with "the context has no room left for the batch". Admission now always empties the idle caches it does not reuse, longest unused first, until the request fits; with nothing running the request is served as it would be alone. `idle_caches_give_up_their_room_to_a_request_that_needs_it` failed with that error before and passes now. The decode thread also takes at most one queued request per sequence between steps, so requests arriving faster than they are taken cannot hold off the running ones' steps, and the internal ceiling is capped at 8 requests, which keeps a step's batch within the context's batch size. * test(llms-llamacpp): show requests decode together, not one after another, in the overlap and leaving-client tests The overlap test's first client now stops reading after its first chunk, and its reply holds more tokens than a client buffers. One request at a time would wait on that client and never reach the second request, which is as long, so a step that waited on a paused client would stall it too. The leaving-client test drops its client only once the other request has streamed more chunks than a client buffers, so the leaving request is paused on its full buffer and the closed-client cleanup runs while the other reply still decodes. STREAM_BUFFER is public so the tests can size those replies against it. * test(llms-llamacpp): compare whole replies when every MTP draft matches (spiceai#16079) * deps(llama-cpp): pin llama.cpp to spiceai-b11999 at the squash of spiceai/llama.cpp#23 Moves `llama-cpp-src` from 2bedd1f7 (tag b11999-spiceai.1) to 3a536dbf, the tip of spiceai-b11999, three commits further on: - spiceai/llama.cpp#21 deletes a POOL_1D split-state handler left unused by the b11984 merge. - spiceai/llama.cpp#20 splits Mistral Large 4 and its DSpark drafter across devices. - spiceai/llama.cpp#23 reads a DSpark draft token as the row's largest logit when the drafter's CPU chain is top-k alone. `docs/dev/fork_patches.md` records the new pin and the three patches; spiceai#20 and spiceai#23 are GAP rows, spiceai#21 needs no guard. * deps(llama-cpp): move the llama.cpp pin to the squash of spiceai/llama.cpp#25 spiceai/llama.cpp#25 adds `llama_get_unsampled_logits_ith`, which reads an output's full logits row after one synchronize, or returns NULL when a backend sampler sampled the row. The DSpark drafter's pick now uses it. `docs/dev/fork_patches.md` records the new pin and adds the patch's row. * perf(llama-cpp): read a row's logits with one synchronize through llama_get_unsampled_logits_ith * docs(fork-patches): measure Mistral Large 4's layer-split cost in the tensor-split row The row said a layer split runs several times slower. Stock llama-server at f68fea35 with the DSpark drafter across three DGX Sparks measured 7.68 tok/s split by layer against 13.19 split by tensor. * deps(llama-cpp): pin llama.cpp to spiceai-b11999's tip, and keep the MTP head's state with the prompt cache (spiceai#16023) * fix(llms): the MTP head's state follows the prompt cache The MTP head pairs a prompt read's first token with the target's hidden state at the position before it, and kept the last request's: a request after another one, or a turn that reuses the previous turn's prompt, drafted differently from the same request on a fresh context (fewer tokens accepted, and with batched verification, different tokens). With the fork's state API (llama.cpp's common_speculative get/set state for its MTP head), the prompt cache saves the head's state with each checkpoint and restores it with it. A cache that can be cut anywhere stashes the head's state where a checkpoint would be, and reuses the cache up to there or up to all of it, where the head's live state is; the debug line says how many shared tokens it read again. Two integration tests on Qwen3.5-0.8B compare the drafts with a fresh context's: a request after another, and a turn after the previous turn. * test(llms): check the second request's drafts over eight requests, so the guard fails on Metal too * style(llms): rustfmt the MTP head state change * deps(llama-cpp): pin llama.cpp to spiceai-b11999 at the squash of spiceai/llama.cpp#31 The pin moves from the squash of spiceai/llama.cpp#25 to the branch's tip, which adds spiceai#22 (carrying spiceai#18 and spiceai#19 over from spiceai-b11803), spiceai#24, spiceai#26, spiceai#27, spiceai#29, spiceai#30 and spiceai#31. The ledger gets a row for each, spiceai#19's defaults go into the levers row, and the MTP head-state guards from the previous commits guard spiceai#31. * style(llama-cpp): rustfmt the MTP state bindings * fix(llms): keep the prompt cache's shared prefix for a DFlash or DSpark drafter The head-state change treated every draft model behind the speculative shim as a head that carries its state from one read to the next. A DFlash or DSpark drafter keeps none, so on a cache that can be cut anywhere nothing was ever stashed, and every request whose prompt shared only part of the cache read it all again from position 0. On Mistral Large 4 with its DSpark drafter split across three nodes, each request reused 0 of its 35 prompt tokens instead of 34, which changed its prefill batches and its replies. Only an MTP head now counts as one. * deps(llama-cpp): pin llama.cpp to the squash of spiceai/llama.cpp#33 (spiceai#16049) spiceai/llama.cpp#33 rebuilds a meta split a backend would reuse when another backend's rebuilds have reset the containers holding its views. Since spiceai/llama.cpp#27 the DSpark drafter's graphs view the target's weights, and with one graph slot (LLAMA_GRAPH_SLOTS=0) DeepSeek-V4.1 split by tensor aborted on its first or second request at ggml-cuda/binbcast.cu:417. Spice's default of two graph slots builds splits from clones and did not reach it. The ledger records the pin and a row for spiceai#33, a GAP covered by the fork's test-meta-shared-views, and the GAP count moves from 58 to 59. * test(llms-llamacpp): require at least one non-empty MTP draft in regression helpers Copilot: generate/generate_after_read could pass with every draft empty. Assert each helper produced at least one non-empty draft before returning. * test(llms-llamacpp): compare whole replies when every MTP draft matches The prompt-cache guards compared the two runs' replies only up to the shorter one. A reply grows by the step's token and the drafts the target accepted, and the final step's next token is never appended, so two runs whose final steps accepted different numbers of drafts give one reply that is a prefix of the other, and the prefix comparison passed. With the same drafts at every step the runs take the same steps, so both guards now require the whole replies to be equal once every draft matches. Watched failing: with the final step's reply one token short in one run, both guards passed before this change, and fail with it ("whose drafts match at every step").
… on a split model (spiceai#16172) * feat(llama-cpp): decode and draft for several sequences in one context A context can hold several sequences on one shared cache (`with_n_seq_max`, `with_kv_unified`), and a batch can carry tokens of any of them (`Batch::add_seq`). Truncation and the partial state a prompt checkpoint saves now take a sequence (`truncate_seq`, `partial_state_seq`, `restore_partial_state_seq`), and refuse one the context does not hold instead of reaching the llama.cpp assertion that ends the process. The MTP shim drafts for every sequence of the target through the pinned fork's per-sequence speculative API: `begin`, `accept` and the head's saved state take a sequence, and one `draft_many` call drafts for several sequences in one pass of the head. It refuses an unknown sequence, two requests for one sequence, and a batch whose sequences are interleaved. The engine still decodes one request at a time in sequence 0; serving several requests together is spiceai#15598. * test(llms-llamacpp): a sequence's prompt checkpoint restores into that sequence beside another Sequence 1 saves its recurrent and draft-head state at a split, reuses the prefix for the next turn, and drafts and replies exactly as the turn read whole into sequence 1 of a fresh context, while sequence 0 holds another prompt in both. * feat(llms-llamacpp): decode several requests together, each in its own sequence (spiceai#16107) * feat(llms-llamacpp): decode several requests together, each in its own sequence The engine can serve up to `concurrent_requests` requests at once in one context: each step decodes one batch holding every running request's next token, and with a draft head its draft from one pass of the head, so the weights are read once for all of them. A request that arrives while others run reads its prompt into the free sequence whose cache shares the most of it, and decodes from the next step. It is admitted with room for its prompt and its whole possible reply, so a running request never runs out of cache; one that does not fit waits, and idle sequences' caches are emptied, longest unused first, to make room. A request whose client reads slowly waits rather than holding the step, and one whose client leaves frees its sequence. Each sequence keeps its own prompt cache, with checkpoints and the draft head's state saved and restored per sequence. `concurrent_requests` is an internal option that only tests set: the engine still serves one request at a time until continuous batching is enabled (spiceai#15598). * fix(llms-llamacpp): idle caches give up their room even when no request runs A request admitted while every sequence was idle skipped making room, so the other sequences' idle caches kept their cells and a prompt that needed them failed with "the context has no room left for the batch". Admission now always empties the idle caches it does not reuse, longest unused first, until the request fits; with nothing running the request is served as it would be alone. `idle_caches_give_up_their_room_to_a_request_that_needs_it` failed with that error before and passes now. The decode thread also takes at most one queued request per sequence between steps, so requests arriving faster than they are taken cannot hold off the running ones' steps, and the internal ceiling is capped at 8 requests, which keeps a step's batch within the context's batch size. * test(llms-llamacpp): show requests decode together, not one after another, in the overlap and leaving-client tests The overlap test's first client now stops reading after its first chunk, and its reply holds more tokens than a client buffers. One request at a time would wait on that client and never reach the second request, which is as long, so a step that waited on a paused client would stall it too. The leaving-client test drops its client only once the other request has streamed more chunks than a client buffers, so the leaving request is paused on its full buffer and the closed-client cleanup runs while the other reply still decodes. STREAM_BUFFER is public so the tests can size those replies against it. * test(llms-llamacpp): compare whole replies when every MTP draft matches (spiceai#16079) * deps(llama-cpp): pin llama.cpp to spiceai-b11999 at the squash of spiceai/llama.cpp#23 Moves `llama-cpp-src` from 2bedd1f7 (tag b11999-spiceai.1) to 3a536dbf, the tip of spiceai-b11999, three commits further on: - spiceai/llama.cpp#21 deletes a POOL_1D split-state handler left unused by the b11984 merge. - spiceai/llama.cpp#20 splits Mistral Large 4 and its DSpark drafter across devices. - spiceai/llama.cpp#23 reads a DSpark draft token as the row's largest logit when the drafter's CPU chain is top-k alone. `docs/dev/fork_patches.md` records the new pin and the three patches; spiceai#20 and spiceai#23 are GAP rows, spiceai#21 needs no guard. * deps(llama-cpp): move the llama.cpp pin to the squash of spiceai/llama.cpp#25 spiceai/llama.cpp#25 adds `llama_get_unsampled_logits_ith`, which reads an output's full logits row after one synchronize, or returns NULL when a backend sampler sampled the row. The DSpark drafter's pick now uses it. `docs/dev/fork_patches.md` records the new pin and adds the patch's row. * perf(llama-cpp): read a row's logits with one synchronize through llama_get_unsampled_logits_ith * docs(fork-patches): measure Mistral Large 4's layer-split cost in the tensor-split row The row said a layer split runs several times slower. Stock llama-server at f68fea35 with the DSpark drafter across three DGX Sparks measured 7.68 tok/s split by layer against 13.19 split by tensor. * deps(llama-cpp): pin llama.cpp to spiceai-b11999's tip, and keep the MTP head's state with the prompt cache (spiceai#16023) * fix(llms): the MTP head's state follows the prompt cache The MTP head pairs a prompt read's first token with the target's hidden state at the position before it, and kept the last request's: a request after another one, or a turn that reuses the previous turn's prompt, drafted differently from the same request on a fresh context (fewer tokens accepted, and with batched verification, different tokens). With the fork's state API (llama.cpp's common_speculative get/set state for its MTP head), the prompt cache saves the head's state with each checkpoint and restores it with it. A cache that can be cut anywhere stashes the head's state where a checkpoint would be, and reuses the cache up to there or up to all of it, where the head's live state is; the debug line says how many shared tokens it read again. Two integration tests on Qwen3.5-0.8B compare the drafts with a fresh context's: a request after another, and a turn after the previous turn. * test(llms): check the second request's drafts over eight requests, so the guard fails on Metal too * style(llms): rustfmt the MTP head state change * deps(llama-cpp): pin llama.cpp to spiceai-b11999 at the squash of spiceai/llama.cpp#31 The pin moves from the squash of spiceai/llama.cpp#25 to the branch's tip, which adds spiceai#22 (carrying spiceai#18 and spiceai#19 over from spiceai-b11803), spiceai#24, spiceai#26, spiceai#27, spiceai#29, spiceai#30 and spiceai#31. The ledger gets a row for each, spiceai#19's defaults go into the levers row, and the MTP head-state guards from the previous commits guard spiceai#31. * style(llama-cpp): rustfmt the MTP state bindings * fix(llms): keep the prompt cache's shared prefix for a DFlash or DSpark drafter The head-state change treated every draft model behind the speculative shim as a head that carries its state from one read to the next. A DFlash or DSpark drafter keeps none, so on a cache that can be cut anywhere nothing was ever stashed, and every request whose prompt shared only part of the cache read it all again from position 0. On Mistral Large 4 with its DSpark drafter split across three nodes, each request reused 0 of its 35 prompt tokens instead of 34, which changed its prefill batches and its replies. Only an MTP head now counts as one. * deps(llama-cpp): pin llama.cpp to the squash of spiceai/llama.cpp#33 (spiceai#16049) spiceai/llama.cpp#33 rebuilds a meta split a backend would reuse when another backend's rebuilds have reset the containers holding its views. Since spiceai/llama.cpp#27 the DSpark drafter's graphs view the target's weights, and with one graph slot (LLAMA_GRAPH_SLOTS=0) DeepSeek-V4.1 split by tensor aborted on its first or second request at ggml-cuda/binbcast.cu:417. Spice's default of two graph slots builds splits from clones and did not reach it. The ledger records the pin and a row for spiceai#33, a GAP covered by the fork's test-meta-shared-views, and the GAP count moves from 58 to 59. * test(llms-llamacpp): require at least one non-empty MTP draft in regression helpers Copilot: generate/generate_after_read could pass with every draft empty. Assert each helper produced at least one non-empty draft before returning. * test(llms-llamacpp): compare whole replies when every MTP draft matches The prompt-cache guards compared the two runs' replies only up to the shorter one. A reply grows by the step's token and the drafts the target accepted, and the final step's next token is never appended, so two runs whose final steps accepted different numbers of drafts give one reply that is a prefix of the other, and the prefix comparison passed. With the same drafts at every step the runs take the same steps, so both guards now require the whole replies to be equal once every draft matches. Watched failing: with the final step's reply one token short in one run, both guards passed before this change, and fail with it ("whose drafts match at every step"). * perf(llama-cpp): take a greedy request's picks from the argmax output on a split model On a model split across nodes, a request that picks greedily alone (no penalties, no end-of-generation ban, no grammar) now decodes with the fork's argmax output on. A model whose output head the split divides by rows, DeepSeek-V4.1 today, then computes each row's pick on the devices that hold the head and sends back the picks instead of gathering every row's logits; any other model computes its logits as before and llama.cpp takes their first maximum. The single path sets the mode per request before its prompt is read; the batching path keeps it on while every running request picks greedily alone. Changing the mode rebuilds the graph, so the context calls llama.cpp only when it changes. * test(llms-llamacpp): decode several requests together on a split model, against one node's replies A model split across two ranks loads to decode two requests at once and runs two cases: - Two greedy requests together, which take their picks from the argmax output. - A penalized request that joins a greedy one after its first chunk and leaves before it, turning the argmax output off while it runs and on again after. Each reply must equal one node's reply to the same request alone. The batching tests' helpers are shared with the distributed tests for this, and two calls in batching.rs are formatted as rustfmt writes them.


Targets
spiceai-b11999. #26 (exact gathers in the CUDA all-reduces), on which this was stacked, has merged there, and its base is merged into this branch.What
On DeepSeek-V4.1 under a tensor split, the DSpark drafter's output head (the target's Q6_K
output.weight, 5120 x 129280) and its Markov transition (markov_w2, BF16 256 x 129280) are mirrored. Every device computed all 129280 rows of both.Now each device multiplies only its share of the rows, a view into the copy it already holds (
ggml_backend_meta_rows), so no weights are duplicated. The draft chain then takes each position's argmax from one (value, index) pair per device:GGML_OP_ARGMAX_PARTgives each device's first max and its index, offset to the start of the row.ggml_backend_meta_gather.GGML_OP_ARGMAX_MERGEtakes the first maximum across devices, so a tie goes to the lowest index. When the row's first logit is a NaN it returns token 0, as the greedy sampler does.The draft rows the host reads are one-hot at the pick, by design. Under a tensor split their only reader takes the row's argmax, as listed below. Building the rows from the picks avoids gathering every device's rows to every device.
Without a tensor split the graph is unchanged. The head also stays whole in these cases:
LLAMA_TENSOR_LOGITS_GATHERis set;Commits
test-argmax-split.UNARYand every op after it. RPC sends ops by number, and its handshake compares only the major (and the minor against the client's), never the patch.ggml_backend_meta_rowsreturns a whole view in that case, and the meta split rule forARGMAX_PARTasserts that every device has rows.test-argmax-splitruns through the default all-reduce. It had setGGML_CUDA_ALLREDUCE=none, which hid the BF16 rounding ggml: reduce meta-backend gathers exactly in the CUDA all-reduces #26 fixes.test_meta_nanputs a NaN at each later device's first row, over two and three devices. Only the row's first value decides token 0.test-argmax-splitchecks both, and runs at a 4096-token vocabulary unlessTEST_VOCABsays otherwise.op_caps.supports_opfor the two ops from that flag.dspark_vocab_partsasks each weight's meta device, which asks each of its devices, before it splits the head.GGML_ASSERT, before writing, what the constructors build. That is how the neighbouring kernels check shapes.test-argmax-malformedbuilds such nodes by hand. Before: 4 of 8 wrote past the destination, and the other 4 computed unrefused. After: all 8 abort with the canaries after the destination intact.The merges of #26's branch bring its follow-ups in: no change to this branch's own code.
Evidence
All runs are on DeepSeek-V4.1 UD-Q2_K_XL with its DSpark Q8_0 drafter, tensor-split across three DGX Sparks (GB10) over RPC, served by spiced. The arms are the fork tree the lab serves, without and with this change.
A/B. bench_sym, 8 prompts x 200 tokens, greedy. Sessions ran D X Y Y X D, with one run per session set aside and two counted, so 4 counted runs per arm. Spans are medians over about 603 steps from an nsys capture of the head.
Per-row dot products are bit-identical. The mmvq and mmvf launch parameters depend on type, columns, K and device, not on the row count or a row offset.
test-argmax-spliton CUDA, a meta device over two copies of the GPU (internal all-reduce) and over three (butterfly), at the drafter's shapes:test-argmax-splitchecks the picks against the first max of what the devices computed, and only reports the difference from the whole product.Tie order. Ties are planted across devices and inside one device's slice, in different threads and warps.
ggml_argmaxof the whole row, which picks a later tied index: 64641 where the first max is 64122.argmax_part_combine's tie order inverted, the test fails (pairs rows 1, 4, 5, 6: pick 999 for 31, 999 for 0, 11 for 10). Restored, it passes.NaN at a later slice's start. On a meta device over two and three copies, each later device's first row is a NaN. The max sits in the last row, in the first device's rows, or nowhere (every other row -inf).
origin == 0removed fromARGMAX_PART's first-NaN checkThe 5 cases that still pass under the mutation are the NaN at row 0, and the all -inf rows, where token 0 is right either way.
Copilot findings, each shown on CPU or CUDA before and after.
ggml-backend-meta.cpp:1469: GGML_ASSERT(split_dim_view_src >= 0 && split_dim_view_src < GGML_MAX_DIMS) failed. After, over two and three devices, on CPU and CUDA0: picks equal, and 0 of 2000 gathered values are off from the rows after the offset.3 of 6 along axis 1 scales to 3/6.picks 0 700 31 0 500 829, want 0 700 31 0 500 829 okon the Mac CPU. On CUDA0, where the lab's standard library draws other random rows, the picks are0 700 31 0 500 828and equal the reference. The rows include a first NaN on each device's first row, a skipped NaN and a tie.argmax_part_f32writing index + 1:n_parts > 1cases pass (3/4 tests passed);pairs row 2: pick 0, want 0, pair (inf, 0) ... FAIL.1 2 2 3 3 4where the transpose holds1 4 2 5 3 6. It now stops at the new assertion.-sm tensor, one request,GGML_SCHED_DEBUG=2): ARGMAX_PART 3, ARGMAX_MERGE 3, ARGMAX 0.-ot ^output.weight=CPU):ggml-backend-meta.cpp:662: GGML_ASSERT(ret.axis != GGML_BACKEND_SPLIT_AXIS_UNKNOWN) failed.ggml.c:1838: GGML_ASSERT(obj_new) failed). Arm D's tree aborts the same way, so this abort predates this change. The run used the same setup with-sm tensor -ot ^output.weight=CPU, on 2026-11-02:output.weightis overridden to the CPU, and the op list reads ARGMAX_PART 0, ARGMAX_MERGE 0, ARGMAX 2.ggml_new_object: not enough space in the context's memory pool (needed 108560, available 108192), thenggml/src/ggml.c:1832: GGML_ASSERT(obj_new) failed, insideggml_backend_meta_graph_compute's copy of the graph.ggml.c:1838; this change adds six lines toggml.c's op tables above it.ggml-backend-meta.cpp:662). The remaining abort is pre-existing and not fixed here (see the notes below).tokenizer.ggml.suppress_tokens.Empty shares. On the CPU meta backend, with one device given no rows and the logits below 0, the commit before the guard picked 0 where the first max was 5946, 12356 and 169. With the guard, every pick matches.
Two sequences.
ggml-backend-meta.cpp, handle_view) and computes for one.-np 2with two requests sent together drafted each sequence separately.test-argmax-splitbuilds the Markov head's graph for one sequence split by rows, and for two on the whole head, and checks the picks against the whole computation.RPC versions. Loopback on CPU servers, with a client that runs
silu,swigluandrms_normover RPC and compares against the CPU:RPC server version mismatch: 8.0.1; server stays upRPC server version mismatch: 9.0.0; server stays upBackends without the ops.
not supported [MTL0], and the CPU passes.Views of a rows view (Mac CPU, two and three devices).
test_meta_view_of_rowsgathers an identity view, a view of each row's second half, a view from row 250 and a reshape of a rows view, and compares each with the rows it views. Each row holds distinct exact values, and the last column is a peak at row 750.ggml-backend-meta.cpp:1484: GGML_ASSERT(split_dim_view_src >= 0 && split_dim_view_src < GGML_MAX_DIMS).16000 of 32000 gathered values differ ... (first in row 500: 0, want 500000)over two devices, 21344 over three). The identity view's product differs from the rows view's in 1000 of 2000 values, and it picks 499 (999 over three devices) where the rows view picks 750.ggml-backend-meta.cpp:1295over 333/333/334).RPC servers without the ops.
test-rpc-argmax-splitstarts twoggml-rpc-servers on one device and builds a meta device over the two RPC devices. It checks that each RPC device and the meta device answer for both ops as that device answers locally. It then takes each column's pick the way the drafter decides: from ARGMAX_PART and ARGMAX_MERGE over a head split by rows when the meta device runs them, elseggml_argmaxover the whole head. Runs on an Apple M3 Max:ggml-metal-ops.cpp:215: unsupported opinrpc_server::graph_compute; clientRemote RPC server crashedRPC_TEST_DEVICEpicks another device.supports_opaccepts both ops over contiguous F32 and skips its buffer check for unallocated sources (ggml-cuda.cu). So a CUDA server sets the flag, and a split over CUDA RPC servers, as in the A/B above, still splits.Op lists. llama-server with the DSpark draft and
GGML_SCHED_DEBUG=2, one request:-sm tensor-sm layerReaders of the drafter's rows under a tensor split.
common_sampler_row_argmax(common/speculative.cpp) takes the first max. Its fallback takes the chain's top candidate.src/llama-context.cpp). The draft probabilitiesresult_qare DFlash2-only.Exact ties on real prompts. A build with a counter, on the same 8 prompts: 0 exact top ties in 3246 target picks, and 0 in 3618 drafter rows.
Notes and follow-ups
src/models/dflash.cppbuilds from a model file. So the eligibility guards indspark_vocab_parts(n_blocks != 1among them) and the one-hot rows are covered by the end-to-end runs and op lists above, not by a test:test-argmax-splitnever callsdspark_vocab_parts, so removing a guard would leave it passing (by inspection). That holds for the check that every device runs both ops too:test-rpc-argmax-splitchecks the answer that check reads (supports_opon the RPC and meta devices), notdspark_vocab_partsitself.ggml_backend_meta_graph_computeruns out of its graph copy's context (ggml.c:1832on the base,GGML_ASSERT(obj_new)), with or without this change (above). It is not fixed here, and not reproduced on a Mac: no model at hand.GGML_ABORT("RPC handshake failed")), a mismatch, like any failed connect, aborts the client process rather than returning an error. That predates this change.-np 2(unverified hypothesis). The two-sequence llama-server run gave arm D's tree different replies from the lever builds. That is plausibly timing-dependent batch composition across two concurrent slots. It is not a finding; the single-sequence runs above are bit-identical.Test plan
test-argmax-split: CPU (Mac) and CUDA (GB10, two and three copies), at the default vocabulary and atTEST_VOCAB=129280.origin == 0removed (above).test-rpc-argmax-spliton two Metal and two CPU RPC servers, before and after the HELLO flag, and against servers without it (above).test_meta_view_of_rowson the Mac CPU over two and three devices, failing before the view fix and passing after (above).test-argmax-malformedon the Mac CPU: 4 of 8 malformed nodes wrote past the destination before the kernel checks, and all 8 abort with intact canaries after.ctest -R "test-rpc|argmax|gather-exact"gives 11/11;test-backend-ops -b CPUgives ARGMAX_PART 4/4 and ARGMAX_MERGE 3/3.spiceai-b11999and the kernel checks): all 27 jobs that ran passed, none failed (the same jobs as on e94f5bf).License compliance check,labeler;ctest (ADDRESS|THREAD|UNDEFINED, ubuntu-24.04); thecuda,hip,musaandubuntu-22-hip-quality-checkbuilds;macos-latest-arm64,macos-latest-ios-xcode,macos-latest-swift(iOS, macOS, tvOS),macos-latest-tvos,macos-latest-visionos;ubuntu(2),ubuntu (arm64, ubuntu-24.04-arm),ubuntu (x64, ubuntu-22.04),ubuntu-webgpu(2);windows(2),windows / arm64,windows / x64-cpu-static,windows / x64-openblas.macos-latest-arm64rantest-argmax-split(with the views of a rows view),test-rpc-argmax-split(on CPU servers),test-meta-gather-exactin all three registrations,test-rpc-nccl-wireand the other RPC tests: 100% of 27 passed. The SYCL jobs do not run for this branch's paths.build-cmake-pkg / linux,cpu-arm64-graviton4-kleidiai,cpu-arm64-high-perf-graviton4,cpu-x64-high-perf,cuda(the hosted T4 job of that name),gpu-cuda,gpu-metal,gpu-openvino-low-perf,gpu-rocm,gpu-vulkan-apple,gpu-vulkan-intel-linux,gpu-vulkan-intel-windows,gpu-vulkan-nvidia-cm,gpu-vulkan-nvidia-cm2,gpu-webgpu-apple,gpu-webgpu-nvidia,metal,rocm,vulkan-amd,vulkan-nvidia,webgpu-nvidia,ubuntu-24-ppc64le,ubuntu-26-s390x (VXE OFF),ubuntu-26-s390x (VXE ON),ubuntu-26-zdnn-s390x.