Repository navigation
feat(ds4): add concurrent serving on Strix Halo and R9700 + Strix - #598
Conversation
f5e8a26 to
17600d8
Compare
|
@cubic-dev-ai review this PR |
@Graffioh I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
All reported issues were addressed across 25 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
|
@cubic-dev-ai review this PR |
@Graffioh I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
All reported issues were addressed across 36 files
You’re at about 95% of the monthly reviewed-line limit. You may want to disable incremental reviews to conserve quota. Reviews will continue until that limit is exceeded. If you need help avoiding interruptions, please contact contact@cubic.dev.
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
18d4bbf to
708fef2
Compare
There was a problem hiding this comment.
No issues found across 37 files
You’re at about 97% of the monthly reviewed-line limit. You may want to disable incremental reviews to conserve quota. Reviews will continue until that limit is exceeded. If you need help avoiding interruptions, please contact contact@cubic.dev.
051377c to
36947d5
Compare
f27b1d7 to
e799f8b
Compare
There was a problem hiding this comment.
Review completed against the latest diff
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
|
@Graffioh This PR currently adds another direct call in the DeepSeek4 paged decode path: so it would reintroduce the same Windows build issue. Could this call also use: #710 was validated with a native Windows 11 / MSVC / HIP build on an R9700 (gfx1201). |
e799f8b to
644c804
Compare
There was a problem hiding this comment.
All reported issues were addressed across 7 files (changes from recent commits).
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
6429bf4 to
f3b7e05
Compare
There was a problem hiding this comment.
1 issue found across 7 files (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="server/test/test_gfx1151_width4_dispatch.cpp">
<violation number="1" location="server/test/test_gfx1151_width4_dispatch.cpp:128">
P3: The test now validates ROCmFP4 packed dispatch up to sixteen columns (rename, override 16, loop to n=16), but the SKIP and PASS/FAIL output still say "width-4 dispatch", which no longer describes what the test covers. Update both printf labels (e.g. to "paged dense dispatch") to match the header/function rename.</violation>
</file>
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
There was a problem hiding this comment.
1 issue found across 9 files (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="server/deps/llama.cpp/ggml/src/ggml.c">
<violation number="1" location="server/deps/llama.cpp/ggml/src/ggml.c:4291">
P2: When this graph runs on Vulkan, `ggml_soft_max_ext_sink_col` silently uses the first sink for every row because Vulkan does not implement the new `sink_col` mode. Add sink-column handling to each supported backend, or reject/fallback this op on backends that only support legacy per-head sinks.</violation>
</file>
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
Reuse gfx1151 ROCmFP4 weights through sixteen columns, retain narrow F16 MMVF routing, and reduce mixed FP2/FP3 projection overhead while honoring explicit dispatch ceilings. Use an ordered legacy buffer pool and retain compatible scheduler staging allocations across graph rebuilds. Add tail RoPE and exact sink-column softmax on CPU and CUDA/HIP. Handle large sink-column rows with the existing global-memory fallback, and reject unsupported modes in other backends. Include kernel regressions and their build/CI registration. Validation: targeted HIP build; sink-column regression passes on CPU, gfx1151 and gfx1201, including shared-memory boundary widths and distinct row sinks, with zero bit mismatches against scale-concat-softmax. Other backend capability guards were reviewed but not runtime-tested here. Co-Authored-By: Codex <codex@openai.invalid> Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Share slot lifecycle bookkeeping between Qwen and DeepSeek, and add DS4 paged cache ownership and a sequence engine for monolithic Strix Halo and R9700 plus Strix serving. Keep per-sequence attention, compressor, sampling, and cancellation state isolated, with explicit cache memory accounting. Reuse gathered graph shapes, pack chronological prompt rows, and partition dense and expert projections at qualified widths. Consolidate gathered attention data movement, tail RoPE, sink-column softmax, and compressor flushes while preserving chronological reads and backend ownership. Include host and model-state regressions, serving documentation, and the qualified launch recipe. Historical real-model and profiling evidence is recorded in PR Luce-Org#598; this history cleanup preserves the tested source tree. Co-Authored-By: Codex <codex@openai.invalid> Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
3b39994 to
ebf848f
Compare
Resolve the prefix-cache, scheduler, engine, and slot-manager overlap with Luce-Org#665, Luce-Org#720, Luce-Org#598, and Luce-Org#625/Luce-Org#642: - reserve_inline_snap() takes restore_source_slot (from Luce-Org#665) ahead of the resident-byte estimator; the restore source is never the eviction or budget victim and the free-slot path skips it. The Luce-Org#665 tests are ported to the reservation API. - The scheduler builds the prefix plan and admits with it inside the admit-first flow from Luce-Org#720; every non-admitted outcome and a failed SSE header send cancel the capture transaction. - pending_capture and seed_restored_prefix() move to the shared SeqSlotManager; the Qwen aliases stay. - The engine keeps its out-of-line constructor and initialises pool_. - The new flag is documented in server/README.md.
Rebased onto main after Luce-Org#665, Luce-Org#598, Luce-Org#625/Luce-Org#642, and Luce-Org#720. Original commits by Graffioh (8aaa6ae, 0493354, 171015f, 99129bb); rebase resolution by mrciffa: - reserve_inline_snap() takes restore_source_slot ahead of the resident byte estimator; the restore source is never the eviction or budget victim and the free-slot path skips it. The Luce-Org#665 tests are ported to the reservation API. - The scheduler builds the prefix plan and admits with it inside the admit-first flow; every non-admitted outcome and a failed SSE header send cancel the capture transaction. - pending_capture and seed_restored_prefix() live in the shared SeqSlotManager. - The engine keeps its out-of-line constructor and initialises pool_. - The new flag is documented in server/README.md.
Summary
Adds paged concurrent serving for DeepSeek V4 on Strix Halo and on an R9700 target with Strix Halo expert execution. Multiple requests share each model weight pass while retaining separate attention history, compressor state, sampling state, and request lifecycles.
The PR also reduces graph construction, kernel launches, and memory traffic in this serving path, and tunes the existing HIP kernels for the small batches produced by concurrent decode.
Concurrent serving
DeepSeek4SeqEngineimplements the shared scheduler interface. Each step advances live decoders and selected prefills, with up to six live sequences and chronological prompt-row packing on the monolithic path. The existing HTTP scheduler handles admission, cancellation, streaming, and slow clients.DeepSeek4PagedCachekeeps a 128-token raw attention ring per slot, compressed history in physical pages, and separate compressor state for each sequence. Block tables map logical history to physical rows, so requests can reuse released pages without sharing state.SeqSlotManagercentralizes the host-side lifecycle used by Qwen and DeepSeek: prompt reservations, decode headroom, page allocation, sampling history, seeded RNGs, and retirement. It preserves seed zero and releases active pool handles on destruction.Optimizations
GGML_ROPE_TYPE_TAILrotates the final rotary dimensions and copies the remaining head dimensions in one operation. CPU and CUDA/HIP implementations replace DeepSeek's split, copy, rotate, and concatenate sequence while retaining its arithmetic.Supported scope
Monolithic paged serving supports Strix Halo. Heterogeneous serving requires an R9700 primary and an in-process Strix Halo expert backend with static expert ownership. The runtime supports up to six lanes; the documented grouped-expert recipe is qualified through four clients with ROCmFP2 gate/up and ROCmFP3 down weights.
Paged serving requires exact prefill and autoregressive decode. Unsupported combinations fail initialization, including drafts/DSpark, fused decode, approximate prefill, explicit layer splits, remote shards, mutable expert caching, and prefix-cache parking. Heterogeneous serving still advances one prompt token per lane per step.
MoE arithmetic can still vary with the live lane count, so arbitrary batch compositions are not guaranteed to produce identical tokens.
Strix Halo monolithic results on 2026-09-06 (fixed-C A/B/A against
644c804b, exact output at every width)Two- and three-column ROCmFP4 weight reuse (
3dd7eef7): C2 output-window throughput +4.09% (drift 0.10%), C3 +7.92% (drift -0.31%), p95 TTFT -2.84% and -6.59%.Packed prompt rows with the sixteen-column kernel and eight-row expert parts (
cd33b50d,74a6b203,bc80cbfc), measured together:On four distinct prompts per wave (
mixed-36.jsonl, two waves, 128 output tokens, baseline bracketed) the packed runtime raises output-window throughput 17.81 to 22.95 tok/s (+28.9%, 0.0% drift), aggregate 15.31 to 18.73, and cuts median TTFT 11.18 to 8.50 s and the 2k-prompt maximum 29.9 to 20.0 s, because decoders spend fewer rounds beside a one-token-per-round prefill. The C4 decode change is a uniform ~1% slowdown of every kernel after a packed prefill with identical launch counts, not a code-path difference. The replicated-prompt fixture understates the C4 TTFT gain: the baseline's expert kernel runs 17-46% faster per call on four identical tokens than on four distinct ones. Records: Luce-Org/luce_box PR 95.Strix Halo monolithic follow-up on 2026-09-07
The gfx1151 paged default now sets
LUCE_MMVQ_MAX_NCOLS=16, restoring the dense ROCmFP4 route required by packed prefill while honoring an explicit environment setting. The gathered graph's capture setting does not override this ceiling.Lone-prompt packing (
bcf5263c) was measured against the corrected four-row baseline (fbce7c5b) in fresh fixed-C A/B/A brackets:All 30 candidate responses and both baseline arms match saved
039dc950outputs, including content and reasoning hashes, token counts, and finish reasons. Each concurrency uses the same three replicated-prompt waves. C1's 5.90% TTFT reduction clears twice its 0.82% baseline TTFT drift, with a measured 0.54% output-throughput cost. C2–C4 remain effectively unchanged.Using spare rows for concurrent prompts was also tested and excluded: uneven C3 progress reduced output throughput by 2.32% and increased TTFT by 1.95%. The final policy widens only a lone prompt, using existing slot state and no new flag. Projection partition widths and single-sequence expert arithmetic stay unchanged.
Focused tests cover second admission, active decoding, retirement, and heterogeneous limits. GPU arithmetic tests cover every ROCmFP4 width from two through sixteen with zero bit mismatches against independent single-column execution.
Gathered attention consolidation
Commit
3b399945consolidates gathered attention data movement and inverse tail RoPE, uses exact sink-column softmax for histories up to 2048 rows, and reuses the two-scatter compressor flush. Repeated-slot prompt rows preserve chronological cache reads; hybrid context scratch is explicitly assigned to the main backend.The final unprofiled Strix C4 A/B/A bracket measured +3.54% output-window throughput against -0.38% baseline drift, with 1.35% lower p95 TTFT. Matched LuceGraph captures show 15.82% fewer decode launches and 17.97% fewer full packed-step launches. Profiled timing is diagnostic.
Initial C1-C4 monolithic checks matched all 30 saved outputs. The guarded revision matched all 12 final C4 outputs; the final hybrid ownership repair matched all 30 C1-C4 dual-GPU outputs. The monolithic bracket and profiles precede the three host-only hybrid placement lines. Focused sink tests pass on CPU, gfx1151 and gfx1201; tail RoPE and DS4 unit tests pass. No new runtime switches. Arbitrary batch invariance and long-history performance are not claimed.
Compressor projection batching on 2026-09-07
Commit
a085cc22adds 33 lines and removes 4 across two graph-builder files. It reuses the existing projection helper and prepared-lane bundle, with no new kernel, runtime flag, or persistent state. Qualification is on gfx1151 monolithic paged serving against the preceding PR head,ebf848f3.Each concurrency uses three replicated-prompt waves at 96 generated tokens per request in baseline/candidate/baseline order. All 90 requests meet the fixed-token workload check, and candidate output bytes match both baselines. C1 is essentially unchanged; C2-C4 throughput gains clear twice their measured drift.
The table reports canonical aggregate output-window throughput. The preregistered median-per-wave C4 gate separately passes: +2.23% throughput against -0.59% baseline drift, exceeding the original 2% threshold and twice drift.
A separate C4 bracket uses twelve distinct prompts per arm with natural EOS and a 128-token cap. All 36 responses match across the bracket. Output-window throughput improves 1.90% (drift -0.21%), server-native prefill throughput improves 2.19% (drift -0.27%), and p95 TTFT falls 1.93% (drift +0.36%). These distinct-prompt improvements clear twice their respective drift. Fixed-C4 prefill changes are closer to noise.
The reduced four-layer real-weight proof compares 318 checkpoints and 2.16 GB of logits and cache/state per run, covering C1-C5 decode, packed widths 4/8/12/16, compression ratios 4/128, and raw-ring wrap. Matched C4 profiles remove 20 decode and 92 packed launches per four-layer step. These are reduced-model launch counts; no full-model traffic-counter claim is made. Full-model qualification covers C1-C4 on gfx1151, not hybrid or other-device performance.
Validation
Focused tests cover page addressing, cache planning, slot ownership, scheduler contracts, feature gates, graph generations, expert kernels, width-four/five dispatch, and tail RoPE. Real-model checks on both supported GPU configurations cover mixed-length concurrent requests, page boundaries, cancellation, slot reuse, and repeatable seeded sampling.
The sink-column review fixes cover rows beyond shared-memory capacity and
reject unsupported sink-column mode on Vulkan, Metal, OpenCL, SYCL, and
WebGPU so the scheduler can select a supporting backend. The expanded
CPU/HIP regression passes on gfx1151 and gfx1201 with zero bit mismatches
against scale-concat-softmax, including shared-memory boundary widths and
distinct row sinks. Other backend capability guards were reviewed but could
not be runtime-tested with the available toolchains.
Contributor credits and history
The two consolidated Graffioh-authored commits above
origin/main(b1c88230) remain unchanged:c00b8c10(perf(ggml)) for backend operations, kernels, and their tests;ebf848f3(perf(ds4)) for paged concurrent serving and gathered execution. The qualified compressor projection follow-up,a085cc22, is appended without rewriting either commit.The earlier history cleanup preserved the validated source tree. Earlier hashes in the measurements above identify the historical revisions used for those experiments.
The original contributions by cheese-cakee (
42ae0293,88f09687:graph-generation safety and regression coverage) and poruru-code
(
b4de7455: portable Windows/HIP environment handling) are already in mainand remain intact in this branch's ancestry with their original authorship.
Existing co-author credits are retained in the consolidated commits.