Skip to content

feat(qwen4exp): Qwen3.8-Flash-Next backend — parity, prefill/decode perf - #774

Merged
davide221 merged 106 commits into
Luce-Org:mainfrom
dusterbloom:feat/qwen4exp-strix-halo
Oct 7, 2026
Merged

davide221 merged 106 commits into
Luce-Org:mainfrom
dusterbloom:feat/qwen4exp-strix-halo

Conversation

@dusterbloom

@dusterbloom dusterbloom commented Sep 26, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Qwen3.8-Flash-Next (qwen4exp) as a hand-written target, tuned for the Strix Halo (gfx1151, 128 GB unified memory). The model is complete: 36 Gated DeltaNet and 12 full-attention layers with Qwen Sparse Attention (top-512 blocks of 4 tokens), 4-stream hyper-connections, per-layer n-gram embeddings and a 512-expert MoE (10 active). It is byte-exact against upstream llama.cpp's reference path. Other models are unchanged.

Model support (server/src/qwen4exp/)

  • Loader, graph, cache and backend. QSA at prefill and decode, with keys pooled over 4-token blocks as in the reference model.
  • Chat template: the GGUF's official Jinja template, thinking by default (xhigh effort); reasoning_effort low / medium / xhigh pass through. Multi-turn replays reasoning_content and honours chat_template_kwargs.preserve_thinking.
  • Thinking-budget force-close (Qwen's own budget text). Cards carry sampling_no_thinking (Qwen's instruct set) for requests with thinking off.

Kernels (ggml-cuda/, HIP)

  • QSA selected attention; MMB bf16 and Q8_0 -> F16 WMMA GEMMs with an F16 activation dataflow; HC / GDN / PLE fusion; M-RoPE written straight into the flash-attention layout; packed get_rows; head-256 MMA flash attention; MMQ for IQ3_S / IQ4_XS / Q4_K / Q5_K / Q6_K / Q2_0.

Serving

  • No environment variables: on gfx1151 the backend selects its measured kernel profile in code, scoped to qwen4exp, so other models keep their dispatch. The upstream reference path used by the differential is a test/script argument.
  • Without --chunk, prefill chunks are sized to the free memory (7424 rows for UD at 262K context, one slot). Prompt attention accumulates in F32: on UD an 18K prompt prefilled in 2048- or 7424-row chunks gives logits bitwise equal to one pass.

Models

Base model: Qwen/Qwen3.8-Flash-Next. GGUFs verified on this branch:

Results (Strix Halo gfx1151, default flags, fresh server per run)

prefill decode GTT
UD-Q4_K_XL, 16K prompt 1,200-1,240 tok/s 22.4 tok/s 77 GB
UD-Q4_K_XL, 64K prompt 1,200-1,250 tok/s 20.9 tok/s
UD-Q4_K_XL, short prompt - 24.1 tok/s
IQ4_NL, 16K prompt 950-1,010 tok/s 28.5 tok/s (30.6 short) 73 GB
GSQ-RCO IQ3_XXS, 16K prompt ~475 tok/s 25-26 tok/s 47 GB

UD prefill rows: memory-sized chunks at 262K context; the other quants were measured with 2048-row chunks.

Quality (lucebox gates, prompts above the 512-token MMB floor with a 1,500-token preamble): HE / GSM / Math 10 / 10 / 10 and 16K planted-fact recall 3/3 on all three quants.

Validation

  • Upstream differential (reference path): no onset and 0 expert-ID mismatches across all 48 layers on IQ4_NL and UD-Q4_K_XL; no onset on GSQ-RCO IQ3_XXS.
  • Split-prefill KLs reproduce exactly (0.082874 / 0.118543 / 0.652715 / 0.734763); T=1 decode and prefill snapshots are byte-identical across 3 fresh processes.
  • test_qwen4exp_qsa_ids (89 cases, GPU and CPU), test_qwen4exp_indexer_score, test_rope_tail (including the M-RoPE -> CONT position alias), test_backend_plan, test_server_unit.
  • CI: Linux build, Windows MSVC + CUDA, R9700, Strix Halo and DGX GB10 green.

Known limits

Guide: server/docs/QWEN4EXP.md.

@dusterbloom
dusterbloom force-pushed the feat/qwen4exp-strix-halo branch from 6c8cc2c to f87e80f Compare September 26, 2026 08:20
- QWEN4EXP_DENSE_TABLE: per-shape measured dense-GEMM dispatch (gfx1151,
  T=16366), routing by measured winner (mostly MMQ over MMB/cuBLAS).
- QWEN4EXP_HC_TILE16: 16-row HC gate/mix tile on RDNA3.5, byte-exact.
- expert-major MoE pipeline implemented but neutral; rejected, kept
  default-off behind QWEN4EXP_MOE_PIPELINE.
- harness BENCH_MAX_TOKENS / BENCH_THINKING / BENCH_EFFORT experiment knobs.
- delivered @16366 tokens: 1063.1 t/s median / 1065.5 best (control 994.0 /
  1002.2), min-of-8 all >1000; quality HE 10/10, GSM 10/10, Math 9/10,
  recall 2/2; GSQ + IQ4_NL reference profiles byte-exact.
- evidence under docs/performance/qwen4exp-1100/.
…N by default

These three were validated wins in 52a40e52 but shipped default-off, so the
released binary ran the slow path. Now on by default (opt out with =0).

- QWEN4EXP_DENSE_TABLE=1, QWEN4EXP_HC_TILE16=1, QWEN4EXP_LAST_TOKEN_FFN=1
- QWEN4EXP_UPSTREAM=1 still excludes the two dispatch candidates, so the
  reference profile is unchanged.

Verified on IQ4_NL with no candidate flags:
- quality HE 10/10, GSM 10/10, Math 9/10, recall 2/2
- prefill min-of-8 @16366 tokens: TTFT 15.27 s -> ~1072 t/s
- reference differential (GSQ, QWEN4EXP_UPSTREAM=1): byte-exact, 0/160
  expert-ID mismatches, no onset.
QWEN4EXP_DECODE_REUSE retains a T=1 decode metadata context and graph
allocator in Qwen4ExpCache: each token resets the metadata arena, rebuilds
the graph, remeasures allocator assignments, and reuses the allocator
backing buffers. Default-on; opt out with =0; excluded under
QWEN4EXP_UPSTREAM=1.

Decode min-of-N (IQ4_NL, 1 warm-up + 8):
- ~2k:  27.87 -> 28.55 t/s (+2.43%)
- ~16k: 24.62 -> 25.34 t/s (+2.93%)

Gates: exact constrained greedy output/token count at both depths;
reference differential byte-exact (ratios 1.0000, 0/48 expert-ID
mismatches); quality HE 10/10, GSM 10/10, Math 9/10, recall 2/2;
prefill min-of-8 unchanged (15.30 s @16366).
The T=1 decode step now runs a stable, per-KV-bucket cgraph (fixed views,
bucketed kv_len, single input buffer) that HIP captures once and replays:
~2,236 replays / 2,240 calls, one hipGraphLaunch per steady-state token
carrying all ~2,800 kernels. Build/allocation per token drops from
0.95->0.011 ms (2k) and 1.21->0.010 ms (16k).

