Skip to content

quantize: row-chunks stream to avoid thread starvation - #27830

Merged
ngxson merged 1 commit into
masterfrom
xsn/quant_stream
Sep 1, 2026
Merged

quantize: row-chunks stream to avoid thread starvation#27830
ngxson merged 1 commit into
masterfrom
xsn/quant_stream

Conversation

@ngxson

@ngxson ngxson commented Aug 27, 2026

Copy link
Copy Markdown
Collaborator

Overview

Alternative solution to #27770

Original idea taken from https://github.com/ngxson/quant-studio

"Stream" here means: tensor is split into row-slabs --> each slab is split into row-chunks --> chunks fed into thread

It's not real streaming like what quant-studio does (no overlap between I/O, dequant and quantization), but pretty close, without invasive changes to the existing code base

Work size limit from #27795 is still being respected

Requirements

@ngxson ngxson changed the title quantize: row-slab stream to avoid thread starvation quantize: row-chunks stream to avoid thread starvation Aug 27, 2026
@bartowski1182

Copy link
Copy Markdown
Contributor

Tested this out and got identical sha256sum and 20-70% speed up depending on the tensor type when using 64 threads! LGTM!

@ngxson
ngxson marked this pull request as ready for review August 31, 2026 23:26
@ngxson
ngxson requested a review from ggerganov as a code owner August 31, 2026 23:26
@ngxson
ngxson requested a review from ServeurpersoCom August 31, 2026 23:26
@ngxson
ngxson merged commit 1b89a43 into master Sep 1, 2026
24 of 26 checks passed
fewtarius added a commit to fewtarius/CachyLLama that referenced this pull request Sep 1, 2026
Merge upstream commits preserving all CachyLLama features:
- CachyLLama Lightning Indexer shader + DSV4_HC pre/comb/post (kept over
  upstream cb30059's li_dict variant - c22b79e already removed the dup)
- FA dequant-once scratch with host-RAM safety gate (q8_0/q4_0/q4_1/q5_0/q5_1)
- concat_transpose shader (delta-net dim-0)
- mmid_row_lists prepass + padded_N + use_row_lists (coexist with upstream's
  n_experts + hoist_row_ids; both push_constant fields kept in struct and
  mul_mm.comp / mul_mmq.comp dispatch tries row_lists first, then hoisted,
  then dense)
- MoE expert residency tracking + observability (CLI args, fields, debug)
- DFlash framework: decoder_laguna gate, embeddings_nextn post-final-layer
  lookup, dflash_conv/DFlash2 (selector + p_min)
- DSpark (Nemotron) attn_sinks
- Upstream's spec : fuse the DFlash encoder into the KV cache injection
  (ggml-org#27310) replaces the HEAD's two-step llama_encode + llama_decode path
  with a fused single llama_decode. Same encoder (fc + norm) runs inline
  as part of the decode graph. EAGLE3/MTP encode path (separate code in
  common_speculative_impl_draft_eagle3) is untouched.
- Laguna-S-2.1 model
- User isolation (user_id, conv_hash, slot affinity)
- SSD-backed KV cache and page manager
- Context checkpoint ring buffer with insertion-order eviction
- --lazy-mode (upstream rename of CachyLLama's --tensor-read-lazy)
- kv_unified_per_slot (upstream, additive)
- nvfp4 scales to attention ops (ggml-org#28000)
- quantize: row-slab stream to avoid thread starvation (ggml-org#27830)
- test-save-load-state across all architectures (ggml-org#27755)
- test-archs verbosity fix (ggml-org#28147)

Verified:
- llama-server builds clean
- test-save-load-state passes (38s) after rebuild
- DSV4_HC_COMB shaders all pass
- Pre-existing failures unchanged (minimax-m3/01 numerical tolerance,
  test-recurrent-state-rollback)
fewtarius pushed a commit to fewtarius/CachyLLama that referenced this pull request Sep 5, 2026
thecodacus pushed a commit to thecodacus/llama.cpp that referenced this pull request Sep 7, 2026
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