Decode min-of-N (IQ4_NL, 1 warm-up + 8):
- ~2k:  28.58 -> 29.89 t/s (+4.58%)
- ~16k: 25.32 -> 28.06 t/s (+10.85%)

Default-on: QWEN4EXP_DECODE_STABLEGRAPH (opt out =0) and the HIP graph
replay build option (server/CMakeLists.txt now defaults GGML_HIP_GRAPHS=ON;
-DGGML_HIP_GRAPHS=OFF to disable). Excluded under QWEN4EXP_UPSTREAM=1.

Gates: exact greedy token stream; quality HE 10/10, GSM 10/10, Math 9/10,
recall 2/2; reference differential byte-exact (no onset); prefill min-of-8
unchanged (~1068 t/s @16366).
Adds 22 measured GSQ tuples to the default-on QWEN4EXP_DENSE_TABLE, selecting
MMQ (instead of the slow MMB path) for exact-16366-token, gfx1151 qwen4exp
runs. Excluded under QWEN4EXP_UPSTREAM=1.

GSQ prefill min-of-N @16,366: 579.63 [579.33-583.97] -> 757.99
[754.33-764.33] t/s (+30.77%). Gates: exact planted recall, greedy "Paris",
GSQ quality HE10/GSM8/Math10/recall2, GSQ+IQ4 upstream differentials no onset
0/ID mismatches, IQ4 prefill 1073.69 t/s and decode thermally matched.
A BF16 rocBLAS extension reached 857.93 t/s but corrupted long-context
output and was rejected (rocBLAS/f16-fallback risk; see log E26).
T12 (all-arch regression) found that with HIP graphs on, qwen4exp missed one
standard 13k recall fact (7/8 matched cases vs 8/8 with graphs off) and the
first greedy response was not byte-stable on first capture; fresh repeats
passed 6/6 but the signal blocks an unconditional ship.

Restore GGML_HIP_GRAPHS=OFF (server/CMakeLists.txt) and make the stable T=1
graph opt-in (QWEN4EXP_DECODE_STABLEGRAPH=1). No throughput regressions were
seen on qwen35/deepseek4/qwen4exp, but correctness gates win. The E23/E24
code stays for triage (T14).
T14 root-caused the E30 quality variance to pre-existing prefill numerics
(full-vocab logit hashes already differ at step 0 even with HIP graphs OFF,
QSA/MMB/tiled-GDN off, and the upstream profile) rather than the stable graph,
and showed HIP capture/replay is throughput-neutral in a matched stable-path
A/B. So re-enable only the stable T=1 graph (cached cgraph + allocator, which
carries the decode win) while keeping GGML_HIP_GRAPHS=OFF.

QWEN4EXP_DECODE_STABLEGRAPH is default-on (opt out =0); excluded under
QWEN4EXP_UPSTREAM=1.

Decode min-of-N (IQ4_NL, 1 warm-up + 8), same graphs-off build, paired:
- ~2k:  27.85 -> 29.70 t/s
- ~16k: 22.40 -> 26.60 t/s   (E23 order-controlled: 25.32 -> 28.06, +10.85%)

Gates: HE 10/10, GSM 10/10, Math 9/10, recall 2/2; prefill min-of-8 15.31 s
@16366; reference differential no onset; T14 graph-on recall 16/16.
- fattn: move the sparse-mask assertion after the DeepSeek4 maskless dispatch
  (the qwen4exp guard was aborting DS4 maskless prefill).
- backend: drop the process-global GGML_CUDA_MMB setenv; implement real
  park/unpark (release + reload weights/cache, propagate errors).
- graph: require every full-attention layer to pass qsa_layer_ok before
  eliding the dense mask; parse QWEN4EXP_QSA by value (=0 now disables).
- loader/cache: free buffer + close PLE reader on failure; clear the PLE
  n-gram window on reset/free; reject malformed GDN metadata.
- hip_compat: add cudaErrorNoDevice; drop a self-referential __launch_bounds__.
- remove rejected/diagnostic-only paths (QWEN4EXP_MOE_PIPELINE + check,
  QWEN4EXP_KQ_MASK_DEV); CUDA_CHECK HIP calls; exhaustive CLAMP rejection list.
- tools/docs/tests: derive repo paths (no hardcoded /home/duster); full flag
  inventory in docs/qwen4exp.md + ENVIRONMENT.md; qwen4exp capability
  regression tests; fix two stale tests.

Validated: ROCm build PASS; ctest 730/730 (13 expected skips); quality HE 10/10,
GSM 10/10, Math 9/10, recall 2/2; upstream differential no onset; prefill N=8
1065.84 [1063.42-1066.88] t/s (+0.79%).
Replaces the previous approach (b4bdf73a), which fixed a read-after-free by
dropping the CONCAT-time interception. That forced full materialization of the
conv-input concat (37 tensors ~[16369,10240], about 24.8 GB at T=16,366) and
cost +2.4 s prefill (IQ4_NL 17.10 vs 14.49 s; GSQ 23.46 vs 20.95 s).

This restores the fast interception and makes the dependency explicit to the
allocator through unused input slots, so the fused kernel reads tensors whose
lifetime is graph-encoded at the node where it runs:
- GDN: ordinary SSM_CONV ignores src[3]; it is set to the transpose input.
- PLE: CONT ignores src[1]; it is set to the normalized input for the first shift.

Gates: 16,366 prefill at/above the pre-fix parent (IQ4_NL 14.340 s / 1141 t/s,
GSQ 20.715 s / 790 t/s); C=1024 N=3 fresh-process snapshots byte-identical
(1f34fa...926c, matching the correct output); quality HE10/GSM10/Math9/recall2;
QWEN4EXP_UPSTREAM=1 differential no onset, 0 expert-ID mismatches; build OK.
Qwen4ExpPleReader::gather() partitioned the serial-fallback range by the
configured thread-pool size, so a T=1 gather (fewer rows than workers) filled
only the first worker's slice and left the remaining per-layer-embedding rows
zero. Partition by the actual worker count (1 on the serial path).

Found via the batched-decode layer-by-layer diff; after the fix, solo quality
(HE 10/10, GSM 10/10, Math 9/10, recall 2/2) and the QWEN4EXP_UPSTREAM=1
differential (no onset, 0 expert-ID mismatches) are unchanged.
Adds qwen4exp_forward_batched(): one graph with T=active_slots independent
one-token rows, running the shared embedding/projection/MoE/HC ops batched
(weights read once) and the per-slot full-attention, GDN recurrence and PLE
against each slot's own Qwen4ExpCache, emitting one logits row per slot.

Gated by QWEN4EXP_BATCHED_DECODE=1 (default off; excluded under
QWEN4EXP_UPSTREAM=1). The serving scheduler does not call it yet. Uses one
shared caller-owned workspace; N=1 delegates to the single-sequence path.

Validated: N=1 bit-identical to the existing path; 4 identical slots mutually
bit-identical; untouched-slot isolation, row permutation and cancel/reset/reuse
pass; batched-vs-solo residual logit deltas ~1e-3 at boundaries growing to
~2 through routing (margin policy). N=4 @32768 fits the 96 GiB GTT pool with
~12 GiB headroom.
Adds Qwen4ExpSeqEngine implementing the shared SeqEngine contract: one
full-context Qwen4ExpCache per slot (F16, no paging), one shared batched-decode
workspace, a single FIFO prefill owner with 512-token slices, per-slot reset,
and bounded-progress plan handling. Decode batch runs via
qwen4exp_forward_batched(). Fixed the engine to advance the per-slot
Qwen4ExpCache::cur_pos after each successful prefill/decode (the single-sequence
forward leaves it at zero).

Gated behind LUCE_QWEN4EXP_SEQ_ENGINE=1 + QWEN4EXP_BATCHED_DECODE=1 (both default
off; excluded under QWEN4EXP_UPSTREAM=1). When enabled, the feature gate permits
--max-concurrency 2..4 at --max-ctx 32768 with one local device and no
--kv-pool-tokens; otherwise the existing --paged-attention requirement is
unchanged. Wired through ModelBackend::seq_engine().

Validated at N=2/N=4: real-engine SeqEngine contract PASS, randomized
admit/retire soak PASS (peak GTT 75.4 GB -> 18.6 MB teardown), and 4 concurrent
distinct requests all coherent (distinct-concurrent=PASS); only slot 0 diverged
from solo at step 7 (epsilon 0.509 vs solo margin 0.021, within the margin
allowance). The decisive quality-under-batch gate is P3.
…engine

server_main.cpp auto-enabled --paged-attention whenever --max-concurrency > 1,
which conflicts with the qwen4exp full-cache sequence engine that requires
paging off. Add a narrow exception: skip the auto-enable only when
LUCE_QWEN4EXP_SEQ_ENGINE=1 and QWEN4EXP_BATCHED_DECODE=1 (and not
QWEN4EXP_UPSTREAM); every other path is unchanged.

Validated end-to-end (N=4, --max-ctx 32768): the server starts in concurrent
mode, 4 simultaneous distinct requests return correct independent answers (no
cross-talk), and the sequential quality suite still passes (HE 10/10, GSM 10/10,
Math 9/10, recall 2/2). Goodput N=1 vs N=4: per-request decode 27.9 -> 7.5 t/s,
aggregate ~1.08x -- MoE expert streams do not amortize across rows.
The Qwen3.8-Flash-Next kernel suite used AMD-specific intrinsics that broke
non-gfx1151 targets:
- CUDA/NVIDIA: ggml-cuda.cu/fattn.cu referenced the HIP-only MMB/HC/QSA symbols
  unconditionally, but the CUDA build excludes those TUs -> link failure. All 65
  references are now behind #if defined(GGML_USE_HIP) with the generic
  matmul/attention path restored for CUDA.
- gfx1201 (RDNA4 / ROCm 7.2.2): mmb.cu and qsa.cu failed to compile ('Cannot
  select intrinsic llvm.amdgcn.wmma.f32.16x16x16.f16', plus the BF16 WMMA
  builtin). The real MMB/QSA implementations are now compiled only for gfx1151,
  other targets get link-compatible unsupported stubs so the supported_* checks
  fall back to generic kernels, and MMB runtime enablement is restricted to
  RDNA3.5.

Verified: gfx1151 build (luce_server + smoke), IQ4_NL forward smoke (T=16
prefill + decode, finite logits), HTTP greedy smoke (Paris), and compile-only
checks for mmb.cu/qsa.cu at gfx1201. CUDA and full gfx1201 link are validated by
CI.
The concurrent engine pinned a single FIFO prefill owner and capped the
whole cohort at 512 prefill tokens, so prompts never shared a weight read
with each other or with the live decode rows. Decode was already
width-batched (all dense and routed matmuls ran at T = live rows).

Packed ragged prefill gives each slot its own 512-token chunk, up to the
graph's 2048-row budget minus live decode rows, so independent sequences
share one traversal for dense projections, HC, router and MoE, while
attention KV, GDN recurrence and PLE history stay per-slot.

Whole-wave aggregate goodput (Halo, 3 fresh servers per width): N=1 11.45,
N=2 14.22, N=3 15.86 (1.39x), N=4 15.42 tok/s, +22% at N=4 over 12.64.
Quality, contract, soak, HTTP edge gates and QWEN4EXP_UPSTREAM parity all
pass. Opt-in via LUCE_QWEN4EXP_SEQ_ENGINE=1 + QWEN4EXP_BATCHED_DECODE=1.
@dusterbloom
dusterbloom force-pushed the feat/qwen4exp-strix-halo branch from 24cd01f to bb835ff Compare September 28, 2026 09:18
Graffioh and others added 6 commits September 28, 2026 11:26
Issue Luce-Org#675 asked how to see what is responsible for growing host RAM:
KV-cache size in tokens and bytes, device versus host allocations,
whether memory is released after compaction, and DFlash host buffers.
None of it was visible without reading the code.

/props gains a `memory` section:
- `cache`: the live cache the model decodes from, allocated once for
  --max-ctx: location (device or host), capacity and live tokens, and
  bytes split into attention K/V, recurrent state, DFlash target
  features and the rest of the allocation, plus live host-side decode
  state (DeepSeek4 logits and DSpark feature window).
- `snapshots`: every saved snapshot with its slot, role (prefix,
  agent_turn, prefill_cache, disk_staging), tokens, bytes and location,
  with host and device totals. On discrete GPUs this is where RAM grows
  when an agent conversation keeps one snapshot per turn.
- `process`: resident and peak RSS, read when /props is served.

ModelBackend::memory_report() builds the numbers from the real buffers
(Qwen and DeepSeek4; other backends report nothing). In DeepSeek4
concurrent serving the cache is the paged cache plus the per-slot image
staging caches, and host vectors count by capacity, since trimming them
keeps their allocation. The generation
thread publishes the report at startup and after every request, in the
classic worker and in the concurrent scheduler, and /props serves the
stored copy, so it never touches backend state from the client thread.
The OpenAPI spec and props-endpoint.md describe the new section; the
change is additive, so props_schema stays 2.

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
…uce-Org#779)

* perf(qwen35): adaptive DFlash2 verify width in the concurrent engine

The concurrent engine verified every chain at the full draft block. With
several lanes the batched verify is compute-bound, so a round of 8 lanes x
16 rows mostly verifies drafts that are rejected early.

Each batch bucket now keeps an AdaptiveSpecWidth and picks the verify width
per round from {4, 8, block}: expected committed tokens from per-depth
conditional acceptance (a depth counts only when offered with every
shallower candidate accepted, so narrow rounds do not bias deeper
estimates) divided by the measured round cost. Each width is offered three
times per bucket first; the cold first offer is not a cost sample. The
drafter still proposes the full block and a round verifies its prefix.

On by default for batched serving; LUCE_ADAPTIVE_SPEC_WIDTH=0 restores
the fixed block width. Single-request speculative decoding is unchanged.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

* fix(qwen35): review fixes for the adaptive verify width

- Key the width controllers by the exact speculative lane count instead
  of the graph bucket, which spans several lane counts.
- Take cost samples only from rounds without AR peers and without a
  graph rebuild, so build time and mixed loads do not bias the costs.
- Scope the default-on note to DFlash2 chain speculation.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

* fix(qwen35): calibrate widths on clean samples; learn from verified prefixes

- Calibration offers a width until it has two clean cost samples (capped
  at eight offers), so the cost model is active after calibration even
  when rounds often carry AR peers or graph rebuilds.
- Acceptance statistics use the target-verified prefix before the room
  and min-token clamps, which are serving policy, not rejections.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

* fix(qwen35): saturate width calibration counters; reuse per-round buffers

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

* fix(qwen35): observe the round's majority lane last

The controller's clean-draft flag comes from its last observe(); the
lane whose outcome matches the round majority now goes last, carrying
the round's cost sample.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

* fix(qwen35): key adaptive width by the verify graph bucket

The verify graph is built for tree_bucket lanes, with missing lanes as
padding, so a round's cost is set by the bucket and width rather than
the number of real lanes. Keying by bucket keeps each cost model
consistent and calibrates each bucket once.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

---------

Co-authored-by: mrciffa <[email protected]>
Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
…ged serving (Luce-Org#781)

* perf(deepseek4): stage long text prompts through sparse prefill in paged serving

Paged DeepSeek4 serving prefilled every prompt row in the gathered graph,
one row per lane per step on the R9700 + Strix Halo deployment: a
1843-token prompt took 85 s to its first token.

With --ds4-prefill sparse (now accepted with --paged-attention), text
prompts of at least 64 tokens take the path image prompts already use:
prefill into the slot's staging cache on the single-request sparse
layer-major path, copy into the paged slot, then prefill the last token
and decode in the gathered graph. The monolithic deployment shares the
layer-sliced staged pass. The heterogeneous one runs one chunk of the
regular hybrid prefill per step (2048 rows idle, 1024 while others
decode), since the shared pass needs the whole model on one GPU. Staged
requests are identified by request id, not by image handle. Without
vision the staging caches are optional: if they do not fit, text prompts
keep the gathered prefill. --ds4-prefill exact is unchanged.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

* fix(deepseek4): review fixes for staged text prefill

- Keep the image handle in in-flight staged-pass members so a request
  retired mid-pass cannot free image rows the pass still reads; the
  request id stays the identity check.
- Image blocks take the shared pass budget before text prompts.
- Heterogeneous staged chunks use the same placement-aware long-context
  cap as single-request sparse prefill.
- Free the slot-0 cache too when text staging does not fit.
- The 64-token threshold counts the whole prompt.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

* fix(deepseek4): fall back to gathered prefill when slot 0 staging does not fit

Text-only sparse paged serving now treats a failed slot-0 staging cache
like the other slots: text prompts keep the gathered prefill. Image
serving still fails startup, since it needs the staging caches.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

* fix(deepseek4): stage text on a hybrid placement only with the in-process expert path

run_staged_text_chunk() drives the heterogeneous prefill through the
in-process expert backend or expert runtime. A hybrid placement without
either now keeps the gathered prefill instead of staging text prompts
that would then fail.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

* fix(deepseek4): take short staged text tails whole; document chunk failure

- In the shared pass, a text tail below twice the layer-major minimum
  goes in whole when it fits the remaining budget instead of waiting for
  a later pass.
- A heterogeneous staged chunk failure stays terminal for the request,
  now with the reason in the code.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

---------

Co-authored-by: mrciffa <[email protected]>
Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
…arget

The portability guard used #if defined(__gfx1151__), but the HIP host pass
defines no arch macro, so in every HIP build since then MMB's host dispatch
compiled to the stub and QSA reported "unsupported". Guard the device code with
defined(__gfx1151__) || !defined(__HIP_DEVICE_COMPILE__) and gate the host
decision on the runtime cc (GGML_CUDA_CC_IS_RDNA3_5).

Restores pre-regression behaviour on gfx1151 single-arch and fat builds: MMB
live at T>=512 (routed MoE per first chunk 1474 -> 391 ms), QSA=1 runs, quality
HE10/GSM10/Math9/recall2, QWEN4EXP_UPSTREAM clean with 0 expert-id mismatches.
Adds mmb-q8f16.cuh: a Q8_0 dense GEMM for MMB prefill (T>=512, gfx1151) that
dequantizes weights while staging LDS into an F16 WMMA 256-row tile with whole-K
F32 accumulation, ported from gufo's MIT design. Opt-in via LUCE_MMB_Q8F16=1;
changes numerics vs the bf16 tile, so it stays default-off.

UD-Q4_K_XL: dense MUL_MAT per d0 chunk 2299 -> 841 ms, 16,366 TTFT 25.69 -> 17.28 s
(637 -> 947 tok/s), decode unchanged. Microbench 32.9-35.9 TFLOPS on qkv/gate/q/
ssm_out (gufo F16 route ~36-37). Quality HE10/GSM10/Math10/recall2 with it on.
@davide221

Copy link
Copy Markdown
Contributor

CI failed on 0ba42220

PR doesn't build: ambiguous qwen4exp_forward overload, plus a kernel header never committed

The new backend code fails to compile on every platform. One function is declared in its header with an optional extra parameter but defined without it, so existing calls are ambiguous to the compiler; separately, an AMD kernel header that the code includes was never added to git, which breaks both ROCm builds. The change under test is at fault, not CI or the runners.

How to fix: Remove the stray default argument in the header and commit the missing mmb-small-m.cuh kernel header.

  1. In server/src/qwen4exp/qwen4exp_graph.h, drop = nullptr from the qwen4exp_forward declaration so 7-argument calls resolve only to the definition (patch below).
  2. Commit the forgotten header from your local tree: git add server/deps/llama.cpp/ggml/src/ggml-cuda/mmb-small-m.cuh && git commit -m "fix(ggml-cuda): add missing mmb-small-m.cuh".
  3. Verify the overload fix: cmake --build <build-dir> --target luce_common (any platform).
  4. Verify the HIP fix: configure with -DLUCE_GPU_BACKEND=hip -DLUCE_HIP_ARCHITECTURES=gfx1151 and build ggml-hip so mmb.cu compiles.
  5. Push and re-run the CI workflow.

compile error · high confidence · run

Details and evidence

Failed: Build Windows (MSVC + CUDA, library + server targets) › Build Windows targets; Build (cmake + uv sync --extra megakernel) › Build luce (smoke + server); GPU tests (Strix Halo Radeon 8060S, gfx1151 / ROCm) › Build + test ROCm formats and inference core; GPU tests (Radeon AI PRO R9700, gfx1201 / ROCm) › Build + test ROCm formats and inference core; GPU tests (self-hosted DGX GB10, sm_121 verifier) › Build focused NVIDIA verifier tests (sm_121)

Two independent compile breaks, both introduced by this PR.

1. Ambiguous overload (Windows MSVC, Linux CUDA, and GB10 jobs). server/src/qwen4exp/qwen4exp_graph.h:67-74 declares qwen4exp_forward(..., std::vector<float> & out_logits, Qwen4ExpHeadOffload * head = nullptr), while server/src/qwen4exp/qwen4exp_graph.cpp:1213 defines the same name with only 7 parameters. A 7-argument call therefore matches both overloads. MSVC: error C2668: 'luce::common::qwen4exp_forward': ambiguous call to overloaded function at qwen4exp_graph.cpp:1869 and :2211; GCC: error: call of overloaded 'qwen4exp_forward(...)' is ambiguous at the same lines. Nothing defines the 8-parameter overload or the declared qwen4exp_head_offload_init/free, and no caller passes a head argument, so the header's defaulted parameter is a leftover from a dropped feature. The GB10 job fails in the same target (CMakeFiles/luce_common.dir/all] Error 2 right after compiling the qwen4exp sources; the excerpt doesn't show the exact line, but it is the same translation unit).

2. Missing header (Strix Halo gfx1151 and R9700 gfx1201 ROCm jobs). server/deps/llama.cpp/ggml/src/ggml-cuda/mmb.cu:41:10: fatal error: 'mmb-small-m.cuh' file not found. The include sits inside #if defined(__gfx1151__) || !defined(__HIP_DEVICE_COMPILE__) (mmb.cu:14), so it is only compiled in HIP builds, which is why the CUDA jobs never hit it. The file is absent from the repository (the tracked-files list has mmb-quant.cuh, mmb-q8f16.cuh, mmb.cuh but no mmb-small-m.cuh); the small-M path that needs it is referenced at mmb.cu:781. The branch was clearly built and benchmarked locally on gfx1151, so the header exists in the author's tree but was never git added.

Other things to try

  • Reproduce the overload error without a GPU: c++ -std=c++17 -I server/include -I server/src -I server/src/qwen4exp -I server/deps/llama.cpp/ggml/include -c server/src/qwen4exp/qwen4exp_graph.cpp.
  • If the second-device head offload is still planned, instead give the definition at qwen4exp_graph.cpp:1213 the 8th parameter and implement qwen4exp_head_offload_init/free; otherwise consider deleting the unused declaration entirely.
  • Add a pre-push habit or CI check for untracked files (git status --porcelain) so locally-added kernel headers can't be left out of a commit again.
Patch (1 file)

Not applied anywhere. To try it, save the diff as fix.patch and run git apply fix.patch.

diff --git a/server/src/qwen4exp/qwen4exp_graph.h b/server/src/qwen4exp/qwen4exp_graph.h
index f9ef357c..5cdb18fa 100644
--- a/server/src/qwen4exp/qwen4exp_graph.h
+++ b/server/src/qwen4exp/qwen4exp_graph.h
@@ -71,7 +71,7 @@ Qwen4ExpForwardResult qwen4exp_forward(ggml_backend_t backend,
                                        int n_tokens,
                                        int pos0,
                                        std::vector<float> & out_logits,
-                                       Qwen4ExpHeadOffload * head = nullptr);
+                                       Qwen4ExpHeadOffload * head);
 
 // Decode one next token for each independent slot. `caches[s]` owns that
 // sequence's KV and recurrent state; `tokens[s]` and `positions[s]` are never
Prompt for a coding agent
A GitHub Actions run failed in Luce-Org/lucebox. Please fix it.

- Pull request #774 (branch `feat/qwen4exp-strix-halo`), commit 0ba42220bb7af04ea97bc2d8977ff8acc9a427a3
- Workflow: CI (https://github.com/Luce-Org/lucebox/actions/runs/36567335346)
- Failed: Build Windows (MSVC + CUDA, library + server targets) › Build Windows targets; Build (cmake + uv sync --extra megakernel) › Build luce (smoke + server); GPU tests (Strix Halo Radeon 8060S, gfx1151 / ROCm) › Build + test ROCm formats and inference core; GPU tests (Radeon AI PRO R9700, gfx1201 / ROCm) › Build + test ROCm formats and inference core; GPU tests (self-hosted DGX GB10, sm_121 verifier) › Build focused NVIDIA verifier tests (sm_121)

Diagnosis:
Two independent compile breaks, both introduced by this PR.

**1. Ambiguous overload (Windows MSVC, Linux CUDA, and GB10 jobs).** `server/src/qwen4exp/qwen4exp_graph.h:67-74` declares `qwen4exp_forward(..., std::vector<float> & out_logits, Qwen4ExpHeadOffload * head = nullptr)`, while `server/src/qwen4exp/qwen4exp_graph.cpp:1213` defines the same name with only 7 parameters. A 7-argument call therefore matches both overloads. MSVC: `error C2668: 'luce::common::qwen4exp_forward': ambiguous call to overloaded function` at `qwen4exp_graph.cpp:1869` and `:2211`; GCC: `error: call of overloaded 'qwen4exp_forward(...)' is ambiguous` at the same lines. Nothing defines the 8-parameter overload or the declared `qwen4exp_head_offload_init/free`, and no caller passes a head argument, so the header's defaulted parameter is a leftover from a dropped feature. The GB10 job fails in the same target (`CMakeFiles/luce_common.dir/all] Error 2` right after compiling the qwen4exp sources; the excerpt doesn't show the exact line, but it is the same translation unit).

**2. Missing header (Strix Halo gfx1151 and R9700 gfx1201 ROCm jobs).** `server/deps/llama.cpp/ggml/src/ggml-cuda/mmb.cu:41:10: fatal error: 'mmb-small-m.cuh' file not found`. The include sits inside `#if defined(__gfx1151__) || !defined(__HIP_DEVICE_COMPILE__)` (`mmb.cu:14`), so it is only compiled in HIP builds, which is why the CUDA jobs never hit it. The file is absent from the repository (the tracked-files list has `mmb-quant.cuh`, `mmb-q8f16.cuh`, `mmb.cuh` but no `mmb-small-m.cuh`); the small-M path that needs it is referenced at `mmb.cu:781`. The branch was clearly built and benchmarked locally on gfx1151, so the header exists in the author's tree but was never `git add`ed.

Proposed fix: Remove the stray default argument in the header and commit the missing mmb-small-m.cuh kernel header.
1. In `server/src/qwen4exp/qwen4exp_graph.h`, drop `= nullptr` from the `qwen4exp_forward` declaration so 7-argument calls resolve only to the definition (patch below).
2. Commit the forgotten header from your local tree: `git add server/deps/llama.cpp/ggml/src/ggml-cuda/mmb-small-m.cuh && git commit -m "fix(ggml-cuda): add missing mmb-small-m.cuh"`.
3. Verify the overload fix: `cmake --build <build-dir> --target luce_common` (any platform).
4. Verify the HIP fix: configure with `-DLUCE_GPU_BACKEND=hip -DLUCE_HIP_ARCHITECTURES=gfx1151` and build `ggml-hip` so `mmb.cu` compiles.
5. Push and re-run the CI workflow.

Suggested patch (a starting point):
```diff
diff --git a/server/src/qwen4exp/qwen4exp_graph.h b/server/src/qwen4exp/qwen4exp_graph.h
index f9ef357c..5cdb18fa 100644
--- a/server/src/qwen4exp/qwen4exp_graph.h
+++ b/server/src/qwen4exp/qwen4exp_graph.h
@@ -71,7 +71,7 @@ Qwen4ExpForwardResult qwen4exp_forward(ggml_backend_t backend,
                                        int n_tokens,
                                        int pos0,
                                        std::vector<float> & out_logits,
-                                       Qwen4ExpHeadOffload * head = nullptr);
+                                       Qwen4ExpHeadOffload * head);
 
 // Decode one next token for each independent slot. `caches[s]` owns that
 // sequence's KV and recurrent state; `tokens[s]` and `positions[s]` are never
```

Check out that commit, confirm the diagnosis, make the fix (adjust it if the diagnosis is wrong), and re-run the failing step locally before pushing.

Reply with /ci-fix and what to change to get a revised diagnosis.

@dusterbloom
dusterbloom force-pushed the feat/qwen4exp-strix-halo branch from 0ba4222 to 63a364f Compare September 29, 2026 13:46
davide221 and others added 12 commits October 6, 2026 16:12
…e Strix Halo

The new GPU tests (QSA cell ids, indexer score, M-RoPE tail, MMB vs library
GEMM, vectorized convert, scalar get_rows, RMS_NORM+SCALE, pinned host
inputs, the mmid regression) were built by nothing in CI. They join the
ROCm job's build list and ctest filter on both devices; the gfx1151-only
ones skip on the R9700.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…t shadow

- ggml_cuda_mmb_cache_reserve (the only user of producer slot 0) and
  ggml_cuda_mmb_marks_clear had no callers.
- ggml_cuda_mmb_gatemix/blk16/res16 always returned the arch check (res16
  had no caller); the HC gate-mix and bf16-dst conditions no longer ask.
- The concat(w0, w1) BF16 shadow keyed on an IQ4_NL CONCAT of two resident
  weights: every qwen4exp ggml_concat is on activations, so it never matched.
- mmb_small_n_bf16_kernel served M <= 8 BF16 weights after mmb_small_m,
  which already takes every such weight here (K = 2560 or 10240, K % 512 == 0);
  other shapes fall through to the generic BF16 tile.
- The nested gfx1151 guards repeated the file-level one, and the
  mmb-small-m.cuh header pointed at a microbench that is not in the repo.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- ggml_cuda_hc_combine_norm_supported had no caller.
- The res_in_bf16 / blk_in_bf16 / res_out_bf16 args were never set, so the
  kernel's BF16 residual and block-output branches (and hc_lo/hc_hi) were
  dead.
- ggml_cuda_hc_combine_norm_ptrs repeated the args launch for the unmarked
  case. compute_forward now builds one args struct for all three cases
  (MoE, marked bf16-only xn, plain) and calls ggml_cuda_op_hc_combine_norm.

The plain path now asserts n_embd <= HC_CN_MAX_EMB like the MoE path, since
the kernel keeps one row of that many columns in registers.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
qsa_decode_partial only ran when the WMMA decode kernel's conditions failed:
GQA != 12 or a K cache view not 16-byte aligned. qwen4exp_graph.cpp builds
QSA only for n_head == 12 * n_head_kv, and its K/V are offset-0 views of the
F16 cache tensors (512-byte rows), so the WMMA kernel always took the call.
Those conditions now sit in ggml_cuda_flash_attn_ext_qsa_decode_supported;
anything else falls to the generic path, which refuses maskless sparse
attention with an assert instead of computing it on a second, unvalidated
kernel.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- mmb_routed_kernel / mmb_routed_glu_kernel: EXPERT_MAJOR was always false.
- mmb_f32split_kernel: TWO was always true, so the w_lo * x_hi product never
  ran; the weight's lo split, its LDS tile and its fragment loads go too, and
  the comment now says what the kernel computes (w rounded to F16, x as
  hi + lo).
- mmb_decode_slice<IQ4_NL> was never instantiated (IQ4_NL maps to WTYPE 0,
  which decodes through mmb_dq_row36).
- gdn_conv_enabled(), ple_conv_enabled() and hc16 were constant true.
- gdn_conv_direct_kernel: apply_silu was always true and the bias b always
  0 (now the same accumulation as ssm_conv); the match's silu field is gone.
- ggml_backend_cuda_get_gdn_tiled_launch_count had no declaration and no
  caller.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…elpers

The non-contracting F32 multiply/add pair existed four times (hc-cn, hc-mix,
MMB's gm_*, ple-conv), the unary.cu sigmoid four times (hc-cn, hc-mix, MMB,
gated-norm), the BF16 widen/narrow/pack helpers three times (hc_*, mmb_*,
mq_f2bf), and gdn_concat_tail was ple_concat_tail with H = 3. They now live
in qwen4exp-common.cuh as q4x_* (the concat tail as a template on H); the
expressions are unchanged.

hc-cn.cu, hc-mix.cu and mmb.cu are HIP-only (ggml-cuda/CMakeLists.txt drops
them from CUDA builds), so their copies' CUDA branches were dead; the header
keeps the __fmul_rn/__fadd_rn branch for ple-conv.cu, which CUDA compiles.
mmb-q8f16.cuh no longer claims to be self-contained for a microbench that is
not in the repo.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The ROPE->PERMUTE->CONT and RMS_NORM->SCALE fusions now need the qwen4exp
profile, so test_rope_tail's GPU position-alias case and
test_rms_norm_scale set it around their graphs; without it both sides of
the comparison took the unfused path and the tests passed vacuously.

The if(EXISTS) guards around test_mmb_cublas_diff, test_convert_vec and
test_getrows_scalar wrapped files this change adds, so they are gone.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
ggml_backend_cuda_graph_compute walked every node of every HIP graph to find
dense weights for the BF16 shadow, though ggml_cuda_mmb_supported_mm refuses
them without the qwen4exp profile. The loop now stops at once for other
models, as their graphs ran on main.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…rt serves

With plenty of free memory the chunk planner picked 84K-92K rows, so a 55K
prompt went through as one chunk. The gfx1151 MoE route sort only serves
4097-32768 tokens; past that MUL_MAT_ID falls back to the generic id helper,
whose shared memory holds 4 bytes per token, and the server aborted at
mmid.cu (GGML_ASSERT(nbytes_shared <= smpbo)). On a busy box the planner had
picked ~28K rows, which hid it. qwen4exp_fit_chunk now stops at 32768.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@davide221

Copy link
Copy Markdown
Contributor

Pushed fixes and a cleanup onto this branch, merged with main through #815:

  • Other models keep main's behaviour: device reporting, the GDN kernel choice, shared fusions and graph checks.
  • Removed test-only modes, dead knobs and APIs, the reference profile, the scalar QSA decode kernel and the mul_mat_id inverse-map mode. The fused kernels share one helper header.
  • Prompt chunks stop at 32768 tokens, the most the gfx1151 MoE route sort serves. With plenty of free memory the planner picked about 90K, and a 55K prompt aborted in mmid.cu.
  • CI builds and runs the qwen4exp kernel tests on the R9700 and the Strix Halo.

Checked on a Ryzen AI Max + R9700 box: all units pass (one skips by design) and the Qwen bench gets 6/6, including the 55K prompt (1,356 tok/s prefill). DeepSeek V4.1 output is byte-identical to main, and decode is within run-to-run noise.

🤖 Generated with Claude Code

davide221 and others added 2 commits October 7, 2026 11:52
No Qwen3.8-Flash-Next GGUF uses Q2_0 (UD-Q4_K_XL, IQ4_NL and IQ3_XXS do
not), and adding it renumbered the existing TQ3_0 KV cache type from 42
to 43, which needed a disk prefix cache version bump. Remove the type,
its CPU and CUDA/HIP kernels, the MMB decode branch and the test entry,
and restore TQ3_0 = 42 and DISK_CACHE_VERSION = 2 as on main.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
park() freed the weights but kept the backend, so the bf16 shadows (up
to 6 GiB) stayed allocated while parked. They are keyed by weight
address, and unpark() reloads the weights: a weight landing at an
address that held another one would read that one's shadow.
ggml_backend_cuda_trim_pool now also releases the MMB caches and
shadows (allocated from the pools it trims), and park() trims.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@davide221

Copy link
Copy Markdown
Contributor

Two more fixes:

  • Dropped the Q2_0 type. None of the Qwen3.8-Flash-Next GGUFs use it, and adding it moved TQ3_0 from id 42 to 43, which needed a disk cache version bump. TQ3_0 is back at 42 and the cache version is back to 2, both as on main.
  • park() freed the weights but kept the bf16 MMB shadows (up to 6 GiB). They are keyed by weight address, so after unpark() a weight landing at another one's old address would read that weight's shadow. ggml_backend_cuda_trim_pool now also releases the MMB caches and shadows, and park() trims.

Checked on a Ryzen AI Max + R9700 box:

  • Units pass.
  • Greedy outputs are byte-identical before and after, on UD-Q4_K_XL and on IQ4_NL (the quant that builds the shadows), at the same speed. The temperature-0.6 thinking prompt differs from run to run, as it always does.
  • DeepSeek V4.1 output is unchanged.

Not changed here: the shape list in ggml_cuda_mmb_cublas_shape_ok. It also decides which activations are stored only as bf16, so replacing it needs a rule measured across quants. That fits a follow-up that makes MMB a backend path for any model rather than a qwen4exp mode.

🤖 Generated with Claude Code

davide221 and others added 3 commits October 7, 2026 12:03
# Conflicts:
#	server/test/unit/test_rope_tail.cpp
The MMB sources are built for HIP only, so a CUDA build has no
ggml_cuda_mmb_release_all and test_server_unit failed to link on the
DGX runner. Guard the call the way ggml_backend_cuda_free does.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Reverts 98b69d7. Upstream ggml numbers Q2_0 as type 42, and the
ISTA-DASLab Qwen3.8-Flash-Next GSQ-RCO GGUFs store tensors with it
(IQ3_S: 9 routed-expert tensors, Q2_0: 202). With TQ3_0 at 42 those
tensors would load as the wrong type. TQ3_0 is a KV cache type that no
GGUF stores, so it stays at 43 with the disk cache version at 3.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@davide221

Copy link
Copy Markdown
Contributor

Correction to my earlier comment: Q2_0 is needed. The ISTA-DASLab GSQ-RCO GGUFs store tensors as type 42, upstream's Q2_0 (IQ3_S has 9 routed-expert tensors, Q2_0 has 202). With TQ3_0 at 42 they would load as the wrong type. e4a7157 restores it: Q2_0 at 42, TQ3_0 at 43, disk cache version 3, as you had it. The park fix and the CUDA guard stay. Validating GSQ-RCO IQ3_S on the box now.

🤖 Generated with Claude Code

@davide221
davide221 merged commit c320db9 into Luce-Org:main Oct 7, 2026
8 checks passed
davide221 added a commit to dusterbloom/lucebox-hub that referenced this pull request Oct 7, 2026
Merging main back in restored what Luce-Org#774 removed from the backend: the
reference/upstream mode, the dump instrumentation, qsa_rebuild_reference,
the float qsa_cell_ids fallback, docs/handoffs/ and
scripts/qwen4exp_forward_diff.py. This keeps MTP (sidecar loading, the
draft and verify graphs and workspaces, adaptive width, rollback, stable
QSA decode reuse, fused QSA cell ids, server and feature-gate changes) on
main's single path:
- the MTP draft graph uses the default path; verify no longer checks a
  reference cache and requires at most one PLE layer (the rollback
  snapshot covers one PLE state; every published GGUF has one);
- the loader is main's plus sidecar loading and the PLE image token id
  the draft vocabulary needs;
- the smoke test's --stable compares the replayed stable QSA graph with a
  fresh graph each step; the MTP profile test restores to the generic mode.

Units pass on the R9700 and the Strix Halo (test_qwen4exp_mtp: 4236
cases). UD-Q4_K_XL on the Strix Halo, MTP off -> on: code decode 22.3 ->
40.4 tok/s (accept 0.84), thinking 22.4 -> 34.8, 16K prose 20.1 -> 26.8;
greedy outputs identical; 6/6 checks; prefill 5-13% lower (draft-layer
K/V fill). DeepSeek V4.1 output unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
dusterbloom added a commit to dusterbloom/lucebox-hub that referenced this pull request Oct 8, 2026
Squashed onto main after Luce-Org#774's squash-merge. Per-commit history:
dusterbloom/lucebox-hub branch history/qwen4exp-concurrency-20261008.

Commits:
- Revert "refactor(qwen4exp): retire the experimental independent-slot concurrency"
- fix(qwen4exp): keep multi-slot decode on the QSA reference path
- fix(ggml-cuda): range-check the RoPE->PERMUTE->CONT fusion against its inputs
- refactor(qwen4exp): batch-invariant multi-slot decode, per-slot prefill
- perf(qwen4exp): prefill each slot at the backend chunk size
- test(qwen4exp): expect scoped profile restoration after concurrency override
dusterbloom added a commit to dusterbloom/lucebox-hub that referenced this pull request Oct 8, 2026
Squashed onto main after Luce-Org#774's squash-merge. Per-commit history:
dusterbloom/lucebox-hub branch history/qwen4exp-greedy-shared-overlap-20261008.

Commits:
- feat(qwen4exp): opt in to CPU-first GPU argmax for T1 decode
- perf(qwen4exp): add scoped shared-expert overlap foundation
- perf(qwen4exp): default to guarded GPU argmax on gfx1151
davide221 pushed a commit that referenced this pull request Oct 8, 2026
Squashed onto main after #774's squash-merge. Per-commit history:
dusterbloom/lucebox-hub branch history/qwen4exp-mtp-20261008.

Commits:
- perf(ggml): fuse QSA block sorting and cell expansion
- perf(qwen4exp): use fused QSA cell IDs after top-k
- docs(qwen4exp): plan stable bucketed QSA decode
- perf(qwen4exp): reuse QSA decode graphs between pooling steps
- perf(qwen4exp): reuse QSA decode graphs across complete KV buckets
- feat(qwen4exp): MTP speculative decoding on the QSA speed branch
- feat(qwen4exp): draft up to four MTP tokens per step
- fix(qwen4exp): keep MTP verify batch-invariant up to eight rows
- feat(qwen4exp): adaptive MTP draft width through the shared spec-width policy
- fix(qwen4exp): clear MTP sidecar pointers on teardown and load failure
- docs(qwen4exp): drop the obsolete delivery footer from the MTP handoff
- fix(qwen4exp): validate every MTP sidecar tensor shape before graph build
- refactor(qwen4exp): simplify the PLE tail helper to a slice of seq
- chore(qwen4exp): delete the unused chat() wrapper in forward_diff script
- refactor(qwen4exp): inline the two-field stable_kv_span wrapper
- refactor(qwen4exp): drop the temporary upload_layers pointer vector
- perf(qwen4exp): fill only the MTP layer's K/V during prompt prefill
- perf(qwen4exp): fill the MTP K/V inside the trunk prefill graph
- fix(qwen4exp): wait for pending rollback copies before resetting state
- perf(qwen4exp): cheaper MTP drafts and up to seven of them
- fix(qwen4exp): keep the adaptive MTP width stable
- fix(server): accept qwen4exp fixed verify widths up to eight
- docs(qwen4exp): describe the seven-draft adaptive MTP in the guide
- test(qwen4exp): accept fixed verify widths up to eight in the gate test
- test(qwen4exp): prefill the MTP rollback check in chunks
- fix(qwen4exp): adapt MTP reference tests to current graph APIs
- test(qwen4exp): check MTP profile restore against generic mode
- fix(ggml-cuda): guard HIP-only MMB teardown
- feat(qwen4exp): Qwen3.8-Flash-Next backend — parity, prefill/decode perf (#774)
- refactor(qwen4exp): MTP on the cleaned-up backend from #774
davide221 pushed a commit to dusterbloom/lucebox-hub that referenced this pull request Oct 8, 2026
Squashed onto main after Luce-Org#774's squash-merge. Per-commit history:
dusterbloom/lucebox-hub branch history/qwen4exp-prefix-cache-20261008.

Commits:
- feat(qwen4exp): reuse cached prompt prefixes across requests
- fix(ci): keep the renamed mmid target in the prefix stack
- test(qwen4exp): cover model park reload lifecycle
- fix(ci): restore the DS4 fused GPU test target
- fix(ci): restore DS4.1 width-invariance target
davide221 pushed a commit to dusterbloom/lucebox-hub that referenced this pull request Oct 8, 2026
Squashed onto main after Luce-Org#774's squash-merge. Per-commit history:
dusterbloom/lucebox-hub branch history/qwen4exp-concurrency-20261008.

Commits:
- Revert "refactor(qwen4exp): retire the experimental independent-slot concurrency"
- fix(qwen4exp): keep multi-slot decode on the QSA reference path
- fix(ggml-cuda): range-check the RoPE->PERMUTE->CONT fusion against its inputs
- refactor(qwen4exp): batch-invariant multi-slot decode, per-slot prefill
- perf(qwen4exp): prefill each slot at the backend chunk size
- test(qwen4exp): expect scoped profile restoration after concurrency override
davide221 pushed a commit that referenced this pull request Oct 8, 2026
* feat(qwen4exp): reuse cached prompt prefixes across requests

Squashed onto main after #774's squash-merge. Per-commit history:
dusterbloom/lucebox-hub branch history/qwen4exp-prefix-cache-20261008.

Commits:
- feat(qwen4exp): reuse cached prompt prefixes across requests
- fix(ci): keep the renamed mmid target in the prefix stack
- test(qwen4exp): cover model park reload lifecycle
- fix(ci): restore the DS4 fused GPU test target
- fix(ci): restore DS4.1 width-invariance target

* feat(qwen4exp): exact 4-slot concurrent serving

Squashed onto main after #774's squash-merge. Per-commit history:
dusterbloom/lucebox-hub branch history/qwen4exp-concurrency-20261008.

Commits:
- Revert "refactor(qwen4exp): retire the experimental independent-slot concurrency"
- fix(qwen4exp): keep multi-slot decode on the QSA reference path
- fix(ggml-cuda): range-check the RoPE->PERMUTE->CONT fusion against its inputs
- refactor(qwen4exp): batch-invariant multi-slot decode, per-slot prefill
- perf(qwen4exp): prefill each slot at the backend chunk size
- test(qwen4exp): expect scoped profile restoration after concurrency override
davide221 added a commit that referenced this pull request Oct 12, 2026
The :rocm image was the only build still on ROCm 6.4.1; the Lucebox boxes
and the AMD CI runner build and test on 7.2.4, and the README lists ROCm
7.2 for both supported AMD GPUs. Every main push since 10-07 failed it:

- mmid.cu calls __syncwarp() (#774), which ROCm 6 declares only on opt-in.
- The DS4 indexer's tokenwise path (#827) called the WMMA decode kernel
  outside the rocWMMA 2.x guard, and ROCm 6.4 ships rocWMMA 1.x.

The image now uses ROCm 7.2.4 on Ubuntu 24.04: ROCm 7.2's CMake package
files need CMake 3.25 or newer, and 22.04 ships 3.22. 24.04 has a Python
3.12 of its own, so uv is told to keep its managed build under /opt/uv,
as in the CUDA image. The tokenwise call moves inside the guard, so a
source build without rocWMMA 2.x compiles again; every score then takes
the scalar kernel, one token each.

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants