Skip to content

fix compile error on centos 7.5 - #226

Closed
leaout wants to merge 1 commit into
ggml-org:masterfrom
leaout:master
Closed

leaout wants to merge 1 commit into
ggml-org:masterfrom
leaout:master

Conversation

@leaout

@leaout leaout commented Mar 17, 2023

Copy link
Copy Markdown

No description provided.

Comment thread Makefile
endif

ifneq ($(CC), gcc)
CC=gcc

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the person running make really wants to use a different CC, wouldn’t this override them? Have you tried using CMake instead?

@leaout leaout closed this Mar 17, 2023
@leaout

leaout commented Mar 17, 2023

Copy link
Copy Markdown
Author

Of course cmake worked

phuongncn pushed a commit to phuongncn/llama.cpp-gx10-dgx-sparks-deepseekv4 that referenced this pull request Apr 28, 2026
wywen added a commit to wywen/llama.cpp that referenced this pull request Jul 12, 2026
* llama : expose llama_get_sched() in the C API

Add a public C-API accessor returning a context's ggml_backend_sched_t, so
downstream callers can enumerate per-backend compute buffer sizes via the
existing public ggml_backend_sched_* API (memory observability).

Thin wrapper over the existing llama_context::get_sched(); no behavior change.

Carried as a titanium-chicken fork patch on top of b9828.

* ggml-backend : expose ggml_backend_sched_get_graph() in the C API

Returns the scheduler's current compute graph (the one split during
ggml_backend_sched_reserve, which llama runs at context construction).
Its nodes are in execution order with per-node backend assignments
queryable via ggml_backend_sched_get_tensor_backend, enabling read-only
compute-order/placement inspection without running a forward pass.

Sibling to the existing llama_get_sched() patch (titanium-chicken fork).

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

* metal: persistent pointer-keyed boundary-event schedule for paged decode (ggml-org#226)

Add a persistent, pointer-keyed boundary-event schedule to the Metal backend so
an engine can drive async event-fenced KV residency without a per-boundary GPU
host drain (the cb_eval ggml_backend_synchronize that dominates paged decode).

- ggml_metal_set_boundary_schedule(): register cut nodes (each optionally
  signalling an event after its command buffer) and wait nodes (each waiting on
  an event before its segment), keyed by ggml_tensor* POINTER. PERSISTENT: it
  applies to every graph_compute until cleared (n_cuts==0), so it covers all of
  ggml_backend_sched's splits within one llama_decode and the reused graph of
  later tokens; pointer matching is robust to split-vs-full-graph index skew.
  n_cuts==0 leaves the stock n_cb encode path untouched.
- ggml_metal_graph_compute_paged(): sequential per-boundary-committed encode
  (no dispatch_apply) that, for whichever schedule nodes appear in the graph it
  is handed, emits encodeSignalEvent after each boundary's command buffer and
  encodeWaitForEvent before an admitted region's first-reader segment. Reuses
  ggml_metal_op per segment (fusion preserved). A graph with no schedule nodes
  encodes as one segment.
- Explicit-value event primitives: ggml_metal_event_encode_{signal,wait}_value
  and host-side ggml_metal_event_host_{signal,wait,value} so an engine
  reclaim/prefetch thread can coordinate an MTLSharedEvent across threads.
- ggml_metal_get_device(): the backend's own device (ggml_metal_device_get()
  returns a fresh, unrelated device each call, whose events never reach the
  queue) -- callers must init boundary events on this device.

Verified by a standalone probe over a real ggml-metal graph: the segmented
encode is bit-identical to the stock encode, every per-boundary signal fires
progressively, and an admit wait fences real GPU work until a concurrent host
signal from a long-lived thread releases it.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01PR4CoRiTG8d5YfpjumYJSS

* wip(metal): signal boundary events on cmd-buffer completion (ggml-org#226)

Adds ggml_metal_event_signal_on_complete: a host reclaim thread waiting
the boundary event must see coherent shared-storage KV bytes, so signal
from the completion handler rather than mid-stream. Separate WIP commit
on top of the seam (542d159) to preserve; squash when formalizing the
fork PR. Had zero effect on the paging bit-identity bug (keep-or-drop).

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01PR4CoRiTG8d5YfpjumYJSS

* feat(metal): public boundary-event schedule + event API for paged decode

Exposes ggml_backend_metal_set_boundary_schedule plus the
ggml_backend_metal_event_* primitives so an engine can drive
fusion-preserving, event-fenced KV paging instead of a whole-graph
host synchronize at each cut.

Claude-Session: https://claude.ai/code/session_01GWUngsbi1CQNi4cBrmNFCG

Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>

* Update llama.h ti remove comment

* metal: trim declaration comments, drop external references

Remove the multi-line block comments above the newly-added forward
declarations to match the terse style of the surrounding headers, and
strip references to external trackers/repositories from the remaining
in-body comments.

---------

Co-authored-by: Yi Wen Wong <[email protected]>
Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
wywen added a commit to wywen/llama.cpp that referenced this pull request Jul 22, 2026
…#8)

* metal: persistent pointer-keyed boundary-event schedule for paged decode (ggml-org#226)

Add a persistent, pointer-keyed boundary-event schedule to the Metal backend so
an engine can drive async event-fenced KV residency without a per-boundary GPU
host drain (the cb_eval ggml_backend_synchronize that dominates paged decode).

- ggml_metal_set_boundary_schedule(): register cut nodes (each optionally
  signalling an event after its command buffer) and wait nodes (each waiting on
  an event before its segment), keyed by ggml_tensor* POINTER. PERSISTENT: it
  applies to every graph_compute until cleared (n_cuts==0), so it covers all of
  ggml_backend_sched's splits within one llama_decode and the reused graph of
  later tokens; pointer matching is robust to split-vs-full-graph index skew.
  n_cuts==0 leaves the stock n_cb encode path untouched.
- ggml_metal_graph_compute_paged(): sequential per-boundary-committed encode
  (no dispatch_apply) that, for whichever schedule nodes appear in the graph it
  is handed, emits encodeSignalEvent after each boundary's command buffer and
  encodeWaitForEvent before an admitted region's first-reader segment. Reuses
  ggml_metal_op per segment (fusion preserved). A graph with no schedule nodes
  encodes as one segment.
- Explicit-value event primitives: ggml_metal_event_encode_{signal,wait}_value
  and host-side ggml_metal_event_host_{signal,wait,value} so an engine
  reclaim/prefetch thread can coordinate an MTLSharedEvent across threads.
- ggml_metal_get_device(): the backend's own device (ggml_metal_device_get()
  returns a fresh, unrelated device each call, whose events never reach the
  queue) -- callers must init boundary events on this device.

Verified by a standalone probe over a real ggml-metal graph: the segmented
encode is bit-identical to the stock encode, every per-boundary signal fires
progressively, and an admit wait fences real GPU work until a concurrent host
signal from a long-lived thread releases it.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01PR4CoRiTG8d5YfpjumYJSS

* wip(metal): signal boundary events on cmd-buffer completion (ggml-org#226)

Adds ggml_metal_event_signal_on_complete: a host reclaim thread waiting
the boundary event must see coherent shared-storage KV bytes, so signal
from the completion handler rather than mid-stream. Separate WIP commit
on top of the seam (542d159) to preserve; squash when formalizing the
fork PR. Had zero effect on the paging bit-identity bug (keep-or-drop).

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01PR4CoRiTG8d5YfpjumYJSS

* feat(metal): public boundary-event schedule + event API for paged decode

Exposes ggml_backend_metal_set_boundary_schedule plus the
ggml_backend_metal_event_* primitives so an engine can drive
fusion-preserving, event-fenced KV paging instead of a whole-graph
host synchronize at each cut.

Claude-Session: https://claude.ai/code/session_01GWUngsbi1CQNi4cBrmNFCG

Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>

* Update llama.h ti remove comment

* metal: trim declaration comments, drop external references

Remove the multi-line block comments above the newly-added forward
declarations to match the terse style of the surrounding headers, and
strip references to external trackers/repositories from the remaining
in-body comments.

* metal: check for NULL from ggml_metal_buffer_init / _map (#6)

ggml_metal_buffer_init returns NULL when the buffer allocation or the
residency set fails, but ggml_backend_metal_buffer_type_alloc_buffer
passed the result straight to ggml_metal_buffer_is_shared, which
dereferences it at ->is_shared (offset 0x10). An allocation failure that
ggml already logs and handles became a SIGSEGV.

ggml-alloc.c already treats a NULL from alloc_buffer as a recoverable
failure, so returning NULL is the expected contract.

ggml_backend_metal_device_buffer_mapped had the same unchecked pattern
around ggml_metal_buffer_map. That one built a buffer with a NULL
context instead of faulting immediately; llama-model.cpp already checks
the result for nullptr.

Assisted-by: Claude Opus 4.8

Co-authored-by: Yi Wen Wong <[email protected]>

* metal: encode window over the paged (boundary-scheduled) compute path

While a boundary schedule is set, an optional encode window restricts
ggml_metal_graph_compute_paged to the segments intersecting an inclusive
[first_node, last_node] range, matched by pointer per graph like the
schedule's own cut/wait nodes (a graph containing neither endpoint
encodes in full). Optional blit pairs move a boundary activation into
the window's first encoded segment (before its ops, after its schedule
waits) and out of its last (after its ops) as device-side blits between
resident tensors -- no host round trip. Persistent until cleared;
cleared state is byte-identical to the pre-window paged path.

---------

Co-authored-by: Yi Wen Wong <[email protected]>
Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
ckti pushed a commit to ckti/llama.cpp-consolidated that referenced this pull request Aug 4, 2026
…gml-org#249)

Mirrors ggml-org#226's CUDA CMakeLists addition into ggml-hip: the four mixed
f16/bf16 + q8_0 vec instances were dispatched by the runtime selector but
absent from the HIP instance list after the ggml-org#244 rebase, so any default
HIP build failed to link (undefined ggml_cuda_flash_attn_ext_vec_case
references). Reported and locally validated by @Chris-behind-door.
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Oct 26, 2026
…r, QSA/indexer)

The qwen4exp (Qwen3.8-Flash-Next) architecture support, split out of the old
block 10 (r109) so the model graph, the sparse-attention op and the
hyper-connections no longer share a commit with the slab, the fusion dispatcher
and the async input ring.  The tree is unchanged: block 10 plus this commit is
exactly what the old block 10 carried.

Contents:

- src/models/qwen4exp.cpp: the model, the HC (hyper-connection) graph, the MTP
  draft head, the PLE gather, the QSA selection/attention graph
  (build_qsa_store_k / build_qsa_top_k / build_attn_qsa) and the QSA arm policy.
- QSA/indexer: fattn-qsa.{cu,cuh}, fattn-qsa3.cu, indexer-score.{cu,cuh},
  indexer-topk.{cu,cuh}, the 4-head WMMA indexer scorer in lightning-indexer.cu,
  with the CUDA dispatch (GGML_OP_FLASH_ATTN_QSA / INDEXER_TOPK / INDEXER_SCORE /
  INDEXER_FILL) and their CPU references; the keys-only indexer cache
  (LLAMA_QSA_KEYS_ONLY, no V tensor at all) in llama-memory-hybrid-idx and the
  v_enabled parameter on llama_kv_cache.
- HC ops GGML_OP_HC_MIX / HC_COMBINE (dispatch, supports_op, the Meta split
  states, the hc_combine_mix / hc_mix / hc_combine_norm / hc_gate_mix fusion
  arms and the HC16 planar layout) in hc-mix.{cu,cuh} and hyperconn.{cu,cuh}.
- The managed lazy reader (llama-lazy-reader) and the loader's managed_budget
  (LLAMA_LAZY_BUF_MB, TENSOR_SKIP_MANAGED, lazy_read::add_range) for the PLE
  n-gram table; off by default (it measured slower than both the mmap and the
  resident path on gfx1151).
- The QSA/HC op definitions in ggml.h / ggml.c, the scheduler op allowlists, the
  CPU references, and the qwen4exp tensor-split arch gate in llama-arch.cpp (with
  the ggml-hip CMakeLists publishing GGML_USE_HIP to the main libraries so the
  dynamic-backend build reads it).
- The qwen4exp MTP draft context gets a hybrid-idx memory instead of a plain KV
  cache (LLAMA_MTP_SPARSE=0 restores the dense draft), and llama_memory_recurrent
  stops warning about the speculative verify positions for a context whose
  recurrent filter matches nothing.
- Loader/user-path fix: TENSOR_READ_LAZY is only consulted when the loader has
  files (the llama_model_init_from_user path has nothing to lazy-read from).
- The qwen4exp-family fusion arms that live in this block's own TUs, and the
  graph-optimizer passes they need: the HC_BLK16/RES16 BF16-stream marks and
  their alloc deps, and the prefill indexer relu-sum alloc dep.
- Tests: test-hc-mix and test_flash_attn_qsa in test-backend-ops (the QSA CPU
  oracle: `test-backend-ops -o FLASH_ATTN_QSA`, 18/18 minimum), test-lazy-reader,
  and the lazy_buf_size handover in test-llama-archs.

Split note (r109): the infrastructure this block is built on -- the slab, the
fusion dispatcher TU, the async input ring, the GDN/MMB/HC16 kernel work -- is
block 10 and is listed there.  A qwen4exp-only change that is implemented inside
a general kernel TU (the GDN gate/beta BF16 fusion, the HC16 MMB BF16 streams,
the weighted-down reduction, the PLE conv fusion) deliberately stays with that
TU in block 10; only the code that needs this block's own symbols is here.

- The separate-tensor (pre-ggml-org#31028) HC mixer emits its inject product right
  behind the down product, i.e. adjacent in the graph, and expands both: the two
  BF16 GEMMs read the same F32 `xn`, and the CUDA BF16 src1 cache (block 10)
  only holds one converted tensor.  ggml-org#31028's ordering (inject last, after the
  gate product whose src1 is the silu output, which evicts the entry) converted
  the whole [hc*n_embd, n_tok] tensor twice per mixer -- measured on Flash-Next
  GSQ-IQ3_XXS as 2x the F32->BF16 `convert_unary_cont_vec4` launches and +3.4 %
  prefill when restored (issue ggml-org#226 follow-up).
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Oct 26, 2026
…r, QSA/indexer)

The qwen4exp (Qwen3.8-Flash-Next) architecture support, split out of the old
block 10 (r109) so the model graph, the sparse-attention op and the
hyper-connections no longer share a commit with the slab, the fusion dispatcher
and the async input ring.  The tree is unchanged: block 10 plus this commit is
exactly what the old block 10 carried.

Contents:

- src/models/qwen4exp.cpp: the model, the HC (hyper-connection) graph, the MTP
  draft head, the PLE gather, the QSA selection/attention graph
  (build_qsa_store_k / build_qsa_top_k / build_attn_qsa) and the QSA arm policy.
- QSA/indexer: fattn-qsa.{cu,cuh}, fattn-qsa3.cu, indexer-score.{cu,cuh},
  indexer-topk.{cu,cuh}, the 4-head WMMA indexer scorer in lightning-indexer.cu,
  with the CUDA dispatch (GGML_OP_FLASH_ATTN_QSA / INDEXER_TOPK / INDEXER_SCORE /
  INDEXER_FILL) and their CPU references; the keys-only indexer cache
  (LLAMA_QSA_KEYS_ONLY, no V tensor at all) in llama-memory-hybrid-idx and the
  v_enabled parameter on llama_kv_cache.
- HC ops GGML_OP_HC_MIX / HC_COMBINE (dispatch, supports_op, the Meta split
  states, the hc_combine_mix / hc_mix / hc_combine_norm / hc_gate_mix fusion
  arms and the HC16 planar layout) in hc-mix.{cu,cuh} and hyperconn.{cu,cuh}.
- The managed lazy reader (llama-lazy-reader) and the loader's managed_budget
  (LLAMA_LAZY_BUF_MB, TENSOR_SKIP_MANAGED, lazy_read::add_range) for the PLE
  n-gram table; off by default (it measured slower than both the mmap and the
  resident path on gfx1151).
- The QSA/HC op definitions in ggml.h / ggml.c, the scheduler op allowlists, the
  CPU references, and the qwen4exp tensor-split arch gate in llama-arch.cpp (with
  the ggml-hip CMakeLists publishing GGML_USE_HIP to the main libraries so the
  dynamic-backend build reads it).
- The qwen4exp MTP draft context gets a hybrid-idx memory instead of a plain KV
  cache (LLAMA_MTP_SPARSE=0 restores the dense draft), and llama_memory_recurrent
  stops warning about the speculative verify positions for a context whose
  recurrent filter matches nothing.
- Loader/user-path fix: TENSOR_READ_LAZY is only consulted when the loader has
  files (the llama_model_init_from_user path has nothing to lazy-read from).
- The qwen4exp-family fusion arms that live in this block's own TUs, and the
  graph-optimizer passes they need: the HC_BLK16/RES16 BF16-stream marks and
  their alloc deps, and the prefill indexer relu-sum alloc dep.
- Tests: test-hc-mix and test_flash_attn_qsa in test-backend-ops (the QSA CPU
  oracle: `test-backend-ops -o FLASH_ATTN_QSA`, 18/18 minimum), test-lazy-reader,
  and the lazy_buf_size handover in test-llama-archs.

Split note (r109): the infrastructure this block is built on -- the slab, the
fusion dispatcher TU, the async input ring, the GDN/MMB/HC16 kernel work -- is
block 10 and is listed there.  A qwen4exp-only change that is implemented inside
a general kernel TU (the GDN gate/beta BF16 fusion, the HC16 MMB BF16 streams,
the weighted-down reduction, the PLE conv fusion) deliberately stays with that
TU in block 10; only the code that needs this block's own symbols is here.

- The separate-tensor (pre-ggml-org#31028) HC mixer emits its inject product right
  behind the down product, i.e. adjacent in the graph, and expands both: the two
  BF16 GEMMs read the same F32 `xn`, and the CUDA BF16 src1 cache (block 10)
  only holds one converted tensor.  ggml-org#31028's ordering (inject last, after the
  gate product whose src1 is the silu output, which evicts the entry) converted
  the whole [hc*n_embd, n_tok] tensor twice per mixer -- measured on Flash-Next
  GSQ-IQ3_XXS as 2x the F32->BF16 `convert_unary_cont_vec4` launches and +3.4 %
  prefill when restored (issue ggml-org#226 follow-up).
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Oct 26, 2026
…r, QSA/indexer)

The qwen4exp (Qwen3.8-Flash-Next) architecture support, split out of the old
block 10 (r109) so the model graph, the sparse-attention op and the
hyper-connections no longer share a commit with the slab, the fusion dispatcher
and the async input ring.  The tree is unchanged: block 10 plus this commit is
exactly what the old block 10 carried.

Contents:

- src/models/qwen4exp.cpp: the model, the HC (hyper-connection) graph, the MTP
  draft head, the PLE gather, the QSA selection/attention graph
  (build_qsa_store_k / build_qsa_top_k / build_attn_qsa) and the QSA arm policy.
- QSA/indexer: fattn-qsa.{cu,cuh}, fattn-qsa3.cu, indexer-score.{cu,cuh},
  indexer-topk.{cu,cuh}, the 4-head WMMA indexer scorer in lightning-indexer.cu,
  with the CUDA dispatch (GGML_OP_FLASH_ATTN_QSA / INDEXER_TOPK / INDEXER_SCORE /
  INDEXER_FILL) and their CPU references; the keys-only indexer cache
  (LLAMA_QSA_KEYS_ONLY, no V tensor at all) in llama-memory-hybrid-idx and the
  v_enabled parameter on llama_kv_cache.
- HC ops GGML_OP_HC_MIX / HC_COMBINE (dispatch, supports_op, the Meta split
  states, the hc_combine_mix / hc_mix / hc_combine_norm / hc_gate_mix fusion
  arms and the HC16 planar layout) in hc-mix.{cu,cuh} and hyperconn.{cu,cuh}.
- The managed lazy reader (llama-lazy-reader) and the loader's managed_budget
  (LLAMA_LAZY_BUF_MB, TENSOR_SKIP_MANAGED, lazy_read::add_range) for the PLE
  n-gram table; off by default (it measured slower than both the mmap and the
  resident path on gfx1151).
- The QSA/HC op definitions in ggml.h / ggml.c, the scheduler op allowlists, the
  CPU references, and the qwen4exp tensor-split arch gate in llama-arch.cpp (with
  the ggml-hip CMakeLists publishing GGML_USE_HIP to the main libraries so the
  dynamic-backend build reads it).
- The qwen4exp MTP draft context gets a hybrid-idx memory instead of a plain KV
  cache (LLAMA_MTP_SPARSE=0 restores the dense draft), and llama_memory_recurrent
  stops warning about the speculative verify positions for a context whose
  recurrent filter matches nothing.
- Loader/user-path fix: TENSOR_READ_LAZY is only consulted when the loader has
  files (the llama_model_init_from_user path has nothing to lazy-read from).
- The qwen4exp-family fusion arms that live in this block's own TUs, and the
  graph-optimizer passes they need: the HC_BLK16/RES16 BF16-stream marks and
  their alloc deps, and the prefill indexer relu-sum alloc dep.
- Tests: test-hc-mix and test_flash_attn_qsa in test-backend-ops (the QSA CPU
  oracle: `test-backend-ops -o FLASH_ATTN_QSA`, 18/18 minimum), test-lazy-reader,
  and the lazy_buf_size handover in test-llama-archs.

Split note (r109): the infrastructure this block is built on -- the slab, the
fusion dispatcher TU, the async input ring, the GDN/MMB/HC16 kernel work -- is
block 10 and is listed there.  A qwen4exp-only change that is implemented inside
a general kernel TU (the GDN gate/beta BF16 fusion, the HC16 MMB BF16 streams,
the weighted-down reduction, the PLE conv fusion) deliberately stays with that
TU in block 10; only the code that needs this block's own symbols is here.

- The separate-tensor (pre-ggml-org#31028) HC mixer emits its inject product right
  behind the down product, i.e. adjacent in the graph, and expands both: the two
  BF16 GEMMs read the same F32 `xn`, and the CUDA BF16 src1 cache (block 10)
  only holds one converted tensor.  ggml-org#31028's ordering (inject last, after the
  gate product whose src1 is the silu output, which evicts the entry) converted
  the whole [hc*n_embd, n_tok] tensor twice per mixer -- measured on Flash-Next
  GSQ-IQ3_XXS as 2x the F32->BF16 `convert_unary_cont_vec4` launches and +3.4 %
  prefill when restored (issue ggml-org#226 follow-up).
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Oct 26, 2026
…r, QSA/indexer)

The qwen4exp (Qwen3.8-Flash-Next) architecture support, split out of the old
block 10 (r109) so the model graph, the sparse-attention op and the
hyper-connections no longer share a commit with the slab, the fusion dispatcher
and the async input ring.  The tree is unchanged: block 10 plus this commit is
exactly what the old block 10 carried.

Contents:

- src/models/qwen4exp.cpp: the model, the HC (hyper-connection) graph, the MTP
  draft head, the PLE gather, the QSA selection/attention graph
  (build_qsa_store_k / build_qsa_top_k / build_attn_qsa) and the QSA arm policy.
- QSA/indexer: fattn-qsa.{cu,cuh}, fattn-qsa3.cu, indexer-score.{cu,cuh},
  indexer-topk.{cu,cuh}, the 4-head WMMA indexer scorer in lightning-indexer.cu,
  with the CUDA dispatch (GGML_OP_FLASH_ATTN_QSA / INDEXER_TOPK / INDEXER_SCORE /
  INDEXER_FILL) and their CPU references; the keys-only indexer cache
  (LLAMA_QSA_KEYS_ONLY, no V tensor at all) in llama-memory-hybrid-idx and the
  v_enabled parameter on llama_kv_cache.
- HC ops GGML_OP_HC_MIX / HC_COMBINE (dispatch, supports_op, the Meta split
  states, the hc_combine_mix / hc_mix / hc_combine_norm / hc_gate_mix fusion
  arms and the HC16 planar layout) in hc-mix.{cu,cuh} and hyperconn.{cu,cuh}.
- The managed lazy reader (llama-lazy-reader) and the loader's managed_budget
  (LLAMA_LAZY_BUF_MB, TENSOR_SKIP_MANAGED, lazy_read::add_range) for the PLE
  n-gram table; off by default (it measured slower than both the mmap and the
  resident path on gfx1151).
- The QSA/HC op definitions in ggml.h / ggml.c, the scheduler op allowlists, the
  CPU references, and the qwen4exp tensor-split arch gate in llama-arch.cpp (with
  the ggml-hip CMakeLists publishing GGML_USE_HIP to the main libraries so the
  dynamic-backend build reads it).
- The qwen4exp MTP draft context gets a hybrid-idx memory instead of a plain KV
  cache (LLAMA_MTP_SPARSE=0 restores the dense draft), and llama_memory_recurrent
  stops warning about the speculative verify positions for a context whose
  recurrent filter matches nothing.
- Loader/user-path fix: TENSOR_READ_LAZY is only consulted when the loader has
  files (the llama_model_init_from_user path has nothing to lazy-read from).
- The qwen4exp-family fusion arms that live in this block's own TUs, and the
  graph-optimizer passes they need: the HC_BLK16/RES16 BF16-stream marks and
  their alloc deps, and the prefill indexer relu-sum alloc dep.
- Tests: test-hc-mix and test_flash_attn_qsa in test-backend-ops (the QSA CPU
  oracle: `test-backend-ops -o FLASH_ATTN_QSA`, 18/18 minimum), test-lazy-reader,
  and the lazy_buf_size handover in test-llama-archs.

Split note (r109): the infrastructure this block is built on -- the slab, the
fusion dispatcher TU, the async input ring, the GDN/MMB/HC16 kernel work -- is
block 10 and is listed there.  A qwen4exp-only change that is implemented inside
a general kernel TU (the GDN gate/beta BF16 fusion, the HC16 MMB BF16 streams,
the weighted-down reduction, the PLE conv fusion) deliberately stays with that
TU in block 10; only the code that needs this block's own symbols is here.

- The separate-tensor (pre-ggml-org#31028) HC mixer emits its inject product right
  behind the down product, i.e. adjacent in the graph, and expands both: the two
  BF16 GEMMs read the same F32 `xn`, and the CUDA BF16 src1 cache (block 10)
  only holds one converted tensor.  ggml-org#31028's ordering (inject last, after the
  gate product whose src1 is the silu output, which evicts the entry) converted
  the whole [hc*n_embd, n_tok] tensor twice per mixer -- measured on Flash-Next
  GSQ-IQ3_XXS as 2x the F32->BF16 `convert_unary_cont_vec4` launches and +3.4 %
  prefill when restored (issue ggml-org#226 follow-up).
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Oct 27, 2026
…r, QSA/indexer)

The qwen4exp (Qwen3.8-Flash-Next) architecture support, split out of the old
block 10 (r109) so the model graph, the sparse-attention op and the
hyper-connections no longer share a commit with the slab, the fusion dispatcher
and the async input ring.  The tree is unchanged: block 10 plus this commit is
exactly what the old block 10 carried.

Contents:

- src/models/qwen4exp.cpp: the model, the HC (hyper-connection) graph, the MTP
  draft head, the PLE gather, the QSA selection/attention graph
  (build_qsa_store_k / build_qsa_top_k / build_attn_qsa) and the QSA arm policy.
- QSA/indexer: fattn-qsa.{cu,cuh}, fattn-qsa3.cu, indexer-score.{cu,cuh},
  indexer-topk.{cu,cuh}, the 4-head WMMA indexer scorer in lightning-indexer.cu,
  with the CUDA dispatch (GGML_OP_FLASH_ATTN_QSA / INDEXER_TOPK / INDEXER_SCORE /
  INDEXER_FILL) and their CPU references; the keys-only indexer cache
  (LLAMA_QSA_KEYS_ONLY, no V tensor at all) in llama-memory-hybrid-idx and the
  v_enabled parameter on llama_kv_cache.
- HC ops GGML_OP_HC_MIX / HC_COMBINE (dispatch, supports_op, the Meta split
  states, the hc_combine_mix / hc_mix / hc_combine_norm / hc_gate_mix fusion
  arms and the HC16 planar layout) in hc-mix.{cu,cuh} and hyperconn.{cu,cuh}.
- The managed lazy reader (llama-lazy-reader) and the loader's managed_budget
  (LLAMA_LAZY_BUF_MB, TENSOR_SKIP_MANAGED, lazy_read::add_range) for the PLE
  n-gram table; off by default (it measured slower than both the mmap and the
  resident path on gfx1151).
- The QSA/HC op definitions in ggml.h / ggml.c, the scheduler op allowlists, the
  CPU references, and the qwen4exp tensor-split arch gate in llama-arch.cpp (with
  the ggml-hip CMakeLists publishing GGML_USE_HIP to the main libraries so the
  dynamic-backend build reads it).
- The qwen4exp MTP draft context gets a hybrid-idx memory instead of a plain KV
  cache (LLAMA_MTP_SPARSE=0 restores the dense draft), and llama_memory_recurrent
  stops warning about the speculative verify positions for a context whose
  recurrent filter matches nothing.
- Loader/user-path fix: TENSOR_READ_LAZY is only consulted when the loader has
  files (the llama_model_init_from_user path has nothing to lazy-read from).
- The qwen4exp-family fusion arms that live in this block's own TUs, and the
  graph-optimizer passes they need: the HC_BLK16/RES16 BF16-stream marks and
  their alloc deps, and the prefill indexer relu-sum alloc dep.
- Tests: test-hc-mix and test_flash_attn_qsa in test-backend-ops (the QSA CPU
  oracle: `test-backend-ops -o FLASH_ATTN_QSA`, 18/18 minimum), test-lazy-reader,
  and the lazy_buf_size handover in test-llama-archs.

Split note (r109): the infrastructure this block is built on -- the slab, the
fusion dispatcher TU, the async input ring, the GDN/MMB/HC16 kernel work -- is
block 10 and is listed there.  A qwen4exp-only change that is implemented inside
a general kernel TU (the GDN gate/beta BF16 fusion, the HC16 MMB BF16 streams,
the weighted-down reduction, the PLE conv fusion) deliberately stays with that
TU in block 10; only the code that needs this block's own symbols is here.

- The separate-tensor (pre-ggml-org#31028) HC mixer emits its inject product right
  behind the down product, i.e. adjacent in the graph, and expands both: the two
  BF16 GEMMs read the same F32 `xn`, and the CUDA BF16 src1 cache (block 10)
  only holds one converted tensor.  ggml-org#31028's ordering (inject last, after the
  gate product whose src1 is the silu output, which evicts the entry) converted
  the whole [hc*n_embd, n_tok] tensor twice per mixer -- measured on Flash-Next
  GSQ-IQ3_XXS as 2x the F32->BF16 `convert_unary_cont_vec4` launches and +3.4 %
  prefill when restored (issue ggml-org#226 follow-up).
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Oct 27, 2026
…r, QSA/indexer)

The qwen4exp (Qwen3.8-Flash-Next) architecture support, split out of the old
block 10 (r109) so the model graph, the sparse-attention op and the
hyper-connections no longer share a commit with the slab, the fusion dispatcher
and the async input ring.  The tree is unchanged: block 10 plus this commit is
exactly what the old block 10 carried.

Contents:

- src/models/qwen4exp.cpp: the model, the HC (hyper-connection) graph, the MTP
  draft head, the PLE gather, the QSA selection/attention graph
  (build_qsa_store_k / build_qsa_top_k / build_attn_qsa) and the QSA arm policy.
- QSA/indexer: fattn-qsa.{cu,cuh}, fattn-qsa3.cu, indexer-score.{cu,cuh},
  indexer-topk.{cu,cuh}, the 4-head WMMA indexer scorer in lightning-indexer.cu,
  with the CUDA dispatch (GGML_OP_FLASH_ATTN_QSA / INDEXER_TOPK / INDEXER_SCORE /
  INDEXER_FILL) and their CPU references; the keys-only indexer cache
  (LLAMA_QSA_KEYS_ONLY, no V tensor at all) in llama-memory-hybrid-idx and the
  v_enabled parameter on llama_kv_cache.
- HC ops GGML_OP_HC_MIX / HC_COMBINE (dispatch, supports_op, the Meta split
  states, the hc_combine_mix / hc_mix / hc_combine_norm / hc_gate_mix fusion
  arms and the HC16 planar layout) in hc-mix.{cu,cuh} and hyperconn.{cu,cuh}.
- The managed lazy reader (llama-lazy-reader) and the loader's managed_budget
  (LLAMA_LAZY_BUF_MB, TENSOR_SKIP_MANAGED, lazy_read::add_range) for the PLE
  n-gram table; off by default (it measured slower than both the mmap and the
  resident path on gfx1151).
- The QSA/HC op definitions in ggml.h / ggml.c, the scheduler op allowlists, the
  CPU references, and the qwen4exp tensor-split arch gate in llama-arch.cpp (with
  the ggml-hip CMakeLists publishing GGML_USE_HIP to the main libraries so the
  dynamic-backend build reads it).
- The qwen4exp MTP draft context gets a hybrid-idx memory instead of a plain KV
  cache (LLAMA_MTP_SPARSE=0 restores the dense draft), and llama_memory_recurrent
  stops warning about the speculative verify positions for a context whose
  recurrent filter matches nothing.
- Loader/user-path fix: TENSOR_READ_LAZY is only consulted when the loader has
  files (the llama_model_init_from_user path has nothing to lazy-read from).
- The qwen4exp-family fusion arms that live in this block's own TUs, and the
  graph-optimizer passes they need: the HC_BLK16/RES16 BF16-stream marks and
  their alloc deps, and the prefill indexer relu-sum alloc dep.
- Tests: test-hc-mix and test_flash_attn_qsa in test-backend-ops (the QSA CPU
  oracle: `test-backend-ops -o FLASH_ATTN_QSA`, 18/18 minimum), test-lazy-reader,
  and the lazy_buf_size handover in test-llama-archs.

Split note (r109): the infrastructure this block is built on -- the slab, the
fusion dispatcher TU, the async input ring, the GDN/MMB/HC16 kernel work -- is
block 10 and is listed there.  A qwen4exp-only change that is implemented inside
a general kernel TU (the GDN gate/beta BF16 fusion, the HC16 MMB BF16 streams,
the weighted-down reduction, the PLE conv fusion) deliberately stays with that
TU in block 10; only the code that needs this block's own symbols is here.

- The separate-tensor (pre-ggml-org#31028) HC mixer emits its inject product right
  behind the down product, i.e. adjacent in the graph, and expands both: the two
  BF16 GEMMs read the same F32 `xn`, and the CUDA BF16 src1 cache (block 10)
  only holds one converted tensor.  ggml-org#31028's ordering (inject last, after the
  gate product whose src1 is the silu output, which evicts the entry) converted
  the whole [hc*n_embd, n_tok] tensor twice per mixer -- measured on Flash-Next
  GSQ-IQ3_XXS as 2x the F32->BF16 `convert_unary_cont_vec4` launches and +3.4 %
  prefill when restored (issue ggml-org#226 follow-up).
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Oct 27, 2026
…r, QSA/indexer)

The qwen4exp (Qwen3.8-Flash-Next) architecture support, split out of the old
block 10 (r109) so the model graph, the sparse-attention op and the
hyper-connections no longer share a commit with the slab, the fusion dispatcher
and the async input ring.  The tree is unchanged: block 10 plus this commit is
exactly what the old block 10 carried.

Contents:

- src/models/qwen4exp.cpp: the model, the HC (hyper-connection) graph, the MTP
  draft head, the PLE gather, the QSA selection/attention graph
  (build_qsa_store_k / build_qsa_top_k / build_attn_qsa) and the QSA arm policy.
- QSA/indexer: fattn-qsa.{cu,cuh}, fattn-qsa3.cu, indexer-score.{cu,cuh},
  indexer-topk.{cu,cuh}, the 4-head WMMA indexer scorer in lightning-indexer.cu,
  with the CUDA dispatch (GGML_OP_FLASH_ATTN_QSA / INDEXER_TOPK / INDEXER_SCORE /
  INDEXER_FILL) and their CPU references; the keys-only indexer cache
  (LLAMA_QSA_KEYS_ONLY, no V tensor at all) in llama-memory-hybrid-idx and the
  v_enabled parameter on llama_kv_cache.
- HC ops GGML_OP_HC_MIX / HC_COMBINE (dispatch, supports_op, the Meta split
  states, the hc_combine_mix / hc_mix / hc_combine_norm / hc_gate_mix fusion
  arms and the HC16 planar layout) in hc-mix.{cu,cuh} and hyperconn.{cu,cuh}.
- The managed lazy reader (llama-lazy-reader) and the loader's managed_budget
  (LLAMA_LAZY_BUF_MB, TENSOR_SKIP_MANAGED, lazy_read::add_range) for the PLE
  n-gram table; off by default (it measured slower than both the mmap and the
  resident path on gfx1151).
- The QSA/HC op definitions in ggml.h / ggml.c, the scheduler op allowlists, the
  CPU references, and the qwen4exp tensor-split arch gate in llama-arch.cpp (with
  the ggml-hip CMakeLists publishing GGML_USE_HIP to the main libraries so the
  dynamic-backend build reads it).
- The qwen4exp MTP draft context gets a hybrid-idx memory instead of a plain KV
  cache (LLAMA_MTP_SPARSE=0 restores the dense draft), and llama_memory_recurrent
  stops warning about the speculative verify positions for a context whose
  recurrent filter matches nothing.
- Loader/user-path fix: TENSOR_READ_LAZY is only consulted when the loader has
  files (the llama_model_init_from_user path has nothing to lazy-read from).
- The qwen4exp-family fusion arms that live in this block's own TUs, and the
  graph-optimizer passes they need: the HC_BLK16/RES16 BF16-stream marks and
  their alloc deps, and the prefill indexer relu-sum alloc dep.
- Tests: test-hc-mix and test_flash_attn_qsa in test-backend-ops (the QSA CPU
  oracle: `test-backend-ops -o FLASH_ATTN_QSA`, 18/18 minimum), test-lazy-reader,
  and the lazy_buf_size handover in test-llama-archs.

Split note (r109): the infrastructure this block is built on -- the slab, the
fusion dispatcher TU, the async input ring, the GDN/MMB/HC16 kernel work -- is
block 10 and is listed there.  A qwen4exp-only change that is implemented inside
a general kernel TU (the GDN gate/beta BF16 fusion, the HC16 MMB BF16 streams,
the weighted-down reduction, the PLE conv fusion) deliberately stays with that
TU in block 10; only the code that needs this block's own symbols is here.

- The separate-tensor (pre-ggml-org#31028) HC mixer emits its inject product right
  behind the down product, i.e. adjacent in the graph, and expands both: the two
  BF16 GEMMs read the same F32 `xn`, and the CUDA BF16 src1 cache (block 10)
  only holds one converted tensor.  ggml-org#31028's ordering (inject last, after the
  gate product whose src1 is the silu output, which evicts the entry) converted
  the whole [hc*n_embd, n_tok] tensor twice per mixer -- measured on Flash-Next
  GSQ-IQ3_XXS as 2x the F32->BF16 `convert_unary_cont_vec4` launches and +3.4 %
  prefill when restored (issue ggml-org#226 follow-up).
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Oct 27, 2026
…r, QSA/indexer)

The qwen4exp (Qwen3.8-Flash-Next) architecture support, split out of the old
block 10 (r109) so the model graph, the sparse-attention op and the
hyper-connections no longer share a commit with the slab, the fusion dispatcher
and the async input ring.  The tree is unchanged: block 10 plus this commit is
exactly what the old block 10 carried.

Contents:

- src/models/qwen4exp.cpp: the model, the HC (hyper-connection) graph, the MTP
  draft head, the PLE gather, the QSA selection/attention graph
  (build_qsa_store_k / build_qsa_top_k / build_attn_qsa) and the QSA arm policy.
- QSA/indexer: fattn-qsa.{cu,cuh}, fattn-qsa3.cu, indexer-score.{cu,cuh},
  indexer-topk.{cu,cuh}, the 4-head WMMA indexer scorer in lightning-indexer.cu,
  with the CUDA dispatch (GGML_OP_FLASH_ATTN_QSA / INDEXER_TOPK / INDEXER_SCORE /
  INDEXER_FILL) and their CPU references; the keys-only indexer cache
  (LLAMA_QSA_KEYS_ONLY, no V tensor at all) in llama-memory-hybrid-idx and the
  v_enabled parameter on llama_kv_cache.
- HC ops GGML_OP_HC_MIX / HC_COMBINE (dispatch, supports_op, the Meta split
  states, the hc_combine_mix / hc_mix / hc_combine_norm / hc_gate_mix fusion
  arms and the HC16 planar layout) in hc-mix.{cu,cuh} and hyperconn.{cu,cuh}.
- The managed lazy reader (llama-lazy-reader) and the loader's managed_budget
  (LLAMA_LAZY_BUF_MB, TENSOR_SKIP_MANAGED, lazy_read::add_range) for the PLE
  n-gram table; off by default (it measured slower than both the mmap and the
  resident path on gfx1151).
- The QSA/HC op definitions in ggml.h / ggml.c, the scheduler op allowlists, the
  CPU references, and the qwen4exp tensor-split arch gate in llama-arch.cpp (with
  the ggml-hip CMakeLists publishing GGML_USE_HIP to the main libraries so the
  dynamic-backend build reads it).
- The qwen4exp MTP draft context gets a hybrid-idx memory instead of a plain KV
  cache (LLAMA_MTP_SPARSE=0 restores the dense draft), and llama_memory_recurrent
  stops warning about the speculative verify positions for a context whose
  recurrent filter matches nothing.
- Loader/user-path fix: TENSOR_READ_LAZY is only consulted when the loader has
  files (the llama_model_init_from_user path has nothing to lazy-read from).
- The qwen4exp-family fusion arms that live in this block's own TUs, and the
  graph-optimizer passes they need: the HC_BLK16/RES16 BF16-stream marks and
  their alloc deps, and the prefill indexer relu-sum alloc dep.
- Tests: test-hc-mix and test_flash_attn_qsa in test-backend-ops (the QSA CPU
  oracle: `test-backend-ops -o FLASH_ATTN_QSA`, 18/18 minimum), test-lazy-reader,
  and the lazy_buf_size handover in test-llama-archs.

Split note (r109): the infrastructure this block is built on -- the slab, the
fusion dispatcher TU, the async input ring, the GDN/MMB/HC16 kernel work -- is
block 10 and is listed there.  A qwen4exp-only change that is implemented inside
a general kernel TU (the GDN gate/beta BF16 fusion, the HC16 MMB BF16 streams,
the weighted-down reduction, the PLE conv fusion) deliberately stays with that
TU in block 10; only the code that needs this block's own symbols is here.

- The separate-tensor (pre-ggml-org#31028) HC mixer emits its inject product right
  behind the down product, i.e. adjacent in the graph, and expands both: the two
  BF16 GEMMs read the same F32 `xn`, and the CUDA BF16 src1 cache (block 10)
  only holds one converted tensor.  ggml-org#31028's ordering (inject last, after the
  gate product whose src1 is the silu output, which evicts the entry) converted
  the whole [hc*n_embd, n_tok] tensor twice per mixer -- measured on Flash-Next
  GSQ-IQ3_XXS as 2x the F32->BF16 `convert_unary_cont_vec4` launches and +3.4 %
  prefill when restored (issue ggml-org#226 follow-up).
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Oct 27, 2026
…r, QSA/indexer)

The qwen4exp (Qwen3.8-Flash-Next) architecture support, split out of the old
block 10 (r109) so the model graph, the sparse-attention op and the
hyper-connections no longer share a commit with the slab, the fusion dispatcher
and the async input ring.  The tree is unchanged: block 10 plus this commit is
exactly what the old block 10 carried.

Contents:

- src/models/qwen4exp.cpp: the model, the HC (hyper-connection) graph, the MTP
  draft head, the PLE gather, the QSA selection/attention graph
  (build_qsa_store_k / build_qsa_top_k / build_attn_qsa) and the QSA arm policy.
- QSA/indexer: fattn-qsa.{cu,cuh}, fattn-qsa3.cu, indexer-score.{cu,cuh},
  indexer-topk.{cu,cuh}, the 4-head WMMA indexer scorer in lightning-indexer.cu,
  with the CUDA dispatch (GGML_OP_FLASH_ATTN_QSA / INDEXER_TOPK / INDEXER_SCORE /
  INDEXER_FILL) and their CPU references; the keys-only indexer cache
  (LLAMA_QSA_KEYS_ONLY, no V tensor at all) in llama-memory-hybrid-idx and the
  v_enabled parameter on llama_kv_cache.
- HC ops GGML_OP_HC_MIX / HC_COMBINE (dispatch, supports_op, the Meta split
  states, the hc_combine_mix / hc_mix / hc_combine_norm / hc_gate_mix fusion
  arms and the HC16 planar layout) in hc-mix.{cu,cuh} and hyperconn.{cu,cuh}.
- The managed lazy reader (llama-lazy-reader) and the loader's managed_budget
  (LLAMA_LAZY_BUF_MB, TENSOR_SKIP_MANAGED, lazy_read::add_range) for the PLE
  n-gram table; off by default (it measured slower than both the mmap and the
  resident path on gfx1151).
- The QSA/HC op definitions in ggml.h / ggml.c, the scheduler op allowlists, the
  CPU references, and the qwen4exp tensor-split arch gate in llama-arch.cpp (with
  the ggml-hip CMakeLists publishing GGML_USE_HIP to the main libraries so the
  dynamic-backend build reads it).
- The qwen4exp MTP draft context gets a hybrid-idx memory instead of a plain KV
  cache (LLAMA_MTP_SPARSE=0 restores the dense draft), and llama_memory_recurrent
  stops warning about the speculative verify positions for a context whose
  recurrent filter matches nothing.
- Loader/user-path fix: TENSOR_READ_LAZY is only consulted when the loader has
  files (the llama_model_init_from_user path has nothing to lazy-read from).
- The qwen4exp-family fusion arms that live in this block's own TUs, and the
  graph-optimizer passes they need: the HC_BLK16/RES16 BF16-stream marks and
  their alloc deps, and the prefill indexer relu-sum alloc dep.
- Tests: test-hc-mix and test_flash_attn_qsa in test-backend-ops (the QSA CPU
  oracle: `test-backend-ops -o FLASH_ATTN_QSA`, 18/18 minimum), test-lazy-reader,
  and the lazy_buf_size handover in test-llama-archs.

Split note (r109): the infrastructure this block is built on -- the slab, the
fusion dispatcher TU, the async input ring, the GDN/MMB/HC16 kernel work -- is
block 10 and is listed there.  A qwen4exp-only change that is implemented inside
a general kernel TU (the GDN gate/beta BF16 fusion, the HC16 MMB BF16 streams,
the weighted-down reduction, the PLE conv fusion) deliberately stays with that
TU in block 10; only the code that needs this block's own symbols is here.

- The separate-tensor (pre-ggml-org#31028) HC mixer emits its inject product right
  behind the down product, i.e. adjacent in the graph, and expands both: the two
  BF16 GEMMs read the same F32 `xn`, and the CUDA BF16 src1 cache (block 10)
  only holds one converted tensor.  ggml-org#31028's ordering (inject last, after the
  gate product whose src1 is the silu output, which evicts the entry) converted
  the whole [hc*n_embd, n_tok] tensor twice per mixer -- measured on Flash-Next
  GSQ-IQ3_XXS as 2x the F32->BF16 `convert_unary_cont_vec4` launches and +3.4 %
  prefill when restored (issue ggml-org#226 follow-up).
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Oct 27, 2026
…r, QSA/indexer)

The qwen4exp (Qwen3.8-Flash-Next) architecture support, split out of the old
block 10 (r109) so the model graph, the sparse-attention op and the
hyper-connections no longer share a commit with the slab, the fusion dispatcher
and the async input ring.  The tree is unchanged: block 10 plus this commit is
exactly what the old block 10 carried.

Contents:

- src/models/qwen4exp.cpp: the model, the HC (hyper-connection) graph, the MTP
  draft head, the PLE gather, the QSA selection/attention graph
  (build_qsa_store_k / build_qsa_top_k / build_attn_qsa) and the QSA arm policy.
- QSA/indexer: fattn-qsa.{cu,cuh}, fattn-qsa3.cu, indexer-score.{cu,cuh},
  indexer-topk.{cu,cuh}, the 4-head WMMA indexer scorer in lightning-indexer.cu,
  with the CUDA dispatch (GGML_OP_FLASH_ATTN_QSA / INDEXER_TOPK / INDEXER_SCORE /
  INDEXER_FILL) and their CPU references; the keys-only indexer cache
  (LLAMA_QSA_KEYS_ONLY, no V tensor at all) in llama-memory-hybrid-idx and the
  v_enabled parameter on llama_kv_cache.
- HC ops GGML_OP_HC_MIX / HC_COMBINE (dispatch, supports_op, the Meta split
  states, the hc_combine_mix / hc_mix / hc_combine_norm / hc_gate_mix fusion
  arms and the HC16 planar layout) in hc-mix.{cu,cuh} and hyperconn.{cu,cuh}.
- The managed lazy reader (llama-lazy-reader) and the loader's managed_budget
  (LLAMA_LAZY_BUF_MB, TENSOR_SKIP_MANAGED, lazy_read::add_range) for the PLE
  n-gram table; off by default (it measured slower than both the mmap and the
  resident path on gfx1151).
- The QSA/HC op definitions in ggml.h / ggml.c, the scheduler op allowlists, the
  CPU references, and the qwen4exp tensor-split arch gate in llama-arch.cpp (with
  the ggml-hip CMakeLists publishing GGML_USE_HIP to the main libraries so the
  dynamic-backend build reads it).
- The qwen4exp MTP draft context gets a hybrid-idx memory instead of a plain KV
  cache (LLAMA_MTP_SPARSE=0 restores the dense draft), and llama_memory_recurrent
  stops warning about the speculative verify positions for a context whose
  recurrent filter matches nothing.
- Loader/user-path fix: TENSOR_READ_LAZY is only consulted when the loader has
  files (the llama_model_init_from_user path has nothing to lazy-read from).
- The qwen4exp-family fusion arms that live in this block's own TUs, and the
  graph-optimizer passes they need: the HC_BLK16/RES16 BF16-stream marks and
  their alloc deps, and the prefill indexer relu-sum alloc dep.
- Tests: test-hc-mix and test_flash_attn_qsa in test-backend-ops (the QSA CPU
  oracle: `test-backend-ops -o FLASH_ATTN_QSA`, 18/18 minimum), test-lazy-reader,
  and the lazy_buf_size handover in test-llama-archs.

Split note (r109): the infrastructure this block is built on -- the slab, the
fusion dispatcher TU, the async input ring, the GDN/MMB/HC16 kernel work -- is
block 10 and is listed there.  A qwen4exp-only change that is implemented inside
a general kernel TU (the GDN gate/beta BF16 fusion, the HC16 MMB BF16 streams,
the weighted-down reduction, the PLE conv fusion) deliberately stays with that
TU in block 10; only the code that needs this block's own symbols is here.

- The separate-tensor (pre-ggml-org#31028) HC mixer emits its inject product right
  behind the down product, i.e. adjacent in the graph, and expands both: the two
  BF16 GEMMs read the same F32 `xn`, and the CUDA BF16 src1 cache (block 10)
  only holds one converted tensor.  ggml-org#31028's ordering (inject last, after the
  gate product whose src1 is the silu output, which evicts the entry) converted
  the whole [hc*n_embd, n_tok] tensor twice per mixer -- measured on Flash-Next
  GSQ-IQ3_XXS as 2x the F32->BF16 `convert_unary_cont_vec4` launches and +3.4 %
  prefill when restored (issue ggml-org#226 follow-up).
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Oct 27, 2026
…r, QSA/indexer)

The qwen4exp (Qwen3.8-Flash-Next) architecture support, split out of the old
block 10 (r109) so the model graph, the sparse-attention op and the
hyper-connections no longer share a commit with the slab, the fusion dispatcher
and the async input ring.  The tree is unchanged: block 10 plus this commit is
exactly what the old block 10 carried.

Contents:

- src/models/qwen4exp.cpp: the model, the HC (hyper-connection) graph, the MTP
  draft head, the PLE gather, the QSA selection/attention graph
  (build_qsa_store_k / build_qsa_top_k / build_attn_qsa) and the QSA arm policy.
- QSA/indexer: fattn-qsa.{cu,cuh}, fattn-qsa3.cu, indexer-score.{cu,cuh},
  indexer-topk.{cu,cuh}, the 4-head WMMA indexer scorer in lightning-indexer.cu,
  with the CUDA dispatch (GGML_OP_FLASH_ATTN_QSA / INDEXER_TOPK / INDEXER_SCORE /
  INDEXER_FILL) and their CPU references; the keys-only indexer cache
  (LLAMA_QSA_KEYS_ONLY, no V tensor at all) in llama-memory-hybrid-idx and the
  v_enabled parameter on llama_kv_cache.
- HC ops GGML_OP_HC_MIX / HC_COMBINE (dispatch, supports_op, the Meta split
  states, the hc_combine_mix / hc_mix / hc_combine_norm / hc_gate_mix fusion
  arms and the HC16 planar layout) in hc-mix.{cu,cuh} and hyperconn.{cu,cuh}.
- The managed lazy reader (llama-lazy-reader) and the loader's managed_budget
  (LLAMA_LAZY_BUF_MB, TENSOR_SKIP_MANAGED, lazy_read::add_range) for the PLE
  n-gram table; off by default (it measured slower than both the mmap and the
  resident path on gfx1151).
- The QSA/HC op definitions in ggml.h / ggml.c, the scheduler op allowlists, the
  CPU references, and the qwen4exp tensor-split arch gate in llama-arch.cpp (with
  the ggml-hip CMakeLists publishing GGML_USE_HIP to the main libraries so the
  dynamic-backend build reads it).
- The qwen4exp MTP draft context gets a hybrid-idx memory instead of a plain KV
  cache (LLAMA_MTP_SPARSE=0 restores the dense draft), and llama_memory_recurrent
  stops warning about the speculative verify positions for a context whose
  recurrent filter matches nothing.
- Loader/user-path fix: TENSOR_READ_LAZY is only consulted when the loader has
  files (the llama_model_init_from_user path has nothing to lazy-read from).
- The qwen4exp-family fusion arms that live in this block's own TUs, and the
  graph-optimizer passes they need: the HC_BLK16/RES16 BF16-stream marks and
  their alloc deps, and the prefill indexer relu-sum alloc dep.
- Tests: test-hc-mix and test_flash_attn_qsa in test-backend-ops (the QSA CPU
  oracle: `test-backend-ops -o FLASH_ATTN_QSA`, 18/18 minimum), test-lazy-reader,
  and the lazy_buf_size handover in test-llama-archs.

Split note (r109): the infrastructure this block is built on -- the slab, the
fusion dispatcher TU, the async input ring, the GDN/MMB/HC16 kernel work -- is
block 10 and is listed there.  A qwen4exp-only change that is implemented inside
a general kernel TU (the GDN gate/beta BF16 fusion, the HC16 MMB BF16 streams,
the weighted-down reduction, the PLE conv fusion) deliberately stays with that
TU in block 10; only the code that needs this block's own symbols is here.

- The separate-tensor (pre-ggml-org#31028) HC mixer emits its inject product right
  behind the down product, i.e. adjacent in the graph, and expands both: the two
  BF16 GEMMs read the same F32 `xn`, and the CUDA BF16 src1 cache (block 10)
  only holds one converted tensor.  ggml-org#31028's ordering (inject last, after the
  gate product whose src1 is the silu output, which evicts the entry) converted
  the whole [hc*n_embd, n_tok] tensor twice per mixer -- measured on Flash-Next
  GSQ-IQ3_XXS as 2x the F32->BF16 `convert_unary_cont_vec4` launches and +3.4 %
  prefill when restored (issue ggml-org#226 follow-up).
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Oct 27, 2026
…r, QSA/indexer)

The qwen4exp (Qwen3.8-Flash-Next) architecture support, split out of the old
block 10 (r109) so the model graph, the sparse-attention op and the
hyper-connections no longer share a commit with the slab, the fusion dispatcher
and the async input ring.  The tree is unchanged: block 10 plus this commit is
exactly what the old block 10 carried.

Contents:

- src/models/qwen4exp.cpp: the model, the HC (hyper-connection) graph, the MTP
  draft head, the PLE gather, the QSA selection/attention graph
  (build_qsa_store_k / build_qsa_top_k / build_attn_qsa) and the QSA arm policy.
- QSA/indexer: fattn-qsa.{cu,cuh}, fattn-qsa3.cu, indexer-score.{cu,cuh},
  indexer-topk.{cu,cuh}, the 4-head WMMA indexer scorer in lightning-indexer.cu,
  with the CUDA dispatch (GGML_OP_FLASH_ATTN_QSA / INDEXER_TOPK / INDEXER_SCORE /
  INDEXER_FILL) and their CPU references; the keys-only indexer cache
  (LLAMA_QSA_KEYS_ONLY, no V tensor at all) in llama-memory-hybrid-idx and the
  v_enabled parameter on llama_kv_cache.
- HC ops GGML_OP_HC_MIX / HC_COMBINE (dispatch, supports_op, the Meta split
  states, the hc_combine_mix / hc_mix / hc_combine_norm / hc_gate_mix fusion
  arms and the HC16 planar layout) in hc-mix.{cu,cuh} and hyperconn.{cu,cuh}.
- The managed lazy reader (llama-lazy-reader) and the loader's managed_budget
  (LLAMA_LAZY_BUF_MB, TENSOR_SKIP_MANAGED, lazy_read::add_range) for the PLE
  n-gram table; off by default (it measured slower than both the mmap and the
  resident path on gfx1151).
- The QSA/HC op definitions in ggml.h / ggml.c, the scheduler op allowlists, the
  CPU references, and the qwen4exp tensor-split arch gate in llama-arch.cpp (with
  the ggml-hip CMakeLists publishing GGML_USE_HIP to the main libraries so the
  dynamic-backend build reads it).
- The qwen4exp MTP draft context gets a hybrid-idx memory instead of a plain KV
  cache (LLAMA_MTP_SPARSE=0 restores the dense draft), and llama_memory_recurrent
  stops warning about the speculative verify positions for a context whose
  recurrent filter matches nothing.
- Loader/user-path fix: TENSOR_READ_LAZY is only consulted when the loader has
  files (the llama_model_init_from_user path has nothing to lazy-read from).
- The qwen4exp-family fusion arms that live in this block's own TUs, and the
  graph-optimizer passes they need: the HC_BLK16/RES16 BF16-stream marks and
  their alloc deps, and the prefill indexer relu-sum alloc dep.
- Tests: test-hc-mix and test_flash_attn_qsa in test-backend-ops (the QSA CPU
  oracle: `test-backend-ops -o FLASH_ATTN_QSA`, 18/18 minimum), test-lazy-reader,
  and the lazy_buf_size handover in test-llama-archs.

Split note (r109): the infrastructure this block is built on -- the slab, the
fusion dispatcher TU, the async input ring, the GDN/MMB/HC16 kernel work -- is
block 10 and is listed there.  A qwen4exp-only change that is implemented inside
a general kernel TU (the GDN gate/beta BF16 fusion, the HC16 MMB BF16 streams,
the weighted-down reduction, the PLE conv fusion) deliberately stays with that
TU in block 10; only the code that needs this block's own symbols is here.

- The separate-tensor (pre-ggml-org#31028) HC mixer emits its inject product right
  behind the down product, i.e. adjacent in the graph, and expands both: the two
  BF16 GEMMs read the same F32 `xn`, and the CUDA BF16 src1 cache (block 10)
  only holds one converted tensor.  ggml-org#31028's ordering (inject last, after the
  gate product whose src1 is the silu output, which evicts the entry) converted
  the whole [hc*n_embd, n_tok] tensor twice per mixer -- measured on Flash-Next
  GSQ-IQ3_XXS as 2x the F32->BF16 `convert_unary_cont_vec4` launches and +3.4 %
  prefill when restored (issue ggml-org#226 follow-up).
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Oct 28, 2026
…r, QSA/indexer)

The qwen4exp (Qwen3.8-Flash-Next) architecture support, split out of the old
block 10 (r109) so the model graph, the sparse-attention op and the
hyper-connections no longer share a commit with the slab, the fusion dispatcher
and the async input ring.  The tree is unchanged: block 10 plus this commit is
exactly what the old block 10 carried.

Contents:

- src/models/qwen4exp.cpp: the model, the HC (hyper-connection) graph, the MTP
  draft head, the PLE gather, the QSA selection/attention graph
  (build_qsa_store_k / build_qsa_top_k / build_attn_qsa) and the QSA arm policy.
- QSA/indexer: fattn-qsa.{cu,cuh}, fattn-qsa3.cu, indexer-score.{cu,cuh},
  indexer-topk.{cu,cuh}, the 4-head WMMA indexer scorer in lightning-indexer.cu,
  with the CUDA dispatch (GGML_OP_FLASH_ATTN_QSA / INDEXER_TOPK / INDEXER_SCORE /
  INDEXER_FILL) and their CPU references; the keys-only indexer cache
  (LLAMA_QSA_KEYS_ONLY, no V tensor at all) in llama-memory-hybrid-idx and the
  v_enabled parameter on llama_kv_cache.
- HC ops GGML_OP_HC_MIX / HC_COMBINE (dispatch, supports_op, the Meta split
  states, the hc_combine_mix / hc_mix / hc_combine_norm / hc_gate_mix fusion
  arms and the HC16 planar layout) in hc-mix.{cu,cuh} and hyperconn.{cu,cuh}.
- The managed lazy reader (llama-lazy-reader) and the loader's managed_budget
  (LLAMA_LAZY_BUF_MB, TENSOR_SKIP_MANAGED, lazy_read::add_range) for the PLE
  n-gram table; off by default (it measured slower than both the mmap and the
  resident path on gfx1151).
- The QSA/HC op definitions in ggml.h / ggml.c, the scheduler op allowlists, the
  CPU references, and the qwen4exp tensor-split arch gate in llama-arch.cpp (with
  the ggml-hip CMakeLists publishing GGML_USE_HIP to the main libraries so the
  dynamic-backend build reads it).
- The qwen4exp MTP draft context gets a hybrid-idx memory instead of a plain KV
  cache (LLAMA_MTP_SPARSE=0 restores the dense draft), and llama_memory_recurrent
  stops warning about the speculative verify positions for a context whose
  recurrent filter matches nothing.
- Loader/user-path fix: TENSOR_READ_LAZY is only consulted when the loader has
  files (the llama_model_init_from_user path has nothing to lazy-read from).
- The qwen4exp-family fusion arms that live in this block's own TUs, and the
  graph-optimizer passes they need: the HC_BLK16/RES16 BF16-stream marks and
  their alloc deps, and the prefill indexer relu-sum alloc dep.
- Tests: test-hc-mix and test_flash_attn_qsa in test-backend-ops (the QSA CPU
  oracle: `test-backend-ops -o FLASH_ATTN_QSA`, 18/18 minimum), test-lazy-reader,
  and the lazy_buf_size handover in test-llama-archs.

Split note (r109): the infrastructure this block is built on -- the slab, the
fusion dispatcher TU, the async input ring, the GDN/MMB/HC16 kernel work -- is
block 10 and is listed there.  A qwen4exp-only change that is implemented inside
a general kernel TU (the GDN gate/beta BF16 fusion, the HC16 MMB BF16 streams,
the weighted-down reduction, the PLE conv fusion) deliberately stays with that
TU in block 10; only the code that needs this block's own symbols is here.

- The separate-tensor (pre-ggml-org#31028) HC mixer emits its inject product right
  behind the down product, i.e. adjacent in the graph, and expands both: the two
  BF16 GEMMs read the same F32 `xn`, and the CUDA BF16 src1 cache (block 10)
  only holds one converted tensor.  ggml-org#31028's ordering (inject last, after the
  gate product whose src1 is the silu output, which evicts the entry) converted
  the whole [hc*n_embd, n_tok] tensor twice per mixer -- measured on Flash-Next
  GSQ-IQ3_XXS as 2x the F32->BF16 `convert_unary_cont_vec4` launches and +3.4 %
  prefill when restored (issue ggml-org#226 follow-up).
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Oct 28, 2026
…r, QSA/indexer)

The qwen4exp (Qwen3.8-Flash-Next) architecture support, split out of the old
block 10 (r109) so the model graph, the sparse-attention op and the
hyper-connections no longer share a commit with the slab, the fusion dispatcher
and the async input ring.  The tree is unchanged: block 10 plus this commit is
exactly what the old block 10 carried.

Contents:

- src/models/qwen4exp.cpp: the model, the HC (hyper-connection) graph, the MTP
  draft head, the PLE gather, the QSA selection/attention graph
  (build_qsa_store_k / build_qsa_top_k / build_attn_qsa) and the QSA arm policy.
- QSA/indexer: fattn-qsa.{cu,cuh}, fattn-qsa3.cu, indexer-score.{cu,cuh},
  indexer-topk.{cu,cuh}, the 4-head WMMA indexer scorer in lightning-indexer.cu,
  with the CUDA dispatch (GGML_OP_FLASH_ATTN_QSA / INDEXER_TOPK / INDEXER_SCORE /
  INDEXER_FILL) and their CPU references; the keys-only indexer cache
  (LLAMA_QSA_KEYS_ONLY, no V tensor at all) in llama-memory-hybrid-idx and the
  v_enabled parameter on llama_kv_cache.
- HC ops GGML_OP_HC_MIX / HC_COMBINE (dispatch, supports_op, the Meta split
  states, the hc_combine_mix / hc_mix / hc_combine_norm / hc_gate_mix fusion
  arms and the HC16 planar layout) in hc-mix.{cu,cuh} and hyperconn.{cu,cuh}.
- The managed lazy reader (llama-lazy-reader) and the loader's managed_budget
  (LLAMA_LAZY_BUF_MB, TENSOR_SKIP_MANAGED, lazy_read::add_range) for the PLE
  n-gram table; off by default (it measured slower than both the mmap and the
  resident path on gfx1151).
- The QSA/HC op definitions in ggml.h / ggml.c, the scheduler op allowlists, the
  CPU references, and the qwen4exp tensor-split arch gate in llama-arch.cpp (with
  the ggml-hip CMakeLists publishing GGML_USE_HIP to the main libraries so the
  dynamic-backend build reads it).
- The qwen4exp MTP draft context gets a hybrid-idx memory instead of a plain KV
  cache (LLAMA_MTP_SPARSE=0 restores the dense draft), and llama_memory_recurrent
  stops warning about the speculative verify positions for a context whose
  recurrent filter matches nothing.
- Loader/user-path fix: TENSOR_READ_LAZY is only consulted when the loader has
  files (the llama_model_init_from_user path has nothing to lazy-read from).
- The qwen4exp-family fusion arms that live in this block's own TUs, and the
  graph-optimizer passes they need: the HC_BLK16/RES16 BF16-stream marks and
  their alloc deps, and the prefill indexer relu-sum alloc dep.
- Tests: test-hc-mix and test_flash_attn_qsa in test-backend-ops (the QSA CPU
  oracle: `test-backend-ops -o FLASH_ATTN_QSA`, 18/18 minimum), test-lazy-reader,
  and the lazy_buf_size handover in test-llama-archs.

Split note (r109): the infrastructure this block is built on -- the slab, the
fusion dispatcher TU, the async input ring, the GDN/MMB/HC16 kernel work -- is
block 10 and is listed there.  A qwen4exp-only change that is implemented inside
a general kernel TU (the GDN gate/beta BF16 fusion, the HC16 MMB BF16 streams,
the weighted-down reduction, the PLE conv fusion) deliberately stays with that
TU in block 10; only the code that needs this block's own symbols is here.

- The separate-tensor (pre-ggml-org#31028) HC mixer emits its inject product right
  behind the down product, i.e. adjacent in the graph, and expands both: the two
  BF16 GEMMs read the same F32 `xn`, and the CUDA BF16 src1 cache (block 10)
  only holds one converted tensor.  ggml-org#31028's ordering (inject last, after the
  gate product whose src1 is the silu output, which evicts the entry) converted
  the whole [hc*n_embd, n_tok] tensor twice per mixer -- measured on Flash-Next
  GSQ-IQ3_XXS as 2x the F32->BF16 `convert_unary_cont_vec4` launches and +3.4 %
  prefill when restored (issue ggml-org#226 follow-up).
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Oct 28, 2026
…r, QSA/indexer)

The qwen4exp (Qwen3.8-Flash-Next) architecture support, split out of the old
block 10 (r109) so the model graph, the sparse-attention op and the
hyper-connections no longer share a commit with the slab, the fusion dispatcher
and the async input ring.  The tree is unchanged: block 10 plus this commit is
exactly what the old block 10 carried.

Contents:

- src/models/qwen4exp.cpp: the model, the HC (hyper-connection) graph, the MTP
  draft head, the PLE gather, the QSA selection/attention graph
  (build_qsa_store_k / build_qsa_top_k / build_attn_qsa) and the QSA arm policy.
- QSA/indexer: fattn-qsa.{cu,cuh}, fattn-qsa3.cu, indexer-score.{cu,cuh},
  indexer-topk.{cu,cuh}, the 4-head WMMA indexer scorer in lightning-indexer.cu,
  with the CUDA dispatch (GGML_OP_FLASH_ATTN_QSA / INDEXER_TOPK / INDEXER_SCORE /
  INDEXER_FILL) and their CPU references; the keys-only indexer cache
  (LLAMA_QSA_KEYS_ONLY, no V tensor at all) in llama-memory-hybrid-idx and the
  v_enabled parameter on llama_kv_cache.
- HC ops GGML_OP_HC_MIX / HC_COMBINE (dispatch, supports_op, the Meta split
  states, the hc_combine_mix / hc_mix / hc_combine_norm / hc_gate_mix fusion
  arms and the HC16 planar layout) in hc-mix.{cu,cuh} and hyperconn.{cu,cuh}.
- The managed lazy reader (llama-lazy-reader) and the loader's managed_budget
  (LLAMA_LAZY_BUF_MB, TENSOR_SKIP_MANAGED, lazy_read::add_range) for the PLE
  n-gram table; off by default (it measured slower than both the mmap and the
  resident path on gfx1151).
- The QSA/HC op definitions in ggml.h / ggml.c, the scheduler op allowlists, the
  CPU references, and the qwen4exp tensor-split arch gate in llama-arch.cpp (with
  the ggml-hip CMakeLists publishing GGML_USE_HIP to the main libraries so the
  dynamic-backend build reads it).
- The qwen4exp MTP draft context gets a hybrid-idx memory instead of a plain KV
  cache (LLAMA_MTP_SPARSE=0 restores the dense draft), and llama_memory_recurrent
  stops warning about the speculative verify positions for a context whose
  recurrent filter matches nothing.
- Loader/user-path fix: TENSOR_READ_LAZY is only consulted when the loader has
  files (the llama_model_init_from_user path has nothing to lazy-read from).
- The qwen4exp-family fusion arms that live in this block's own TUs, and the
  graph-optimizer passes they need: the HC_BLK16/RES16 BF16-stream marks and
  their alloc deps, and the prefill indexer relu-sum alloc dep.
- Tests: test-hc-mix and test_flash_attn_qsa in test-backend-ops (the QSA CPU
  oracle: `test-backend-ops -o FLASH_ATTN_QSA`, 18/18 minimum), test-lazy-reader,
  and the lazy_buf_size handover in test-llama-archs.

Split note (r109): the infrastructure this block is built on -- the slab, the
fusion dispatcher TU, the async input ring, the GDN/MMB/HC16 kernel work -- is
block 10 and is listed there.  A qwen4exp-only change that is implemented inside
a general kernel TU (the GDN gate/beta BF16 fusion, the HC16 MMB BF16 streams,
the weighted-down reduction, the PLE conv fusion) deliberately stays with that
TU in block 10; only the code that needs this block's own symbols is here.

- The separate-tensor (pre-ggml-org#31028) HC mixer emits its inject product right
  behind the down product, i.e. adjacent in the graph, and expands both: the two
  BF16 GEMMs read the same F32 `xn`, and the CUDA BF16 src1 cache (block 10)
  only holds one converted tensor.  ggml-org#31028's ordering (inject last, after the
  gate product whose src1 is the silu output, which evicts the entry) converted
  the whole [hc*n_embd, n_tok] tensor twice per mixer -- measured on Flash-Next
  GSQ-IQ3_XXS as 2x the F32->BF16 `convert_unary_cont_vec4` launches and +3.4 %
  prefill when restored (issue ggml-org#226 follow-up).
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Oct 28, 2026
…r, QSA/indexer)

The qwen4exp (Qwen3.8-Flash-Next) architecture support, split out of the old
block 10 (r109) so the model graph, the sparse-attention op and the
hyper-connections no longer share a commit with the slab, the fusion dispatcher
and the async input ring.  The tree is unchanged: block 10 plus this commit is
exactly what the old block 10 carried.

Contents:

- src/models/qwen4exp.cpp: the model, the HC (hyper-connection) graph, the MTP
  draft head, the PLE gather, the QSA selection/attention graph
  (build_qsa_store_k / build_qsa_top_k / build_attn_qsa) and the QSA arm policy.
- QSA/indexer: fattn-qsa.{cu,cuh}, fattn-qsa3.cu, indexer-score.{cu,cuh},
  indexer-topk.{cu,cuh}, the 4-head WMMA indexer scorer in lightning-indexer.cu,
  with the CUDA dispatch (GGML_OP_FLASH_ATTN_QSA / INDEXER_TOPK / INDEXER_SCORE /
  INDEXER_FILL) and their CPU references; the keys-only indexer cache
  (LLAMA_QSA_KEYS_ONLY, no V tensor at all) in llama-memory-hybrid-idx and the
  v_enabled parameter on llama_kv_cache.
- HC ops GGML_OP_HC_MIX / HC_COMBINE (dispatch, supports_op, the Meta split
  states, the hc_combine_mix / hc_mix / hc_combine_norm / hc_gate_mix fusion
  arms and the HC16 planar layout) in hc-mix.{cu,cuh} and hyperconn.{cu,cuh}.
- The managed lazy reader (llama-lazy-reader) and the loader's managed_budget
  (LLAMA_LAZY_BUF_MB, TENSOR_SKIP_MANAGED, lazy_read::add_range) for the PLE
  n-gram table; off by default (it measured slower than both the mmap and the
  resident path on gfx1151).
- The QSA/HC op definitions in ggml.h / ggml.c, the scheduler op allowlists, the
  CPU references, and the qwen4exp tensor-split arch gate in llama-arch.cpp (with
  the ggml-hip CMakeLists publishing GGML_USE_HIP to the main libraries so the
  dynamic-backend build reads it).
- The qwen4exp MTP draft context gets a hybrid-idx memory instead of a plain KV
  cache (LLAMA_MTP_SPARSE=0 restores the dense draft), and llama_memory_recurrent
  stops warning about the speculative verify positions for a context whose
  recurrent filter matches nothing.
- Loader/user-path fix: TENSOR_READ_LAZY is only consulted when the loader has
  files (the llama_model_init_from_user path has nothing to lazy-read from).
- The qwen4exp-family fusion arms that live in this block's own TUs, and the
  graph-optimizer passes they need: the HC_BLK16/RES16 BF16-stream marks and
  their alloc deps, and the prefill indexer relu-sum alloc dep.
- Tests: test-hc-mix and test_flash_attn_qsa in test-backend-ops (the QSA CPU
  oracle: `test-backend-ops -o FLASH_ATTN_QSA`, 18/18 minimum), test-lazy-reader,
  and the lazy_buf_size handover in test-llama-archs.

Split note (r109): the infrastructure this block is built on -- the slab, the
fusion dispatcher TU, the async input ring, the GDN/MMB/HC16 kernel work -- is
block 10 and is listed there.  A qwen4exp-only change that is implemented inside
a general kernel TU (the GDN gate/beta BF16 fusion, the HC16 MMB BF16 streams,
the weighted-down reduction, the PLE conv fusion) deliberately stays with that
TU in block 10; only the code that needs this block's own symbols is here.

- The separate-tensor (pre-ggml-org#31028) HC mixer emits its inject product right
  behind the down product, i.e. adjacent in the graph, and expands both: the two
  BF16 GEMMs read the same F32 `xn`, and the CUDA BF16 src1 cache (block 10)
  only holds one converted tensor.  ggml-org#31028's ordering (inject last, after the
  gate product whose src1 is the silu output, which evicts the entry) converted
  the whole [hc*n_embd, n_tok] tensor twice per mixer -- measured on Flash-Next
  GSQ-IQ3_XXS as 2x the F32->BF16 `convert_unary_cont_vec4` launches and +3.4 %
  prefill when restored (issue ggml-org#226 follow-up).
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Oct 28, 2026
…r, QSA/indexer)

The qwen4exp (Qwen3.8-Flash-Next) architecture support, split out of the old
block 10 (r109) so the model graph, the sparse-attention op and the
hyper-connections no longer share a commit with the slab, the fusion dispatcher
and the async input ring.  The tree is unchanged: block 10 plus this commit is
exactly what the old block 10 carried.

Contents:

- src/models/qwen4exp.cpp: the model, the HC (hyper-connection) graph, the MTP
  draft head, the PLE gather, the QSA selection/attention graph
  (build_qsa_store_k / build_qsa_top_k / build_attn_qsa) and the QSA arm policy.
- QSA/indexer: fattn-qsa.{cu,cuh}, fattn-qsa3.cu, indexer-score.{cu,cuh},
  indexer-topk.{cu,cuh}, the 4-head WMMA indexer scorer in lightning-indexer.cu,
  with the CUDA dispatch (GGML_OP_FLASH_ATTN_QSA / INDEXER_TOPK / INDEXER_SCORE /
  INDEXER_FILL) and their CPU references; the keys-only indexer cache
  (LLAMA_QSA_KEYS_ONLY, no V tensor at all) in llama-memory-hybrid-idx and the
  v_enabled parameter on llama_kv_cache.
- HC ops GGML_OP_HC_MIX / HC_COMBINE (dispatch, supports_op, the Meta split
  states, the hc_combine_mix / hc_mix / hc_combine_norm / hc_gate_mix fusion
  arms and the HC16 planar layout) in hc-mix.{cu,cuh} and hyperconn.{cu,cuh}.
- The managed lazy reader (llama-lazy-reader) and the loader's managed_budget
  (LLAMA_LAZY_BUF_MB, TENSOR_SKIP_MANAGED, lazy_read::add_range) for the PLE
  n-gram table; off by default (it measured slower than both the mmap and the
  resident path on gfx1151).
- The QSA/HC op definitions in ggml.h / ggml.c, the scheduler op allowlists, the
  CPU references, and the qwen4exp tensor-split arch gate in llama-arch.cpp (with
  the ggml-hip CMakeLists publishing GGML_USE_HIP to the main libraries so the
  dynamic-backend build reads it).
- The qwen4exp MTP draft context gets a hybrid-idx memory instead of a plain KV
  cache (LLAMA_MTP_SPARSE=0 restores the dense draft), and llama_memory_recurrent
  stops warning about the speculative verify positions for a context whose
  recurrent filter matches nothing.
- Loader/user-path fix: TENSOR_READ_LAZY is only consulted when the loader has
  files (the llama_model_init_from_user path has nothing to lazy-read from).
- The qwen4exp-family fusion arms that live in this block's own TUs, and the
  graph-optimizer passes they need: the HC_BLK16/RES16 BF16-stream marks and
  their alloc deps, and the prefill indexer relu-sum alloc dep.
- Tests: test-hc-mix and test_flash_attn_qsa in test-backend-ops (the QSA CPU
  oracle: `test-backend-ops -o FLASH_ATTN_QSA`, 18/18 minimum), test-lazy-reader,
  and the lazy_buf_size handover in test-llama-archs.

Split note (r109): the infrastructure this block is built on -- the slab, the
fusion dispatcher TU, the async input ring, the GDN/MMB/HC16 kernel work -- is
block 10 and is listed there.  A qwen4exp-only change that is implemented inside
a general kernel TU (the GDN gate/beta BF16 fusion, the HC16 MMB BF16 streams,
the weighted-down reduction, the PLE conv fusion) deliberately stays with that
TU in block 10; only the code that needs this block's own symbols is here.

- The separate-tensor (pre-ggml-org#31028) HC mixer emits its inject product right
  behind the down product, i.e. adjacent in the graph, and expands both: the two
  BF16 GEMMs read the same F32 `xn`, and the CUDA BF16 src1 cache (block 10)
  only holds one converted tensor.  ggml-org#31028's ordering (inject last, after the
  gate product whose src1 is the silu output, which evicts the entry) converted
  the whole [hc*n_embd, n_tok] tensor twice per mixer -- measured on Flash-Next
  GSQ-IQ3_XXS as 2x the F32->BF16 `convert_unary_cont_vec4` launches and +3.4 %
  prefill when restored (issue ggml-org#226 follow-up).
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Oct 28, 2026
…r, QSA/indexer)

The qwen4exp (Qwen3.8-Flash-Next) architecture support, split out of the old
block 10 (r109) so the model graph, the sparse-attention op and the
hyper-connections no longer share a commit with the slab, the fusion dispatcher
and the async input ring.  The tree is unchanged: block 10 plus this commit is
exactly what the old block 10 carried.

Contents:

- src/models/qwen4exp.cpp: the model, the HC (hyper-connection) graph, the MTP
  draft head, the PLE gather, the QSA selection/attention graph
  (build_qsa_store_k / build_qsa_top_k / build_attn_qsa) and the QSA arm policy.
- QSA/indexer: fattn-qsa.{cu,cuh}, fattn-qsa3.cu, indexer-score.{cu,cuh},
  indexer-topk.{cu,cuh}, the 4-head WMMA indexer scorer in lightning-indexer.cu,
  with the CUDA dispatch (GGML_OP_FLASH_ATTN_QSA / INDEXER_TOPK / INDEXER_SCORE /
  INDEXER_FILL) and their CPU references; the keys-only indexer cache
  (LLAMA_QSA_KEYS_ONLY, no V tensor at all) in llama-memory-hybrid-idx and the
  v_enabled parameter on llama_kv_cache.
- HC ops GGML_OP_HC_MIX / HC_COMBINE (dispatch, supports_op, the Meta split
  states, the hc_combine_mix / hc_mix / hc_combine_norm / hc_gate_mix fusion
  arms and the HC16 planar layout) in hc-mix.{cu,cuh} and hyperconn.{cu,cuh}.
- The managed lazy reader (llama-lazy-reader) and the loader's managed_budget
  (LLAMA_LAZY_BUF_MB, TENSOR_SKIP_MANAGED, lazy_read::add_range) for the PLE
  n-gram table; off by default (it measured slower than both the mmap and the
  resident path on gfx1151).
- The QSA/HC op definitions in ggml.h / ggml.c, the scheduler op allowlists, the
  CPU references, and the qwen4exp tensor-split arch gate in llama-arch.cpp (with
  the ggml-hip CMakeLists publishing GGML_USE_HIP to the main libraries so the
  dynamic-backend build reads it).
- The qwen4exp MTP draft context gets a hybrid-idx memory instead of a plain KV
  cache (LLAMA_MTP_SPARSE=0 restores the dense draft), and llama_memory_recurrent
  stops warning about the speculative verify positions for a context whose
  recurrent filter matches nothing.
- Loader/user-path fix: TENSOR_READ_LAZY is only consulted when the loader has
  files (the llama_model_init_from_user path has nothing to lazy-read from).
- The qwen4exp-family fusion arms that live in this block's own TUs, and the
  graph-optimizer passes they need: the HC_BLK16/RES16 BF16-stream marks and
  their alloc deps, and the prefill indexer relu-sum alloc dep.
- Tests: test-hc-mix and test_flash_attn_qsa in test-backend-ops (the QSA CPU
  oracle: `test-backend-ops -o FLASH_ATTN_QSA`, 18/18 minimum), test-lazy-reader,
  and the lazy_buf_size handover in test-llama-archs.

Split note (r109): the infrastructure this block is built on -- the slab, the
fusion dispatcher TU, the async input ring, the GDN/MMB/HC16 kernel work -- is
block 10 and is listed there.  A qwen4exp-only change that is implemented inside
a general kernel TU (the GDN gate/beta BF16 fusion, the HC16 MMB BF16 streams,
the weighted-down reduction, the PLE conv fusion) deliberately stays with that
TU in block 10; only the code that needs this block's own symbols is here.

- The separate-tensor (pre-ggml-org#31028) HC mixer emits its inject product right
  behind the down product, i.e. adjacent in the graph, and expands both: the two
  BF16 GEMMs read the same F32 `xn`, and the CUDA BF16 src1 cache (block 10)
  only holds one converted tensor.  ggml-org#31028's ordering (inject last, after the
  gate product whose src1 is the silu output, which evicts the entry) converted
  the whole [hc*n_embd, n_tok] tensor twice per mixer -- measured on Flash-Next
  GSQ-IQ3_XXS as 2x the F32->BF16 `convert_unary_cont_vec4` launches and +3.4 %
  prefill when restored (issue ggml-org#226 follow-up).
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Oct 28, 2026
…r, QSA/indexer)

The qwen4exp (Qwen3.8-Flash-Next) architecture support, split out of the old
block 10 (r109) so the model graph, the sparse-attention op and the
hyper-connections no longer share a commit with the slab, the fusion dispatcher
and the async input ring.  The tree is unchanged: block 10 plus this commit is
exactly what the old block 10 carried.

Contents:

- src/models/qwen4exp.cpp: the model, the HC (hyper-connection) graph, the MTP
  draft head, the PLE gather, the QSA selection/attention graph
  (build_qsa_store_k / build_qsa_top_k / build_attn_qsa) and the QSA arm policy.
- QSA/indexer: fattn-qsa.{cu,cuh}, fattn-qsa3.cu, indexer-score.{cu,cuh},
  indexer-topk.{cu,cuh}, the 4-head WMMA indexer scorer in lightning-indexer.cu,
  with the CUDA dispatch (GGML_OP_FLASH_ATTN_QSA / INDEXER_TOPK / INDEXER_SCORE /
  INDEXER_FILL) and their CPU references; the keys-only indexer cache
  (LLAMA_QSA_KEYS_ONLY, no V tensor at all) in llama-memory-hybrid-idx and the
  v_enabled parameter on llama_kv_cache.
- HC ops GGML_OP_HC_MIX / HC_COMBINE (dispatch, supports_op, the Meta split
  states, the hc_combine_mix / hc_mix / hc_combine_norm / hc_gate_mix fusion
  arms and the HC16 planar layout) in hc-mix.{cu,cuh} and hyperconn.{cu,cuh}.
- The managed lazy reader (llama-lazy-reader) and the loader's managed_budget
  (LLAMA_LAZY_BUF_MB, TENSOR_SKIP_MANAGED, lazy_read::add_range) for the PLE
  n-gram table; off by default (it measured slower than both the mmap and the
  resident path on gfx1151).
- The QSA/HC op definitions in ggml.h / ggml.c, the scheduler op allowlists, the
  CPU references, and the qwen4exp tensor-split arch gate in llama-arch.cpp (with
  the ggml-hip CMakeLists publishing GGML_USE_HIP to the main libraries so the
  dynamic-backend build reads it).
- The qwen4exp MTP draft context gets a hybrid-idx memory instead of a plain KV
  cache (LLAMA_MTP_SPARSE=0 restores the dense draft), and llama_memory_recurrent
  stops warning about the speculative verify positions for a context whose
  recurrent filter matches nothing.
- Loader/user-path fix: TENSOR_READ_LAZY is only consulted when the loader has
  files (the llama_model_init_from_user path has nothing to lazy-read from).
- The qwen4exp-family fusion arms that live in this block's own TUs, and the
  graph-optimizer passes they need: the HC_BLK16/RES16 BF16-stream marks and
  their alloc deps, and the prefill indexer relu-sum alloc dep.
- Tests: test-hc-mix and test_flash_attn_qsa in test-backend-ops (the QSA CPU
  oracle: `test-backend-ops -o FLASH_ATTN_QSA`, 18/18 minimum), test-lazy-reader,
  and the lazy_buf_size handover in test-llama-archs.

Split note (r109): the infrastructure this block is built on -- the slab, the
fusion dispatcher TU, the async input ring, the GDN/MMB/HC16 kernel work -- is
block 10 and is listed there.  A qwen4exp-only change that is implemented inside
a general kernel TU (the GDN gate/beta BF16 fusion, the HC16 MMB BF16 streams,
the weighted-down reduction, the PLE conv fusion) deliberately stays with that
TU in block 10; only the code that needs this block's own symbols is here.

- The separate-tensor (pre-ggml-org#31028) HC mixer emits its inject product right
  behind the down product, i.e. adjacent in the graph, and expands both: the two
  BF16 GEMMs read the same F32 `xn`, and the CUDA BF16 src1 cache (block 10)
  only holds one converted tensor.  ggml-org#31028's ordering (inject last, after the
  gate product whose src1 is the silu output, which evicts the entry) converted
  the whole [hc*n_embd, n_tok] tensor twice per mixer -- measured on Flash-Next
  GSQ-IQ3_XXS as 2x the F32->BF16 `convert_unary_cont_vec4` launches and +3.4 %
  prefill when restored (issue ggml-org#226 follow-up).
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Oct 28, 2026
…r, QSA/indexer)

The qwen4exp (Qwen3.8-Flash-Next) architecture support, split out of the old
block 10 (r109) so the model graph, the sparse-attention op and the
hyper-connections no longer share a commit with the slab, the fusion dispatcher
and the async input ring.  The tree is unchanged: block 10 plus this commit is
exactly what the old block 10 carried.

Contents:

- src/models/qwen4exp.cpp: the model, the HC (hyper-connection) graph, the MTP
  draft head, the PLE gather, the QSA selection/attention graph
  (build_qsa_store_k / build_qsa_top_k / build_attn_qsa) and the QSA arm policy.
- QSA/indexer: fattn-qsa.{cu,cuh}, fattn-qsa3.cu, indexer-score.{cu,cuh},
  indexer-topk.{cu,cuh}, the 4-head WMMA indexer scorer in lightning-indexer.cu,
  with the CUDA dispatch (GGML_OP_FLASH_ATTN_QSA / INDEXER_TOPK / INDEXER_SCORE /
  INDEXER_FILL) and their CPU references; the keys-only indexer cache
  (LLAMA_QSA_KEYS_ONLY, no V tensor at all) in llama-memory-hybrid-idx and the
  v_enabled parameter on llama_kv_cache.
- HC ops GGML_OP_HC_MIX / HC_COMBINE (dispatch, supports_op, the Meta split
  states, the hc_combine_mix / hc_mix / hc_combine_norm / hc_gate_mix fusion
  arms and the HC16 planar layout) in hc-mix.{cu,cuh} and hyperconn.{cu,cuh}.
- The managed lazy reader (llama-lazy-reader) and the loader's managed_budget
  (LLAMA_LAZY_BUF_MB, TENSOR_SKIP_MANAGED, lazy_read::add_range) for the PLE
  n-gram table; off by default (it measured slower than both the mmap and the
  resident path on gfx1151).
- The QSA/HC op definitions in ggml.h / ggml.c, the scheduler op allowlists, the
  CPU references, and the qwen4exp tensor-split arch gate in llama-arch.cpp (with
  the ggml-hip CMakeLists publishing GGML_USE_HIP to the main libraries so the
  dynamic-backend build reads it).
- The qwen4exp MTP draft context gets a hybrid-idx memory instead of a plain KV
  cache (LLAMA_MTP_SPARSE=0 restores the dense draft), and llama_memory_recurrent
  stops warning about the speculative verify positions for a context whose
  recurrent filter matches nothing.
- Loader/user-path fix: TENSOR_READ_LAZY is only consulted when the loader has
  files (the llama_model_init_from_user path has nothing to lazy-read from).
- The qwen4exp-family fusion arms that live in this block's own TUs, and the
  graph-optimizer passes they need: the HC_BLK16/RES16 BF16-stream marks and
  their alloc deps, and the prefill indexer relu-sum alloc dep.
- Tests: test-hc-mix and test_flash_attn_qsa in test-backend-ops (the QSA CPU
  oracle: `test-backend-ops -o FLASH_ATTN_QSA`, 18/18 minimum), test-lazy-reader,
  and the lazy_buf_size handover in test-llama-archs.

Split note (r109): the infrastructure this block is built on -- the slab, the
fusion dispatcher TU, the async input ring, the GDN/MMB/HC16 kernel work -- is
block 10 and is listed there.  A qwen4exp-only change that is implemented inside
a general kernel TU (the GDN gate/beta BF16 fusion, the HC16 MMB BF16 streams,
the weighted-down reduction, the PLE conv fusion) deliberately stays with that
TU in block 10; only the code that needs this block's own symbols is here.

- The separate-tensor (pre-ggml-org#31028) HC mixer emits its inject product right
  behind the down product, i.e. adjacent in the graph, and expands both: the two
  BF16 GEMMs read the same F32 `xn`, and the CUDA BF16 src1 cache (block 10)
  only holds one converted tensor.  ggml-org#31028's ordering (inject last, after the
  gate product whose src1 is the silu output, which evicts the entry) converted
  the whole [hc*n_embd, n_tok] tensor twice per mixer -- measured on Flash-Next
  GSQ-IQ3_XXS as 2x the F32->BF16 `convert_unary_cont_vec4` launches and +3.4 %
  prefill when restored (issue ggml-org#226 follow-up).
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Oct 31, 2026
…r, QSA/indexer)

The qwen4exp (Qwen3.8-Flash-Next) architecture support, split out of the old
block 10 (r109) so the model graph, the sparse-attention op and the
hyper-connections no longer share a commit with the slab, the fusion dispatcher
and the async input ring.  The tree is unchanged: block 10 plus this commit is
exactly what the old block 10 carried.

Contents:

- src/models/qwen4exp.cpp: the model, the HC (hyper-connection) graph, the MTP
  draft head, the PLE gather, the QSA selection/attention graph
  (build_qsa_store_k / build_qsa_top_k / build_attn_qsa) and the QSA arm policy.
- QSA/indexer: fattn-qsa.{cu,cuh}, fattn-qsa3.cu, indexer-score.{cu,cuh},
  indexer-topk.{cu,cuh}, the 4-head WMMA indexer scorer in lightning-indexer.cu,
  with the CUDA dispatch (GGML_OP_FLASH_ATTN_QSA / INDEXER_TOPK / INDEXER_SCORE /
  INDEXER_FILL) and their CPU references; the keys-only indexer cache
  (LLAMA_QSA_KEYS_ONLY, no V tensor at all) in llama-memory-hybrid-idx and the
  v_enabled parameter on llama_kv_cache.
- HC ops GGML_OP_HC_MIX / HC_COMBINE (dispatch, supports_op, the Meta split
  states, the hc_combine_mix / hc_mix / hc_combine_norm / hc_gate_mix fusion
  arms and the HC16 planar layout) in hc-mix.{cu,cuh} and hyperconn.{cu,cuh}.
- The managed lazy reader (llama-lazy-reader) and the loader's managed_budget
  (LLAMA_LAZY_BUF_MB, TENSOR_SKIP_MANAGED, lazy_read::add_range) for the PLE
  n-gram table; off by default (it measured slower than both the mmap and the
  resident path on gfx1151).
- The QSA/HC op definitions in ggml.h / ggml.c, the scheduler op allowlists, the
  CPU references, and the qwen4exp tensor-split arch gate in llama-arch.cpp (with
  the ggml-hip CMakeLists publishing GGML_USE_HIP to the main libraries so the
  dynamic-backend build reads it).
- The qwen4exp MTP draft context gets a hybrid-idx memory instead of a plain KV
  cache (LLAMA_MTP_SPARSE=0 restores the dense draft), and llama_memory_recurrent
  stops warning about the speculative verify positions for a context whose
  recurrent filter matches nothing.
- Loader/user-path fix: TENSOR_READ_LAZY is only consulted when the loader has
  files (the llama_model_init_from_user path has nothing to lazy-read from).
- The qwen4exp-family fusion arms that live in this block's own TUs, and the
  graph-optimizer passes they need: the HC_BLK16/RES16 BF16-stream marks and
  their alloc deps, and the prefill indexer relu-sum alloc dep.
- Tests: test-hc-mix and test_flash_attn_qsa in test-backend-ops (the QSA CPU
  oracle: `test-backend-ops -o FLASH_ATTN_QSA`, 18/18 minimum), test-lazy-reader,
  and the lazy_buf_size handover in test-llama-archs.

Split note (r109): the infrastructure this block is built on -- the slab, the
fusion dispatcher TU, the async input ring, the GDN/MMB/HC16 kernel work -- is
block 10 and is listed there.  A qwen4exp-only change that is implemented inside
a general kernel TU (the GDN gate/beta BF16 fusion, the HC16 MMB BF16 streams,
the weighted-down reduction, the PLE conv fusion) deliberately stays with that
TU in block 10; only the code that needs this block's own symbols is here.

- The separate-tensor (pre-ggml-org#31028) HC mixer emits its inject product right
  behind the down product, i.e. adjacent in the graph, and expands both: the two
  BF16 GEMMs read the same F32 `xn`, and the CUDA BF16 src1 cache (block 10)
  only holds one converted tensor.  ggml-org#31028's ordering (inject last, after the
  gate product whose src1 is the silu output, which evicts the entry) converted
  the whole [hc*n_embd, n_tok] tensor twice per mixer -- measured on Flash-Next
  GSQ-IQ3_XXS as 2x the F32->BF16 `convert_unary_cont_vec4` launches and +3.4 %
  prefill when restored (issue ggml-org#226 follow-up).

R175 amendment: the QSA combine launch passes the new `block_q8_1 * q8` argument
of `flash_attn_combine_results` (added by block 10's FA-combine Q8_1 publish) as
`nullptr` -- QSA's output is not fed to a quantized matmul, so it publishes
nothing.
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Oct 31, 2026
…r, QSA/indexer)

The qwen4exp (Qwen3.8-Flash-Next) architecture support, split out of the old
block 10 (r109) so the model graph, the sparse-attention op and the
hyper-connections no longer share a commit with the slab, the fusion dispatcher
and the async input ring.  The tree is unchanged: block 10 plus this commit is
exactly what the old block 10 carried.

Contents:

- src/models/qwen4exp.cpp: the model, the HC (hyper-connection) graph, the MTP
  draft head, the PLE gather, the QSA selection/attention graph
  (build_qsa_store_k / build_qsa_top_k / build_attn_qsa) and the QSA arm policy.
- QSA/indexer: fattn-qsa.{cu,cuh}, fattn-qsa3.cu, indexer-score.{cu,cuh},
  indexer-topk.{cu,cuh}, the 4-head WMMA indexer scorer in lightning-indexer.cu,
  with the CUDA dispatch (GGML_OP_FLASH_ATTN_QSA / INDEXER_TOPK / INDEXER_SCORE /
  INDEXER_FILL) and their CPU references; the keys-only indexer cache
  (LLAMA_QSA_KEYS_ONLY, no V tensor at all) in llama-memory-hybrid-idx and the
  v_enabled parameter on llama_kv_cache.
- HC ops GGML_OP_HC_MIX / HC_COMBINE (dispatch, supports_op, the Meta split
  states, the hc_combine_mix / hc_mix / hc_combine_norm / hc_gate_mix fusion
  arms and the HC16 planar layout) in hc-mix.{cu,cuh} and hyperconn.{cu,cuh}.
- The managed lazy reader (llama-lazy-reader) and the loader's managed_budget
  (LLAMA_LAZY_BUF_MB, TENSOR_SKIP_MANAGED, lazy_read::add_range) for the PLE
  n-gram table; off by default (it measured slower than both the mmap and the
  resident path on gfx1151).
- The QSA/HC op definitions in ggml.h / ggml.c, the scheduler op allowlists, the
  CPU references, and the qwen4exp tensor-split arch gate in llama-arch.cpp (with
  the ggml-hip CMakeLists publishing GGML_USE_HIP to the main libraries so the
  dynamic-backend build reads it).
- The qwen4exp MTP draft context gets a hybrid-idx memory instead of a plain KV
  cache (LLAMA_MTP_SPARSE=0 restores the dense draft), and llama_memory_recurrent
  stops warning about the speculative verify positions for a context whose
  recurrent filter matches nothing.
- Loader/user-path fix: TENSOR_READ_LAZY is only consulted when the loader has
  files (the llama_model_init_from_user path has nothing to lazy-read from).
- The qwen4exp-family fusion arms that live in this block's own TUs, and the
  graph-optimizer passes they need: the HC_BLK16/RES16 BF16-stream marks and
  their alloc deps, and the prefill indexer relu-sum alloc dep.
- Tests: test-hc-mix and test_flash_attn_qsa in test-backend-ops (the QSA CPU
  oracle: `test-backend-ops -o FLASH_ATTN_QSA`, 18/18 minimum), test-lazy-reader,
  and the lazy_buf_size handover in test-llama-archs.

Split note (r109): the infrastructure this block is built on -- the slab, the
fusion dispatcher TU, the async input ring, the GDN/MMB/HC16 kernel work -- is
block 10 and is listed there.  A qwen4exp-only change that is implemented inside
a general kernel TU (the GDN gate/beta BF16 fusion, the HC16 MMB BF16 streams,
the weighted-down reduction, the PLE conv fusion) deliberately stays with that
TU in block 10; only the code that needs this block's own symbols is here.

- The separate-tensor (pre-ggml-org#31028) HC mixer emits its inject product right
  behind the down product, i.e. adjacent in the graph, and expands both: the two
  BF16 GEMMs read the same F32 `xn`, and the CUDA BF16 src1 cache (block 10)
  only holds one converted tensor.  ggml-org#31028's ordering (inject last, after the
  gate product whose src1 is the silu output, which evicts the entry) converted
  the whole [hc*n_embd, n_tok] tensor twice per mixer -- measured on Flash-Next
  GSQ-IQ3_XXS as 2x the F32->BF16 `convert_unary_cont_vec4` launches and +3.4 %
  prefill when restored (issue ggml-org#226 follow-up).

R175 amendment: the QSA combine launch passes the new `block_q8_1 * q8` argument
of `flash_attn_combine_results` (added by block 10's FA-combine Q8_1 publish) as
`nullptr` -- QSA's output is not fed to a quantized matmul, so it publishes
nothing.
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Oct 31, 2026
…r, QSA/indexer)

The qwen4exp (Qwen3.8-Flash-Next) architecture support, split out of the old
block 10 (r109) so the model graph, the sparse-attention op and the
hyper-connections no longer share a commit with the slab, the fusion dispatcher
and the async input ring.  The tree is unchanged: block 10 plus this commit is
exactly what the old block 10 carried.

Contents:

- src/models/qwen4exp.cpp: the model, the HC (hyper-connection) graph, the MTP
  draft head, the PLE gather, the QSA selection/attention graph
  (build_qsa_store_k / build_qsa_top_k / build_attn_qsa) and the QSA arm policy.
- QSA/indexer: fattn-qsa.{cu,cuh}, fattn-qsa3.cu, indexer-score.{cu,cuh},
  indexer-topk.{cu,cuh}, the 4-head WMMA indexer scorer in lightning-indexer.cu,
  with the CUDA dispatch (GGML_OP_FLASH_ATTN_QSA / INDEXER_TOPK / INDEXER_SCORE /
  INDEXER_FILL) and their CPU references; the keys-only indexer cache
  (LLAMA_QSA_KEYS_ONLY, no V tensor at all) in llama-memory-hybrid-idx and the
  v_enabled parameter on llama_kv_cache.
- HC ops GGML_OP_HC_MIX / HC_COMBINE (dispatch, supports_op, the Meta split
  states, the hc_combine_mix / hc_mix / hc_combine_norm / hc_gate_mix fusion
  arms and the HC16 planar layout) in hc-mix.{cu,cuh} and hyperconn.{cu,cuh}.
- The managed lazy reader (llama-lazy-reader) and the loader's managed_budget
  (LLAMA_LAZY_BUF_MB, TENSOR_SKIP_MANAGED, lazy_read::add_range) for the PLE
  n-gram table; off by default (it measured slower than both the mmap and the
  resident path on gfx1151).
- The QSA/HC op definitions in ggml.h / ggml.c, the scheduler op allowlists, the
  CPU references, and the qwen4exp tensor-split arch gate in llama-arch.cpp (with
  the ggml-hip CMakeLists publishing GGML_USE_HIP to the main libraries so the
  dynamic-backend build reads it).
- The qwen4exp MTP draft context gets a hybrid-idx memory instead of a plain KV
  cache (LLAMA_MTP_SPARSE=0 restores the dense draft), and llama_memory_recurrent
  stops warning about the speculative verify positions for a context whose
  recurrent filter matches nothing.
- Loader/user-path fix: TENSOR_READ_LAZY is only consulted when the loader has
  files (the llama_model_init_from_user path has nothing to lazy-read from).
- The qwen4exp-family fusion arms that live in this block's own TUs, and the
  graph-optimizer passes they need: the HC_BLK16/RES16 BF16-stream marks and
  their alloc deps, and the prefill indexer relu-sum alloc dep.
- Tests: test-hc-mix and test_flash_attn_qsa in test-backend-ops (the QSA CPU
  oracle: `test-backend-ops -o FLASH_ATTN_QSA`, 18/18 minimum), test-lazy-reader,
  and the lazy_buf_size handover in test-llama-archs.

Split note (r109): the infrastructure this block is built on -- the slab, the
fusion dispatcher TU, the async input ring, the GDN/MMB/HC16 kernel work -- is
block 10 and is listed there.  A qwen4exp-only change that is implemented inside
a general kernel TU (the GDN gate/beta BF16 fusion, the HC16 MMB BF16 streams,
the weighted-down reduction, the PLE conv fusion) deliberately stays with that
TU in block 10; only the code that needs this block's own symbols is here.

- The separate-tensor (pre-ggml-org#31028) HC mixer emits its inject product right
  behind the down product, i.e. adjacent in the graph, and expands both: the two
  BF16 GEMMs read the same F32 `xn`, and the CUDA BF16 src1 cache (block 10)
  only holds one converted tensor.  ggml-org#31028's ordering (inject last, after the
  gate product whose src1 is the silu output, which evicts the entry) converted
  the whole [hc*n_embd, n_tok] tensor twice per mixer -- measured on Flash-Next
  GSQ-IQ3_XXS as 2x the F32->BF16 `convert_unary_cont_vec4` launches and +3.4 %
  prefill when restored (issue ggml-org#226 follow-up).

R175 amendment: the QSA combine launch passes the new `block_q8_1 * q8` argument
of `flash_attn_combine_results` (added by block 10's FA-combine Q8_1 publish) as
`nullptr` -- QSA's output is not fed to a quantized matmul, so it publishes
nothing.
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Oct 31, 2026
…r, QSA/indexer)

The qwen4exp (Qwen3.8-Flash-Next) architecture support, split out of the old
block 10 (r109) so the model graph, the sparse-attention op and the
hyper-connections no longer share a commit with the slab, the fusion dispatcher
and the async input ring.  The tree is unchanged: block 10 plus this commit is
exactly what the old block 10 carried.

Contents:

- src/models/qwen4exp.cpp: the model, the HC (hyper-connection) graph, the MTP
  draft head, the PLE gather, the QSA selection/attention graph
  (build_qsa_store_k / build_qsa_top_k / build_attn_qsa) and the QSA arm policy.
- QSA/indexer: fattn-qsa.{cu,cuh}, fattn-qsa3.cu, indexer-score.{cu,cuh},
  indexer-topk.{cu,cuh}, the 4-head WMMA indexer scorer in lightning-indexer.cu,
  with the CUDA dispatch (GGML_OP_FLASH_ATTN_QSA / INDEXER_TOPK / INDEXER_SCORE /
  INDEXER_FILL) and their CPU references; the keys-only indexer cache
  (LLAMA_QSA_KEYS_ONLY, no V tensor at all) in llama-memory-hybrid-idx and the
  v_enabled parameter on llama_kv_cache.
- HC ops GGML_OP_HC_MIX / HC_COMBINE (dispatch, supports_op, the Meta split
  states, the hc_combine_mix / hc_mix / hc_combine_norm / hc_gate_mix fusion
  arms and the HC16 planar layout) in hc-mix.{cu,cuh} and hyperconn.{cu,cuh}.
- The managed lazy reader (llama-lazy-reader) and the loader's managed_budget
  (LLAMA_LAZY_BUF_MB, TENSOR_SKIP_MANAGED, lazy_read::add_range) for the PLE
  n-gram table; off by default (it measured slower than both the mmap and the
  resident path on gfx1151).
- The QSA/HC op definitions in ggml.h / ggml.c, the scheduler op allowlists, the
  CPU references, and the qwen4exp tensor-split arch gate in llama-arch.cpp (with
  the ggml-hip CMakeLists publishing GGML_USE_HIP to the main libraries so the
  dynamic-backend build reads it).
- The qwen4exp MTP draft context gets a hybrid-idx memory instead of a plain KV
  cache (LLAMA_MTP_SPARSE=0 restores the dense draft), and llama_memory_recurrent
  stops warning about the speculative verify positions for a context whose
  recurrent filter matches nothing.
- Loader/user-path fix: TENSOR_READ_LAZY is only consulted when the loader has
  files (the llama_model_init_from_user path has nothing to lazy-read from).
- The qwen4exp-family fusion arms that live in this block's own TUs, and the
  graph-optimizer passes they need: the HC_BLK16/RES16 BF16-stream marks and
  their alloc deps, and the prefill indexer relu-sum alloc dep.
- Tests: test-hc-mix and test_flash_attn_qsa in test-backend-ops (the QSA CPU
  oracle: `test-backend-ops -o FLASH_ATTN_QSA`, 18/18 minimum), test-lazy-reader,
  and the lazy_buf_size handover in test-llama-archs.

Split note (r109): the infrastructure this block is built on -- the slab, the
fusion dispatcher TU, the async input ring, the GDN/MMB/HC16 kernel work -- is
block 10 and is listed there.  A qwen4exp-only change that is implemented inside
a general kernel TU (the GDN gate/beta BF16 fusion, the HC16 MMB BF16 streams,
the weighted-down reduction, the PLE conv fusion) deliberately stays with that
TU in block 10; only the code that needs this block's own symbols is here.

- The separate-tensor (pre-ggml-org#31028) HC mixer emits its inject product right
  behind the down product, i.e. adjacent in the graph, and expands both: the two
  BF16 GEMMs read the same F32 `xn`, and the CUDA BF16 src1 cache (block 10)
  only holds one converted tensor.  ggml-org#31028's ordering (inject last, after the
  gate product whose src1 is the silu output, which evicts the entry) converted
  the whole [hc*n_embd, n_tok] tensor twice per mixer -- measured on Flash-Next
  GSQ-IQ3_XXS as 2x the F32->BF16 `convert_unary_cont_vec4` launches and +3.4 %
  prefill when restored (issue ggml-org#226 follow-up).

R175 amendment: the QSA combine launch passes the new `block_q8_1 * q8` argument
of `flash_attn_combine_results` (added by block 10's FA-combine Q8_1 publish) as
`nullptr` -- QSA's output is not fed to a quantized matmul, so it publishes
nothing.
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Oct 31, 2026
…r, QSA/indexer)

The qwen4exp (Qwen3.8-Flash-Next) architecture support, split out of the old
block 10 (r109) so the model graph, the sparse-attention op and the
hyper-connections no longer share a commit with the slab, the fusion dispatcher
and the async input ring.  The tree is unchanged: block 10 plus this commit is
exactly what the old block 10 carried.

Contents:

- src/models/qwen4exp.cpp: the model, the HC (hyper-connection) graph, the MTP
  draft head, the PLE gather, the QSA selection/attention graph
  (build_qsa_store_k / build_qsa_top_k / build_attn_qsa) and the QSA arm policy.
- QSA/indexer: fattn-qsa.{cu,cuh}, fattn-qsa3.cu, indexer-score.{cu,cuh},
  indexer-topk.{cu,cuh}, the 4-head WMMA indexer scorer in lightning-indexer.cu,
  with the CUDA dispatch (GGML_OP_FLASH_ATTN_QSA / INDEXER_TOPK / INDEXER_SCORE /
  INDEXER_FILL) and their CPU references; the keys-only indexer cache
  (LLAMA_QSA_KEYS_ONLY, no V tensor at all) in llama-memory-hybrid-idx and the
  v_enabled parameter on llama_kv_cache.
- HC ops GGML_OP_HC_MIX / HC_COMBINE (dispatch, supports_op, the Meta split
  states, the hc_combine_mix / hc_mix / hc_combine_norm / hc_gate_mix fusion
  arms and the HC16 planar layout) in hc-mix.{cu,cuh} and hyperconn.{cu,cuh}.
- The managed lazy reader (llama-lazy-reader) and the loader's managed_budget
  (LLAMA_LAZY_BUF_MB, TENSOR_SKIP_MANAGED, lazy_read::add_range) for the PLE
  n-gram table; off by default (it measured slower than both the mmap and the
  resident path on gfx1151).
- The QSA/HC op definitions in ggml.h / ggml.c, the scheduler op allowlists, the
  CPU references, and the qwen4exp tensor-split arch gate in llama-arch.cpp (with
  the ggml-hip CMakeLists publishing GGML_USE_HIP to the main libraries so the
  dynamic-backend build reads it).
- The qwen4exp MTP draft context gets a hybrid-idx memory instead of a plain KV
  cache (LLAMA_MTP_SPARSE=0 restores the dense draft), and llama_memory_recurrent
  stops warning about the speculative verify positions for a context whose
  recurrent filter matches nothing.
- Loader/user-path fix: TENSOR_READ_LAZY is only consulted when the loader has
  files (the llama_model_init_from_user path has nothing to lazy-read from).
- The qwen4exp-family fusion arms that live in this block's own TUs, and the
  graph-optimizer passes they need: the HC_BLK16/RES16 BF16-stream marks and
  their alloc deps, and the prefill indexer relu-sum alloc dep.
- Tests: test-hc-mix and test_flash_attn_qsa in test-backend-ops (the QSA CPU
  oracle: `test-backend-ops -o FLASH_ATTN_QSA`, 18/18 minimum), test-lazy-reader,
  and the lazy_buf_size handover in test-llama-archs.

Split note (r109): the infrastructure this block is built on -- the slab, the
fusion dispatcher TU, the async input ring, the GDN/MMB/HC16 kernel work -- is
block 10 and is listed there.  A qwen4exp-only change that is implemented inside
a general kernel TU (the GDN gate/beta BF16 fusion, the HC16 MMB BF16 streams,
the weighted-down reduction, the PLE conv fusion) deliberately stays with that
TU in block 10; only the code that needs this block's own symbols is here.

- The separate-tensor (pre-ggml-org#31028) HC mixer emits its inject product right
  behind the down product, i.e. adjacent in the graph, and expands both: the two
  BF16 GEMMs read the same F32 `xn`, and the CUDA BF16 src1 cache (block 10)
  only holds one converted tensor.  ggml-org#31028's ordering (inject last, after the
  gate product whose src1 is the silu output, which evicts the entry) converted
  the whole [hc*n_embd, n_tok] tensor twice per mixer -- measured on Flash-Next
  GSQ-IQ3_XXS as 2x the F32->BF16 `convert_unary_cont_vec4` launches and +3.4 %
  prefill when restored (issue ggml-org#226 follow-up).

R175 amendment: the QSA combine launch passes the new `block_q8_1 * q8` argument
of `flash_attn_combine_results` (added by block 10's FA-combine Q8_1 publish) as
`nullptr` -- QSA's output is not fed to a quantized matmul, so it publishes
nothing.
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Oct 31, 2026
…r, QSA/indexer)

The qwen4exp (Qwen3.8-Flash-Next) architecture support, split out of the old
block 10 (r109) so the model graph, the sparse-attention op and the
hyper-connections no longer share a commit with the slab, the fusion dispatcher
and the async input ring.  The tree is unchanged: block 10 plus this commit is
exactly what the old block 10 carried.

Contents:

- src/models/qwen4exp.cpp: the model, the HC (hyper-connection) graph, the MTP
  draft head, the PLE gather, the QSA selection/attention graph
  (build_qsa_store_k / build_qsa_top_k / build_attn_qsa) and the QSA arm policy.
- QSA/indexer: fattn-qsa.{cu,cuh}, fattn-qsa3.cu, indexer-score.{cu,cuh},
  indexer-topk.{cu,cuh}, the 4-head WMMA indexer scorer in lightning-indexer.cu,
  with the CUDA dispatch (GGML_OP_FLASH_ATTN_QSA / INDEXER_TOPK / INDEXER_SCORE /
  INDEXER_FILL) and their CPU references; the keys-only indexer cache
  (LLAMA_QSA_KEYS_ONLY, no V tensor at all) in llama-memory-hybrid-idx and the
  v_enabled parameter on llama_kv_cache.
- HC ops GGML_OP_HC_MIX / HC_COMBINE (dispatch, supports_op, the Meta split
  states, the hc_combine_mix / hc_mix / hc_combine_norm / hc_gate_mix fusion
  arms and the HC16 planar layout) in hc-mix.{cu,cuh} and hyperconn.{cu,cuh}.
- The managed lazy reader (llama-lazy-reader) and the loader's managed_budget
  (LLAMA_LAZY_BUF_MB, TENSOR_SKIP_MANAGED, lazy_read::add_range) for the PLE
  n-gram table; off by default (it measured slower than both the mmap and the
  resident path on gfx1151).
- The QSA/HC op definitions in ggml.h / ggml.c, the scheduler op allowlists, the
  CPU references, and the qwen4exp tensor-split arch gate in llama-arch.cpp (with
  the ggml-hip CMakeLists publishing GGML_USE_HIP to the main libraries so the
  dynamic-backend build reads it).
- The qwen4exp MTP draft context gets a hybrid-idx memory instead of a plain KV
  cache (LLAMA_MTP_SPARSE=0 restores the dense draft), and llama_memory_recurrent
  stops warning about the speculative verify positions for a context whose
  recurrent filter matches nothing.
- Loader/user-path fix: TENSOR_READ_LAZY is only consulted when the loader has
  files (the llama_model_init_from_user path has nothing to lazy-read from).
- The qwen4exp-family fusion arms that live in this block's own TUs, and the
  graph-optimizer passes they need: the HC_BLK16/RES16 BF16-stream marks and
  their alloc deps, and the prefill indexer relu-sum alloc dep.
- Tests: test-hc-mix and test_flash_attn_qsa in test-backend-ops (the QSA CPU
  oracle: `test-backend-ops -o FLASH_ATTN_QSA`, 18/18 minimum), test-lazy-reader,
  and the lazy_buf_size handover in test-llama-archs.

Split note (r109): the infrastructure this block is built on -- the slab, the
fusion dispatcher TU, the async input ring, the GDN/MMB/HC16 kernel work -- is
block 10 and is listed there.  A qwen4exp-only change that is implemented inside
a general kernel TU (the GDN gate/beta BF16 fusion, the HC16 MMB BF16 streams,
the weighted-down reduction, the PLE conv fusion) deliberately stays with that
TU in block 10; only the code that needs this block's own symbols is here.

- The separate-tensor (pre-ggml-org#31028) HC mixer emits its inject product right
  behind the down product, i.e. adjacent in the graph, and expands both: the two
  BF16 GEMMs read the same F32 `xn`, and the CUDA BF16 src1 cache (block 10)
  only holds one converted tensor.  ggml-org#31028's ordering (inject last, after the
  gate product whose src1 is the silu output, which evicts the entry) converted
  the whole [hc*n_embd, n_tok] tensor twice per mixer -- measured on Flash-Next
  GSQ-IQ3_XXS as 2x the F32->BF16 `convert_unary_cont_vec4` launches and +3.4 %
  prefill when restored (issue ggml-org#226 follow-up).

R175 amendment: the QSA combine launch passes the new `block_q8_1 * q8` argument
of `flash_attn_combine_results` (added by block 10's FA-combine Q8_1 publish) as
`nullptr` -- QSA's output is not fed to a quantized matmul, so it publishes
nothing.
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Nov 1, 2026
…r, QSA/indexer)

The qwen4exp (Qwen3.8-Flash-Next) architecture support, split out of the old
block 10 (r109) so the model graph, the sparse-attention op and the
hyper-connections no longer share a commit with the slab, the fusion dispatcher
and the async input ring.  The tree is unchanged: block 10 plus this commit is
exactly what the old block 10 carried.

Contents:

- src/models/qwen4exp.cpp: the model, the HC (hyper-connection) graph, the MTP
  draft head, the PLE gather, the QSA selection/attention graph
  (build_qsa_store_k / build_qsa_top_k / build_attn_qsa) and the QSA arm policy.
- QSA/indexer: fattn-qsa.{cu,cuh}, fattn-qsa3.cu, indexer-score.{cu,cuh},
  indexer-topk.{cu,cuh}, the 4-head WMMA indexer scorer in lightning-indexer.cu,
  with the CUDA dispatch (GGML_OP_FLASH_ATTN_QSA / INDEXER_TOPK / INDEXER_SCORE /
  INDEXER_FILL) and their CPU references; the keys-only indexer cache
  (LLAMA_QSA_KEYS_ONLY, no V tensor at all) in llama-memory-hybrid-idx and the
  v_enabled parameter on llama_kv_cache.
- HC ops GGML_OP_HC_MIX / HC_COMBINE (dispatch, supports_op, the Meta split
  states, the hc_combine_mix / hc_mix / hc_combine_norm / hc_gate_mix fusion
  arms and the HC16 planar layout) in hc-mix.{cu,cuh} and hyperconn.{cu,cuh}.
- The managed lazy reader (llama-lazy-reader) and the loader's managed_budget
  (LLAMA_LAZY_BUF_MB, TENSOR_SKIP_MANAGED, lazy_read::add_range) for the PLE
  n-gram table; off by default (it measured slower than both the mmap and the
  resident path on gfx1151).
- The QSA/HC op definitions in ggml.h / ggml.c, the scheduler op allowlists, the
  CPU references, and the qwen4exp tensor-split arch gate in llama-arch.cpp (with
  the ggml-hip CMakeLists publishing GGML_USE_HIP to the main libraries so the
  dynamic-backend build reads it).
- The qwen4exp MTP draft context gets a hybrid-idx memory instead of a plain KV
  cache (LLAMA_MTP_SPARSE=0 restores the dense draft), and llama_memory_recurrent
  stops warning about the speculative verify positions for a context whose
  recurrent filter matches nothing.
- Loader/user-path fix: TENSOR_READ_LAZY is only consulted when the loader has
  files (the llama_model_init_from_user path has nothing to lazy-read from).
- The qwen4exp-family fusion arms that live in this block's own TUs, and the
  graph-optimizer passes they need: the HC_BLK16/RES16 BF16-stream marks and
  their alloc deps, and the prefill indexer relu-sum alloc dep.
- Tests: test-hc-mix and test_flash_attn_qsa in test-backend-ops (the QSA CPU
  oracle: `test-backend-ops -o FLASH_ATTN_QSA`, 18/18 minimum), test-lazy-reader,
  and the lazy_buf_size handover in test-llama-archs.

Split note (r109): the infrastructure this block is built on -- the slab, the
fusion dispatcher TU, the async input ring, the GDN/MMB/HC16 kernel work -- is
block 10 and is listed there.  A qwen4exp-only change that is implemented inside
a general kernel TU (the GDN gate/beta BF16 fusion, the HC16 MMB BF16 streams,
the weighted-down reduction, the PLE conv fusion) deliberately stays with that
TU in block 10; only the code that needs this block's own symbols is here.

- The separate-tensor (pre-ggml-org#31028) HC mixer emits its inject product right
  behind the down product, i.e. adjacent in the graph, and expands both: the two
  BF16 GEMMs read the same F32 `xn`, and the CUDA BF16 src1 cache (block 10)
  only holds one converted tensor.  ggml-org#31028's ordering (inject last, after the
  gate product whose src1 is the silu output, which evicts the entry) converted
  the whole [hc*n_embd, n_tok] tensor twice per mixer -- measured on Flash-Next
  GSQ-IQ3_XXS as 2x the F32->BF16 `convert_unary_cont_vec4` launches and +3.4 %
  prefill when restored (issue ggml-org#226 follow-up).

R175 amendment: the QSA combine launch passes the new `block_q8_1 * q8` argument
of `flash_attn_combine_results` (added by block 10's FA-combine Q8_1 publish) as
`nullptr` -- QSA's output is not fed to a quantized matmul, so it publishes
nothing.
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Nov 1, 2026
…r, QSA/indexer)

The qwen4exp (Qwen3.8-Flash-Next) architecture support, split out of the old
block 10 (r109) so the model graph, the sparse-attention op and the
hyper-connections no longer share a commit with the slab, the fusion dispatcher
and the async input ring.  The tree is unchanged: block 10 plus this commit is
exactly what the old block 10 carried.

Contents:

- src/models/qwen4exp.cpp: the model, the HC (hyper-connection) graph, the MTP
  draft head, the PLE gather, the QSA selection/attention graph
  (build_qsa_store_k / build_qsa_top_k / build_attn_qsa) and the QSA arm policy.
- QSA/indexer: fattn-qsa.{cu,cuh}, fattn-qsa3.cu, indexer-score.{cu,cuh},
  indexer-topk.{cu,cuh}, the 4-head WMMA indexer scorer in lightning-indexer.cu,
  with the CUDA dispatch (GGML_OP_FLASH_ATTN_QSA / INDEXER_TOPK / INDEXER_SCORE /
  INDEXER_FILL) and their CPU references; the keys-only indexer cache
  (LLAMA_QSA_KEYS_ONLY, no V tensor at all) in llama-memory-hybrid-idx and the
  v_enabled parameter on llama_kv_cache.
- HC ops GGML_OP_HC_MIX / HC_COMBINE (dispatch, supports_op, the Meta split
  states, the hc_combine_mix / hc_mix / hc_combine_norm / hc_gate_mix fusion
  arms and the HC16 planar layout) in hc-mix.{cu,cuh} and hyperconn.{cu,cuh}.
- The managed lazy reader (llama-lazy-reader) and the loader's managed_budget
  (LLAMA_LAZY_BUF_MB, TENSOR_SKIP_MANAGED, lazy_read::add_range) for the PLE
  n-gram table; off by default (it measured slower than both the mmap and the
  resident path on gfx1151).
- The QSA/HC op definitions in ggml.h / ggml.c, the scheduler op allowlists, the
  CPU references, and the qwen4exp tensor-split arch gate in llama-arch.cpp (with
  the ggml-hip CMakeLists publishing GGML_USE_HIP to the main libraries so the
  dynamic-backend build reads it).
- The qwen4exp MTP draft context gets a hybrid-idx memory instead of a plain KV
  cache (LLAMA_MTP_SPARSE=0 restores the dense draft), and llama_memory_recurrent
  stops warning about the speculative verify positions for a context whose
  recurrent filter matches nothing.
- Loader/user-path fix: TENSOR_READ_LAZY is only consulted when the loader has
  files (the llama_model_init_from_user path has nothing to lazy-read from).
- The qwen4exp-family fusion arms that live in this block's own TUs, and the
  graph-optimizer passes they need: the HC_BLK16/RES16 BF16-stream marks and
  their alloc deps, and the prefill indexer relu-sum alloc dep.
- Tests: test-hc-mix and test_flash_attn_qsa in test-backend-ops (the QSA CPU
  oracle: `test-backend-ops -o FLASH_ATTN_QSA`, 18/18 minimum), test-lazy-reader,
  and the lazy_buf_size handover in test-llama-archs.

Split note (r109): the infrastructure this block is built on -- the slab, the
fusion dispatcher TU, the async input ring, the GDN/MMB/HC16 kernel work -- is
block 10 and is listed there.  A qwen4exp-only change that is implemented inside
a general kernel TU (the GDN gate/beta BF16 fusion, the HC16 MMB BF16 streams,
the weighted-down reduction, the PLE conv fusion) deliberately stays with that
TU in block 10; only the code that needs this block's own symbols is here.

- The separate-tensor (pre-ggml-org#31028) HC mixer emits its inject product right
  behind the down product, i.e. adjacent in the graph, and expands both: the two
  BF16 GEMMs read the same F32 `xn`, and the CUDA BF16 src1 cache (block 10)
  only holds one converted tensor.  ggml-org#31028's ordering (inject last, after the
  gate product whose src1 is the silu output, which evicts the entry) converted
  the whole [hc*n_embd, n_tok] tensor twice per mixer -- measured on Flash-Next
  GSQ-IQ3_XXS as 2x the F32->BF16 `convert_unary_cont_vec4` launches and +3.4 %
  prefill when restored (issue ggml-org#226 follow-up).

R175 amendment: the QSA combine launch passes the new `block_q8_1 * q8` argument
of `flash_attn_combine_results` (added by block 10's FA-combine Q8_1 publish) as
`nullptr` -- QSA's output is not fed to a quantized matmul, so it publishes
nothing.
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Nov 1, 2026
…r, QSA/indexer)

The qwen4exp (Qwen3.8-Flash-Next) architecture support, split out of the old
block 10 (r109) so the model graph, the sparse-attention op and the
hyper-connections no longer share a commit with the slab, the fusion dispatcher
and the async input ring.  The tree is unchanged: block 10 plus this commit is
exactly what the old block 10 carried.

Contents:

- src/models/qwen4exp.cpp: the model, the HC (hyper-connection) graph, the MTP
  draft head, the PLE gather, the QSA selection/attention graph
  (build_qsa_store_k / build_qsa_top_k / build_attn_qsa) and the QSA arm policy.
- QSA/indexer: fattn-qsa.{cu,cuh}, fattn-qsa3.cu, indexer-score.{cu,cuh},
  indexer-topk.{cu,cuh}, the 4-head WMMA indexer scorer in lightning-indexer.cu,
  with the CUDA dispatch (GGML_OP_FLASH_ATTN_QSA / INDEXER_TOPK / INDEXER_SCORE /
  INDEXER_FILL) and their CPU references; the keys-only indexer cache
  (LLAMA_QSA_KEYS_ONLY, no V tensor at all) in llama-memory-hybrid-idx and the
  v_enabled parameter on llama_kv_cache.
- HC ops GGML_OP_HC_MIX / HC_COMBINE (dispatch, supports_op, the Meta split
  states, the hc_combine_mix / hc_mix / hc_combine_norm / hc_gate_mix fusion
  arms and the HC16 planar layout) in hc-mix.{cu,cuh} and hyperconn.{cu,cuh}.
- The managed lazy reader (llama-lazy-reader) and the loader's managed_budget
  (LLAMA_LAZY_BUF_MB, TENSOR_SKIP_MANAGED, lazy_read::add_range) for the PLE
  n-gram table; off by default (it measured slower than both the mmap and the
  resident path on gfx1151).
- The QSA/HC op definitions in ggml.h / ggml.c, the scheduler op allowlists, the
  CPU references, and the qwen4exp tensor-split arch gate in llama-arch.cpp (with
  the ggml-hip CMakeLists publishing GGML_USE_HIP to the main libraries so the
  dynamic-backend build reads it).
- The qwen4exp MTP draft context gets a hybrid-idx memory instead of a plain KV
  cache (LLAMA_MTP_SPARSE=0 restores the dense draft), and llama_memory_recurrent
  stops warning about the speculative verify positions for a context whose
  recurrent filter matches nothing.
- Loader/user-path fix: TENSOR_READ_LAZY is only consulted when the loader has
  files (the llama_model_init_from_user path has nothing to lazy-read from).
- The qwen4exp-family fusion arms that live in this block's own TUs, and the
  graph-optimizer passes they need: the HC_BLK16/RES16 BF16-stream marks and
  their alloc deps, and the prefill indexer relu-sum alloc dep.
- Tests: test-hc-mix and test_flash_attn_qsa in test-backend-ops (the QSA CPU
  oracle: `test-backend-ops -o FLASH_ATTN_QSA`, 18/18 minimum), test-lazy-reader,
  and the lazy_buf_size handover in test-llama-archs.

Split note (r109): the infrastructure this block is built on -- the slab, the
fusion dispatcher TU, the async input ring, the GDN/MMB/HC16 kernel work -- is
block 10 and is listed there.  A qwen4exp-only change that is implemented inside
a general kernel TU (the GDN gate/beta BF16 fusion, the HC16 MMB BF16 streams,
the weighted-down reduction, the PLE conv fusion) deliberately stays with that
TU in block 10; only the code that needs this block's own symbols is here.

- The separate-tensor (pre-ggml-org#31028) HC mixer emits its inject product right
  behind the down product, i.e. adjacent in the graph, and expands both: the two
  BF16 GEMMs read the same F32 `xn`, and the CUDA BF16 src1 cache (block 10)
  only holds one converted tensor.  ggml-org#31028's ordering (inject last, after the
  gate product whose src1 is the silu output, which evicts the entry) converted
  the whole [hc*n_embd, n_tok] tensor twice per mixer -- measured on Flash-Next
  GSQ-IQ3_XXS as 2x the F32->BF16 `convert_unary_cont_vec4` launches and +3.4 %
  prefill when restored (issue ggml-org#226 follow-up).

R175 amendment: the QSA combine launch passes the new `block_q8_1 * q8` argument
of `flash_attn_combine_results` (added by block 10's FA-combine Q8_1 publish) as
`nullptr` -- QSA's output is not fed to a quantized matmul, so it publishes
nothing.
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Nov 1, 2026
…r, QSA/indexer)

The qwen4exp (Qwen3.8-Flash-Next) architecture support, split out of the old
block 10 (r109) so the model graph, the sparse-attention op and the
hyper-connections no longer share a commit with the slab, the fusion dispatcher
and the async input ring.  The tree is unchanged: block 10 plus this commit is
exactly what the old block 10 carried.

Contents:

- src/models/qwen4exp.cpp: the model, the HC (hyper-connection) graph, the MTP
  draft head, the PLE gather, the QSA selection/attention graph
  (build_qsa_store_k / build_qsa_top_k / build_attn_qsa) and the QSA arm policy.
- QSA/indexer: fattn-qsa.{cu,cuh}, fattn-qsa3.cu, indexer-score.{cu,cuh},
  indexer-topk.{cu,cuh}, the 4-head WMMA indexer scorer in lightning-indexer.cu,
  with the CUDA dispatch (GGML_OP_FLASH_ATTN_QSA / INDEXER_TOPK / INDEXER_SCORE /
  INDEXER_FILL) and their CPU references; the keys-only indexer cache
  (LLAMA_QSA_KEYS_ONLY, no V tensor at all) in llama-memory-hybrid-idx and the
  v_enabled parameter on llama_kv_cache.
- HC ops GGML_OP_HC_MIX / HC_COMBINE (dispatch, supports_op, the Meta split
  states, the hc_combine_mix / hc_mix / hc_combine_norm / hc_gate_mix fusion
  arms and the HC16 planar layout) in hc-mix.{cu,cuh} and hyperconn.{cu,cuh}.
- The managed lazy reader (llama-lazy-reader) and the loader's managed_budget
  (LLAMA_LAZY_BUF_MB, TENSOR_SKIP_MANAGED, lazy_read::add_range) for the PLE
  n-gram table; off by default (it measured slower than both the mmap and the
  resident path on gfx1151).
- The QSA/HC op definitions in ggml.h / ggml.c, the scheduler op allowlists, the
  CPU references, and the qwen4exp tensor-split arch gate in llama-arch.cpp (with
  the ggml-hip CMakeLists publishing GGML_USE_HIP to the main libraries so the
  dynamic-backend build reads it).
- The qwen4exp MTP draft context gets a hybrid-idx memory instead of a plain KV
  cache (LLAMA_MTP_SPARSE=0 restores the dense draft), and llama_memory_recurrent
  stops warning about the speculative verify positions for a context whose
  recurrent filter matches nothing.
- Loader/user-path fix: TENSOR_READ_LAZY is only consulted when the loader has
  files (the llama_model_init_from_user path has nothing to lazy-read from).
- The qwen4exp-family fusion arms that live in this block's own TUs, and the
  graph-optimizer passes they need: the HC_BLK16/RES16 BF16-stream marks and
  their alloc deps, and the prefill indexer relu-sum alloc dep.
- Tests: test-hc-mix and test_flash_attn_qsa in test-backend-ops (the QSA CPU
  oracle: `test-backend-ops -o FLASH_ATTN_QSA`, 18/18 minimum), test-lazy-reader,
  and the lazy_buf_size handover in test-llama-archs.

Split note (r109): the infrastructure this block is built on -- the slab, the
fusion dispatcher TU, the async input ring, the GDN/MMB/HC16 kernel work -- is
block 10 and is listed there.  A qwen4exp-only change that is implemented inside
a general kernel TU (the GDN gate/beta BF16 fusion, the HC16 MMB BF16 streams,
the weighted-down reduction, the PLE conv fusion) deliberately stays with that
TU in block 10; only the code that needs this block's own symbols is here.

- The separate-tensor (pre-ggml-org#31028) HC mixer emits its inject product right
  behind the down product, i.e. adjacent in the graph, and expands both: the two
  BF16 GEMMs read the same F32 `xn`, and the CUDA BF16 src1 cache (block 10)
  only holds one converted tensor.  ggml-org#31028's ordering (inject last, after the
  gate product whose src1 is the silu output, which evicts the entry) converted
  the whole [hc*n_embd, n_tok] tensor twice per mixer -- measured on Flash-Next
  GSQ-IQ3_XXS as 2x the F32->BF16 `convert_unary_cont_vec4` launches and +3.4 %
  prefill when restored (issue ggml-org#226 follow-up).

R175 amendment: the QSA combine launch passes the new `block_q8_1 * q8` argument
of `flash_attn_combine_results` (added by block 10's FA-combine Q8_1 publish) as
`nullptr` -- QSA's output is not fed to a quantized matmul, so it publishes
nothing.
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Nov 1, 2026
…r, QSA/indexer)

The qwen4exp (Qwen3.8-Flash-Next) architecture support, split out of the old
block 10 (r109) so the model graph, the sparse-attention op and the
hyper-connections no longer share a commit with the slab, the fusion dispatcher
and the async input ring.  The tree is unchanged: block 10 plus this commit is
exactly what the old block 10 carried.

Contents:

- src/models/qwen4exp.cpp: the model, the HC (hyper-connection) graph, the MTP
  draft head, the PLE gather, the QSA selection/attention graph
  (build_qsa_store_k / build_qsa_top_k / build_attn_qsa) and the QSA arm policy.
- QSA/indexer: fattn-qsa.{cu,cuh}, fattn-qsa3.cu, indexer-score.{cu,cuh},
  indexer-topk.{cu,cuh}, the 4-head WMMA indexer scorer in lightning-indexer.cu,
  with the CUDA dispatch (GGML_OP_FLASH_ATTN_QSA / INDEXER_TOPK / INDEXER_SCORE /
  INDEXER_FILL) and their CPU references; the keys-only indexer cache
  (LLAMA_QSA_KEYS_ONLY, no V tensor at all) in llama-memory-hybrid-idx and the
  v_enabled parameter on llama_kv_cache.
- HC ops GGML_OP_HC_MIX / HC_COMBINE (dispatch, supports_op, the Meta split
  states, the hc_combine_mix / hc_mix / hc_combine_norm / hc_gate_mix fusion
  arms and the HC16 planar layout) in hc-mix.{cu,cuh} and hyperconn.{cu,cuh}.
- The managed lazy reader (llama-lazy-reader) and the loader's managed_budget
  (LLAMA_LAZY_BUF_MB, TENSOR_SKIP_MANAGED, lazy_read::add_range) for the PLE
  n-gram table; off by default (it measured slower than both the mmap and the
  resident path on gfx1151).
- The QSA/HC op definitions in ggml.h / ggml.c, the scheduler op allowlists, the
  CPU references, and the qwen4exp tensor-split arch gate in llama-arch.cpp (with
  the ggml-hip CMakeLists publishing GGML_USE_HIP to the main libraries so the
  dynamic-backend build reads it).
- The qwen4exp MTP draft context gets a hybrid-idx memory instead of a plain KV
  cache (LLAMA_MTP_SPARSE=0 restores the dense draft), and llama_memory_recurrent
  stops warning about the speculative verify positions for a context whose
  recurrent filter matches nothing.
- Loader/user-path fix: TENSOR_READ_LAZY is only consulted when the loader has
  files (the llama_model_init_from_user path has nothing to lazy-read from).
- The qwen4exp-family fusion arms that live in this block's own TUs, and the
  graph-optimizer passes they need: the HC_BLK16/RES16 BF16-stream marks and
  their alloc deps, and the prefill indexer relu-sum alloc dep.
- Tests: test-hc-mix and test_flash_attn_qsa in test-backend-ops (the QSA CPU
  oracle: `test-backend-ops -o FLASH_ATTN_QSA`, 18/18 minimum), test-lazy-reader,
  and the lazy_buf_size handover in test-llama-archs.

Split note (r109): the infrastructure this block is built on -- the slab, the
fusion dispatcher TU, the async input ring, the GDN/MMB/HC16 kernel work -- is
block 10 and is listed there.  A qwen4exp-only change that is implemented inside
a general kernel TU (the GDN gate/beta BF16 fusion, the HC16 MMB BF16 streams,
the weighted-down reduction, the PLE conv fusion) deliberately stays with that
TU in block 10; only the code that needs this block's own symbols is here.

- The separate-tensor (pre-ggml-org#31028) HC mixer emits its inject product right
  behind the down product, i.e. adjacent in the graph, and expands both: the two
  BF16 GEMMs read the same F32 `xn`, and the CUDA BF16 src1 cache (block 10)
  only holds one converted tensor.  ggml-org#31028's ordering (inject last, after the
  gate product whose src1 is the silu output, which evicts the entry) converted
  the whole [hc*n_embd, n_tok] tensor twice per mixer -- measured on Flash-Next
  GSQ-IQ3_XXS as 2x the F32->BF16 `convert_unary_cont_vec4` launches and +3.4 %
  prefill when restored (issue ggml-org#226 follow-up).

R175 amendment: the QSA combine launch passes the new `block_q8_1 * q8` argument
of `flash_attn_combine_results` (added by block 10's FA-combine Q8_1 publish) as
`nullptr` -- QSA's output is not fed to a quantized matmul, so it publishes
nothing.
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Nov 1, 2026
…r, QSA/indexer)

The qwen4exp (Qwen3.8-Flash-Next) architecture support, split out of the old
block 10 (r109) so the model graph, the sparse-attention op and the
hyper-connections no longer share a commit with the slab, the fusion dispatcher
and the async input ring.  The tree is unchanged: block 10 plus this commit is
exactly what the old block 10 carried.

Contents:

- src/models/qwen4exp.cpp: the model, the HC (hyper-connection) graph, the MTP
  draft head, the PLE gather, the QSA selection/attention graph
  (build_qsa_store_k / build_qsa_top_k / build_attn_qsa) and the QSA arm policy.
- QSA/indexer: fattn-qsa.{cu,cuh}, fattn-qsa3.cu, indexer-score.{cu,cuh},
  indexer-topk.{cu,cuh}, the 4-head WMMA indexer scorer in lightning-indexer.cu,
  with the CUDA dispatch (GGML_OP_FLASH_ATTN_QSA / INDEXER_TOPK / INDEXER_SCORE /
  INDEXER_FILL) and their CPU references; the keys-only indexer cache
  (LLAMA_QSA_KEYS_ONLY, no V tensor at all) in llama-memory-hybrid-idx and the
  v_enabled parameter on llama_kv_cache.
- HC ops GGML_OP_HC_MIX / HC_COMBINE (dispatch, supports_op, the Meta split
  states, the hc_combine_mix / hc_mix / hc_combine_norm / hc_gate_mix fusion
  arms and the HC16 planar layout) in hc-mix.{cu,cuh} and hyperconn.{cu,cuh}.
- The managed lazy reader (llama-lazy-reader) and the loader's managed_budget
  (LLAMA_LAZY_BUF_MB, TENSOR_SKIP_MANAGED, lazy_read::add_range) for the PLE
  n-gram table; off by default (it measured slower than both the mmap and the
  resident path on gfx1151).
- The QSA/HC op definitions in ggml.h / ggml.c, the scheduler op allowlists, the
  CPU references, and the qwen4exp tensor-split arch gate in llama-arch.cpp (with
  the ggml-hip CMakeLists publishing GGML_USE_HIP to the main libraries so the
  dynamic-backend build reads it).
- The qwen4exp MTP draft context gets a hybrid-idx memory instead of a plain KV
  cache (LLAMA_MTP_SPARSE=0 restores the dense draft), and llama_memory_recurrent
  stops warning about the speculative verify positions for a context whose
  recurrent filter matches nothing.
- Loader/user-path fix: TENSOR_READ_LAZY is only consulted when the loader has
  files (the llama_model_init_from_user path has nothing to lazy-read from).
- The qwen4exp-family fusion arms that live in this block's own TUs, and the
  graph-optimizer passes they need: the HC_BLK16/RES16 BF16-stream marks and
  their alloc deps, and the prefill indexer relu-sum alloc dep.
- Tests: test-hc-mix and test_flash_attn_qsa in test-backend-ops (the QSA CPU
  oracle: `test-backend-ops -o FLASH_ATTN_QSA`, 18/18 minimum), test-lazy-reader,
  and the lazy_buf_size handover in test-llama-archs.

Split note (r109): the infrastructure this block is built on -- the slab, the
fusion dispatcher TU, the async input ring, the GDN/MMB/HC16 kernel work -- is
block 10 and is listed there.  A qwen4exp-only change that is implemented inside
a general kernel TU (the GDN gate/beta BF16 fusion, the HC16 MMB BF16 streams,
the weighted-down reduction, the PLE conv fusion) deliberately stays with that
TU in block 10; only the code that needs this block's own symbols is here.

- The separate-tensor (pre-ggml-org#31028) HC mixer emits its inject product right
  behind the down product, i.e. adjacent in the graph, and expands both: the two
  BF16 GEMMs read the same F32 `xn`, and the CUDA BF16 src1 cache (block 10)
  only holds one converted tensor.  ggml-org#31028's ordering (inject last, after the
  gate product whose src1 is the silu output, which evicts the entry) converted
  the whole [hc*n_embd, n_tok] tensor twice per mixer -- measured on Flash-Next
  GSQ-IQ3_XXS as 2x the F32->BF16 `convert_unary_cont_vec4` launches and +3.4 %
  prefill when restored (issue ggml-org#226 follow-up).

R175 amendment: the QSA combine launch passes the new `block_q8_1 * q8` argument
of `flash_attn_combine_results` (added by block 10's FA-combine Q8_1 publish) as
`nullptr` -- QSA's output is not fed to a quantized matmul, so it publishes
nothing.
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Nov 1, 2026
…r, QSA/indexer)

The qwen4exp (Qwen3.8-Flash-Next) architecture support, split out of the old
block 10 (r109) so the model graph, the sparse-attention op and the
hyper-connections no longer share a commit with the slab, the fusion dispatcher
and the async input ring.  The tree is unchanged: block 10 plus this commit is
exactly what the old block 10 carried.

Contents:

- src/models/qwen4exp.cpp: the model, the HC (hyper-connection) graph, the MTP
  draft head, the PLE gather, the QSA selection/attention graph
  (build_qsa_store_k / build_qsa_top_k / build_attn_qsa) and the QSA arm policy.
- QSA/indexer: fattn-qsa.{cu,cuh}, fattn-qsa3.cu, indexer-score.{cu,cuh},
  indexer-topk.{cu,cuh}, the 4-head WMMA indexer scorer in lightning-indexer.cu,
  with the CUDA dispatch (GGML_OP_FLASH_ATTN_QSA / INDEXER_TOPK / INDEXER_SCORE /
  INDEXER_FILL) and their CPU references; the keys-only indexer cache
  (LLAMA_QSA_KEYS_ONLY, no V tensor at all) in llama-memory-hybrid-idx and the
  v_enabled parameter on llama_kv_cache.
- HC ops GGML_OP_HC_MIX / HC_COMBINE (dispatch, supports_op, the Meta split
  states, the hc_combine_mix / hc_mix / hc_combine_norm / hc_gate_mix fusion
  arms and the HC16 planar layout) in hc-mix.{cu,cuh} and hyperconn.{cu,cuh}.
- The managed lazy reader (llama-lazy-reader) and the loader's managed_budget
  (LLAMA_LAZY_BUF_MB, TENSOR_SKIP_MANAGED, lazy_read::add_range) for the PLE
  n-gram table; off by default (it measured slower than both the mmap and the
  resident path on gfx1151).
- The QSA/HC op definitions in ggml.h / ggml.c, the scheduler op allowlists, the
  CPU references, and the qwen4exp tensor-split arch gate in llama-arch.cpp (with
  the ggml-hip CMakeLists publishing GGML_USE_HIP to the main libraries so the
  dynamic-backend build reads it).
- The qwen4exp MTP draft context gets a hybrid-idx memory instead of a plain KV
  cache (LLAMA_MTP_SPARSE=0 restores the dense draft), and llama_memory_recurrent
  stops warning about the speculative verify positions for a context whose
  recurrent filter matches nothing.
- Loader/user-path fix: TENSOR_READ_LAZY is only consulted when the loader has
  files (the llama_model_init_from_user path has nothing to lazy-read from).
- The qwen4exp-family fusion arms that live in this block's own TUs, and the
  graph-optimizer passes they need: the HC_BLK16/RES16 BF16-stream marks and
  their alloc deps, and the prefill indexer relu-sum alloc dep.
- Tests: test-hc-mix and test_flash_attn_qsa in test-backend-ops (the QSA CPU
  oracle: `test-backend-ops -o FLASH_ATTN_QSA`, 18/18 minimum), test-lazy-reader,
  and the lazy_buf_size handover in test-llama-archs.

Split note (r109): the infrastructure this block is built on -- the slab, the
fusion dispatcher TU, the async input ring, the GDN/MMB/HC16 kernel work -- is
block 10 and is listed there.  A qwen4exp-only change that is implemented inside
a general kernel TU (the GDN gate/beta BF16 fusion, the HC16 MMB BF16 streams,
the weighted-down reduction, the PLE conv fusion) deliberately stays with that
TU in block 10; only the code that needs this block's own symbols is here.

- The separate-tensor (pre-ggml-org#31028) HC mixer emits its inject product right
  behind the down product, i.e. adjacent in the graph, and expands both: the two
  BF16 GEMMs read the same F32 `xn`, and the CUDA BF16 src1 cache (block 10)
  only holds one converted tensor.  ggml-org#31028's ordering (inject last, after the
  gate product whose src1 is the silu output, which evicts the entry) converted
  the whole [hc*n_embd, n_tok] tensor twice per mixer -- measured on Flash-Next
  GSQ-IQ3_XXS as 2x the F32->BF16 `convert_unary_cont_vec4` launches and +3.4 %
  prefill when restored (issue ggml-org#226 follow-up).

R175 amendment: the QSA combine launch passes the new `block_q8_1 * q8` argument
of `flash_attn_combine_results` (added by block 10's FA-combine Q8_1 publish) as
`nullptr` -- QSA's output is not fed to a quantized matmul, so it publishes
nothing.
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Nov 1, 2026
…r, QSA/indexer)

The qwen4exp (Qwen3.8-Flash-Next) architecture support, split out of the old
block 10 (r109) so the model graph, the sparse-attention op and the
hyper-connections no longer share a commit with the slab, the fusion dispatcher
and the async input ring.  The tree is unchanged: block 10 plus this commit is
exactly what the old block 10 carried.

Contents:

- src/models/qwen4exp.cpp: the model, the HC (hyper-connection) graph, the MTP
  draft head, the PLE gather, the QSA selection/attention graph
  (build_qsa_store_k / build_qsa_top_k / build_attn_qsa) and the QSA arm policy.
- QSA/indexer: fattn-qsa.{cu,cuh}, fattn-qsa3.cu, indexer-score.{cu,cuh},
  indexer-topk.{cu,cuh}, the 4-head WMMA indexer scorer in lightning-indexer.cu,
  with the CUDA dispatch (GGML_OP_FLASH_ATTN_QSA / INDEXER_TOPK / INDEXER_SCORE /
  INDEXER_FILL) and their CPU references; the keys-only indexer cache
  (LLAMA_QSA_KEYS_ONLY, no V tensor at all) in llama-memory-hybrid-idx and the
  v_enabled parameter on llama_kv_cache.
- HC ops GGML_OP_HC_MIX / HC_COMBINE (dispatch, supports_op, the Meta split
  states, the hc_combine_mix / hc_mix / hc_combine_norm / hc_gate_mix fusion
  arms and the HC16 planar layout) in hc-mix.{cu,cuh} and hyperconn.{cu,cuh}.
- The managed lazy reader (llama-lazy-reader) and the loader's managed_budget
  (LLAMA_LAZY_BUF_MB, TENSOR_SKIP_MANAGED, lazy_read::add_range) for the PLE
  n-gram table; off by default (it measured slower than both the mmap and the
  resident path on gfx1151).
- The QSA/HC op definitions in ggml.h / ggml.c, the scheduler op allowlists, the
  CPU references, and the qwen4exp tensor-split arch gate in llama-arch.cpp (with
  the ggml-hip CMakeLists publishing GGML_USE_HIP to the main libraries so the
  dynamic-backend build reads it).
- The qwen4exp MTP draft context gets a hybrid-idx memory instead of a plain KV
  cache (LLAMA_MTP_SPARSE=0 restores the dense draft), and llama_memory_recurrent
  stops warning about the speculative verify positions for a context whose
  recurrent filter matches nothing.
- Loader/user-path fix: TENSOR_READ_LAZY is only consulted when the loader has
  files (the llama_model_init_from_user path has nothing to lazy-read from).
- The qwen4exp-family fusion arms that live in this block's own TUs, and the
  graph-optimizer passes they need: the HC_BLK16/RES16 BF16-stream marks and
  their alloc deps, and the prefill indexer relu-sum alloc dep.
- Tests: test-hc-mix and test_flash_attn_qsa in test-backend-ops (the QSA CPU
  oracle: `test-backend-ops -o FLASH_ATTN_QSA`, 18/18 minimum), test-lazy-reader,
  and the lazy_buf_size handover in test-llama-archs.

Split note (r109): the infrastructure this block is built on -- the slab, the
fusion dispatcher TU, the async input ring, the GDN/MMB/HC16 kernel work -- is
block 10 and is listed there.  A qwen4exp-only change that is implemented inside
a general kernel TU (the GDN gate/beta BF16 fusion, the HC16 MMB BF16 streams,
the weighted-down reduction, the PLE conv fusion) deliberately stays with that
TU in block 10; only the code that needs this block's own symbols is here.

- The separate-tensor (pre-ggml-org#31028) HC mixer emits its inject product right
  behind the down product, i.e. adjacent in the graph, and expands both: the two
  BF16 GEMMs read the same F32 `xn`, and the CUDA BF16 src1 cache (block 10)
  only holds one converted tensor.  ggml-org#31028's ordering (inject last, after the
  gate product whose src1 is the silu output, which evicts the entry) converted
  the whole [hc*n_embd, n_tok] tensor twice per mixer -- measured on Flash-Next
  GSQ-IQ3_XXS as 2x the F32->BF16 `convert_unary_cont_vec4` launches and +3.4 %
  prefill when restored (issue ggml-org#226 follow-up).

R175 amendment: the QSA combine launch passes the new `block_q8_1 * q8` argument
of `flash_attn_combine_results` (added by block 10's FA-combine Q8_1 publish) as
`nullptr` -- QSA's output is not fed to a quantized matmul, so it publishes
nothing.
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Nov 2, 2026
…r, QSA/indexer)

The qwen4exp (Qwen3.8-Flash-Next) architecture support, split out of the old
block 10 (r109) so the model graph, the sparse-attention op and the
hyper-connections no longer share a commit with the slab, the fusion dispatcher
and the async input ring.  The tree is unchanged: block 10 plus this commit is
exactly what the old block 10 carried.

Contents:

- src/models/qwen4exp.cpp: the model, the HC (hyper-connection) graph, the MTP
  draft head, the PLE gather, the QSA selection/attention graph
  (build_qsa_store_k / build_qsa_top_k / build_attn_qsa) and the QSA arm policy.
- QSA/indexer: fattn-qsa.{cu,cuh}, fattn-qsa3.cu, indexer-score.{cu,cuh},
  indexer-topk.{cu,cuh}, the 4-head WMMA indexer scorer in lightning-indexer.cu,
  with the CUDA dispatch (GGML_OP_FLASH_ATTN_QSA / INDEXER_TOPK / INDEXER_SCORE /
  INDEXER_FILL) and their CPU references; the keys-only indexer cache
  (LLAMA_QSA_KEYS_ONLY, no V tensor at all) in llama-memory-hybrid-idx and the
  v_enabled parameter on llama_kv_cache.
- HC ops GGML_OP_HC_MIX / HC_COMBINE (dispatch, supports_op, the Meta split
  states, the hc_combine_mix / hc_mix / hc_combine_norm / hc_gate_mix fusion
  arms and the HC16 planar layout) in hc-mix.{cu,cuh} and hyperconn.{cu,cuh}.
- The managed lazy reader (llama-lazy-reader) and the loader's managed_budget
  (LLAMA_LAZY_BUF_MB, TENSOR_SKIP_MANAGED, lazy_read::add_range) for the PLE
  n-gram table; off by default (it measured slower than both the mmap and the
  resident path on gfx1151).
- The QSA/HC op definitions in ggml.h / ggml.c, the scheduler op allowlists, the
  CPU references, and the qwen4exp tensor-split arch gate in llama-arch.cpp (with
  the ggml-hip CMakeLists publishing GGML_USE_HIP to the main libraries so the
  dynamic-backend build reads it).
- The qwen4exp MTP draft context gets a hybrid-idx memory instead of a plain KV
  cache (LLAMA_MTP_SPARSE=0 restores the dense draft), and llama_memory_recurrent
  stops warning about the speculative verify positions for a context whose
  recurrent filter matches nothing.
- Loader/user-path fix: TENSOR_READ_LAZY is only consulted when the loader has
  files (the llama_model_init_from_user path has nothing to lazy-read from).
- The qwen4exp-family fusion arms that live in this block's own TUs, and the
  graph-optimizer passes they need: the HC_BLK16/RES16 BF16-stream marks and
  their alloc deps, and the prefill indexer relu-sum alloc dep.
- Tests: test-hc-mix and test_flash_attn_qsa in test-backend-ops (the QSA CPU
  oracle: `test-backend-ops -o FLASH_ATTN_QSA`, 18/18 minimum), test-lazy-reader,
  and the lazy_buf_size handover in test-llama-archs.

Split note (r109): the infrastructure this block is built on -- the slab, the
fusion dispatcher TU, the async input ring, the GDN/MMB/HC16 kernel work -- is
block 10 and is listed there.  A qwen4exp-only change that is implemented inside
a general kernel TU (the GDN gate/beta BF16 fusion, the HC16 MMB BF16 streams,
the weighted-down reduction, the PLE conv fusion) deliberately stays with that
TU in block 10; only the code that needs this block's own symbols is here.

- The separate-tensor (pre-ggml-org#31028) HC mixer emits its inject product right
  behind the down product, i.e. adjacent in the graph, and expands both: the two
  BF16 GEMMs read the same F32 `xn`, and the CUDA BF16 src1 cache (block 10)
  only holds one converted tensor.  ggml-org#31028's ordering (inject last, after the
  gate product whose src1 is the silu output, which evicts the entry) converted
  the whole [hc*n_embd, n_tok] tensor twice per mixer -- measured on Flash-Next
  GSQ-IQ3_XXS as 2x the F32->BF16 `convert_unary_cont_vec4` launches and +3.4 %
  prefill when restored (issue ggml-org#226 follow-up).

R175 amendment: the QSA combine launch passes the new `block_q8_1 * q8` argument
of `flash_attn_combine_results` (added by block 10's FA-combine Q8_1 publish) as
`nullptr` -- QSA's output is not fed to a quantized matmul, so it publishes
nothing.
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Nov 2, 2026
…r, QSA/indexer)

The qwen4exp (Qwen3.8-Flash-Next) architecture support, split out of the old
block 10 (r109) so the model graph, the sparse-attention op and the
hyper-connections no longer share a commit with the slab, the fusion dispatcher
and the async input ring.  The tree is unchanged: block 10 plus this commit is
exactly what the old block 10 carried.

Contents:

- src/models/qwen4exp.cpp: the model, the HC (hyper-connection) graph, the MTP
  draft head, the PLE gather, the QSA selection/attention graph
  (build_qsa_store_k / build_qsa_top_k / build_attn_qsa) and the QSA arm policy.
- QSA/indexer: fattn-qsa.{cu,cuh}, fattn-qsa3.cu, indexer-score.{cu,cuh},
  indexer-topk.{cu,cuh}, the 4-head WMMA indexer scorer in lightning-indexer.cu,
  with the CUDA dispatch (GGML_OP_FLASH_ATTN_QSA / INDEXER_TOPK / INDEXER_SCORE /
  INDEXER_FILL) and their CPU references; the keys-only indexer cache
  (LLAMA_QSA_KEYS_ONLY, no V tensor at all) in llama-memory-hybrid-idx and the
  v_enabled parameter on llama_kv_cache.
- HC ops GGML_OP_HC_MIX / HC_COMBINE (dispatch, supports_op, the Meta split
  states, the hc_combine_mix / hc_mix / hc_combine_norm / hc_gate_mix fusion
  arms and the HC16 planar layout) in hc-mix.{cu,cuh} and hyperconn.{cu,cuh}.
- The managed lazy reader (llama-lazy-reader) and the loader's managed_budget
  (LLAMA_LAZY_BUF_MB, TENSOR_SKIP_MANAGED, lazy_read::add_range) for the PLE
  n-gram table; off by default (it measured slower than both the mmap and the
  resident path on gfx1151).
- The QSA/HC op definitions in ggml.h / ggml.c, the scheduler op allowlists, the
  CPU references, and the qwen4exp tensor-split arch gate in llama-arch.cpp (with
  the ggml-hip CMakeLists publishing GGML_USE_HIP to the main libraries so the
  dynamic-backend build reads it).
- The qwen4exp MTP draft context gets a hybrid-idx memory instead of a plain KV
  cache (LLAMA_MTP_SPARSE=0 restores the dense draft), and llama_memory_recurrent
  stops warning about the speculative verify positions for a context whose
  recurrent filter matches nothing.
- Loader/user-path fix: TENSOR_READ_LAZY is only consulted when the loader has
  files (the llama_model_init_from_user path has nothing to lazy-read from).
- The qwen4exp-family fusion arms that live in this block's own TUs, and the
  graph-optimizer passes they need: the HC_BLK16/RES16 BF16-stream marks and
  their alloc deps, and the prefill indexer relu-sum alloc dep.
- Tests: test-hc-mix and test_flash_attn_qsa in test-backend-ops (the QSA CPU
  oracle: `test-backend-ops -o FLASH_ATTN_QSA`, 18/18 minimum), test-lazy-reader,
  and the lazy_buf_size handover in test-llama-archs.

Split note (r109): the infrastructure this block is built on -- the slab, the
fusion dispatcher TU, the async input ring, the GDN/MMB/HC16 kernel work -- is
block 10 and is listed there.  A qwen4exp-only change that is implemented inside
a general kernel TU (the GDN gate/beta BF16 fusion, the HC16 MMB BF16 streams,
the weighted-down reduction, the PLE conv fusion) deliberately stays with that
TU in block 10; only the code that needs this block's own symbols is here.

- The separate-tensor (pre-ggml-org#31028) HC mixer emits its inject product right
  behind the down product, i.e. adjacent in the graph, and expands both: the two
  BF16 GEMMs read the same F32 `xn`, and the CUDA BF16 src1 cache (block 10)
  only holds one converted tensor.  ggml-org#31028's ordering (inject last, after the
  gate product whose src1 is the silu output, which evicts the entry) converted
  the whole [hc*n_embd, n_tok] tensor twice per mixer -- measured on Flash-Next
  GSQ-IQ3_XXS as 2x the F32->BF16 `convert_unary_cont_vec4` launches and +3.4 %
  prefill when restored (issue ggml-org#226 follow-up).

R175 amendment: the QSA combine launch passes the new `block_q8_1 * q8` argument
of `flash_attn_combine_results` (added by block 10's FA-combine Q8_1 publish) as
`nullptr` -- QSA's output is not fed to a quantized matmul, so it publishes
nothing.
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Nov 3, 2026
…r, QSA/indexer)

The qwen4exp (Qwen3.8-Flash-Next) architecture support, split out of the old
block 10 (r109) so the model graph, the sparse-attention op and the
hyper-connections no longer share a commit with the slab, the fusion dispatcher
and the async input ring.  The tree is unchanged: block 10 plus this commit is
exactly what the old block 10 carried.

Contents:

- src/models/qwen4exp.cpp: the model, the HC (hyper-connection) graph, the MTP
  draft head, the PLE gather, the QSA selection/attention graph
  (build_qsa_store_k / build_qsa_top_k / build_attn_qsa) and the QSA arm policy.
- QSA/indexer: fattn-qsa.{cu,cuh}, fattn-qsa3.cu, indexer-score.{cu,cuh},
  indexer-topk.{cu,cuh}, the 4-head WMMA indexer scorer in lightning-indexer.cu,
  with the CUDA dispatch (GGML_OP_FLASH_ATTN_QSA / INDEXER_TOPK / INDEXER_SCORE /
  INDEXER_FILL) and their CPU references; the keys-only indexer cache
  (LLAMA_QSA_KEYS_ONLY, no V tensor at all) in llama-memory-hybrid-idx and the
  v_enabled parameter on llama_kv_cache.
- HC ops GGML_OP_HC_MIX / HC_COMBINE (dispatch, supports_op, the Meta split
  states, the hc_combine_mix / hc_mix / hc_combine_norm / hc_gate_mix fusion
  arms and the HC16 planar layout) in hc-mix.{cu,cuh} and hyperconn.{cu,cuh}.
- The managed lazy reader (llama-lazy-reader) and the loader's managed_budget
  (LLAMA_LAZY_BUF_MB, TENSOR_SKIP_MANAGED, lazy_read::add_range) for the PLE
  n-gram table; off by default (it measured slower than both the mmap and the
  resident path on gfx1151).
- The QSA/HC op definitions in ggml.h / ggml.c, the scheduler op allowlists, the
  CPU references, and the qwen4exp tensor-split arch gate in llama-arch.cpp (with
  the ggml-hip CMakeLists publishing GGML_USE_HIP to the main libraries so the
  dynamic-backend build reads it).
- The qwen4exp MTP draft context gets a hybrid-idx memory instead of a plain KV
  cache (LLAMA_MTP_SPARSE=0 restores the dense draft), and llama_memory_recurrent
  stops warning about the speculative verify positions for a context whose
  recurrent filter matches nothing.
- Loader/user-path fix: TENSOR_READ_LAZY is only consulted when the loader has
  files (the llama_model_init_from_user path has nothing to lazy-read from).
- The qwen4exp-family fusion arms that live in this block's own TUs, and the
  graph-optimizer passes they need: the HC_BLK16/RES16 BF16-stream marks and
  their alloc deps, and the prefill indexer relu-sum alloc dep.
- Tests: test-hc-mix and test_flash_attn_qsa in test-backend-ops (the QSA CPU
  oracle: `test-backend-ops -o FLASH_ATTN_QSA`, 18/18 minimum), test-lazy-reader,
  and the lazy_buf_size handover in test-llama-archs.

Split note (r109): the infrastructure this block is built on -- the slab, the
fusion dispatcher TU, the async input ring, the GDN/MMB/HC16 kernel work -- is
block 10 and is listed there.  A qwen4exp-only change that is implemented inside
a general kernel TU (the GDN gate/beta BF16 fusion, the HC16 MMB BF16 streams,
the weighted-down reduction, the PLE conv fusion) deliberately stays with that
TU in block 10; only the code that needs this block's own symbols is here.

- The separate-tensor (pre-ggml-org#31028) HC mixer emits its inject product right
  behind the down product, i.e. adjacent in the graph, and expands both: the two
  BF16 GEMMs read the same F32 `xn`, and the CUDA BF16 src1 cache (block 10)
  only holds one converted tensor.  ggml-org#31028's ordering (inject last, after the
  gate product whose src1 is the silu output, which evicts the entry) converted
  the whole [hc*n_embd, n_tok] tensor twice per mixer -- measured on Flash-Next
  GSQ-IQ3_XXS as 2x the F32->BF16 `convert_unary_cont_vec4` launches and +3.4 %
  prefill when restored (issue ggml-org#226 follow-up).

R175 amendment: the QSA combine launch passes the new `block_q8_1 * q8` argument
of `flash_attn_combine_results` (added by block 10's FA-combine Q8_1 publish) as
`nullptr` -- QSA's output is not fed to a quantized matmul, so it publishes
nothing.
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Nov 3, 2026
…r, QSA/indexer)

The qwen4exp (Qwen3.8-Flash-Next) architecture support, split out of the old
block 10 (r109) so the model graph, the sparse-attention op and the
hyper-connections no longer share a commit with the slab, the fusion dispatcher
and the async input ring.  The tree is unchanged: block 10 plus this commit is
exactly what the old block 10 carried.

Contents:

- src/models/qwen4exp.cpp: the model, the HC (hyper-connection) graph, the MTP
  draft head, the PLE gather, the QSA selection/attention graph
  (build_qsa_store_k / build_qsa_top_k / build_attn_qsa) and the QSA arm policy.
- QSA/indexer: fattn-qsa.{cu,cuh}, fattn-qsa3.cu, indexer-score.{cu,cuh},
  indexer-topk.{cu,cuh}, the 4-head WMMA indexer scorer in lightning-indexer.cu,
  with the CUDA dispatch (GGML_OP_FLASH_ATTN_QSA / INDEXER_TOPK / INDEXER_SCORE /
  INDEXER_FILL) and their CPU references; the keys-only indexer cache
  (LLAMA_QSA_KEYS_ONLY, no V tensor at all) in llama-memory-hybrid-idx and the
  v_enabled parameter on llama_kv_cache.
- HC ops GGML_OP_HC_MIX / HC_COMBINE (dispatch, supports_op, the Meta split
  states, the hc_combine_mix / hc_mix / hc_combine_norm / hc_gate_mix fusion
  arms and the HC16 planar layout) in hc-mix.{cu,cuh} and hyperconn.{cu,cuh}.
- The managed lazy reader (llama-lazy-reader) and the loader's managed_budget
  (LLAMA_LAZY_BUF_MB, TENSOR_SKIP_MANAGED, lazy_read::add_range) for the PLE
  n-gram table; off by default (it measured slower than both the mmap and the
  resident path on gfx1151).
- The QSA/HC op definitions in ggml.h / ggml.c, the scheduler op allowlists, the
  CPU references, and the qwen4exp tensor-split arch gate in llama-arch.cpp (with
  the ggml-hip CMakeLists publishing GGML_USE_HIP to the main libraries so the
  dynamic-backend build reads it).
- The qwen4exp MTP draft context gets a hybrid-idx memory instead of a plain KV
  cache (LLAMA_MTP_SPARSE=0 restores the dense draft), and llama_memory_recurrent
  stops warning about the speculative verify positions for a context whose
  recurrent filter matches nothing.
- Loader/user-path fix: TENSOR_READ_LAZY is only consulted when the loader has
  files (the llama_model_init_from_user path has nothing to lazy-read from).
- The qwen4exp-family fusion arms that live in this block's own TUs, and the
  graph-optimizer passes they need: the HC_BLK16/RES16 BF16-stream marks and
  their alloc deps, and the prefill indexer relu-sum alloc dep.
- Tests: test-hc-mix and test_flash_attn_qsa in test-backend-ops (the QSA CPU
  oracle: `test-backend-ops -o FLASH_ATTN_QSA`, 18/18 minimum), test-lazy-reader,
  and the lazy_buf_size handover in test-llama-archs.

Split note (r109): the infrastructure this block is built on -- the slab, the
fusion dispatcher TU, the async input ring, the GDN/MMB/HC16 kernel work -- is
block 10 and is listed there.  A qwen4exp-only change that is implemented inside
a general kernel TU (the GDN gate/beta BF16 fusion, the HC16 MMB BF16 streams,
the weighted-down reduction, the PLE conv fusion) deliberately stays with that
TU in block 10; only the code that needs this block's own symbols is here.

- The separate-tensor (pre-ggml-org#31028) HC mixer emits its inject product right
  behind the down product, i.e. adjacent in the graph, and expands both: the two
  BF16 GEMMs read the same F32 `xn`, and the CUDA BF16 src1 cache (block 10)
  only holds one converted tensor.  ggml-org#31028's ordering (inject last, after the
  gate product whose src1 is the silu output, which evicts the entry) converted
  the whole [hc*n_embd, n_tok] tensor twice per mixer -- measured on Flash-Next
  GSQ-IQ3_XXS as 2x the F32->BF16 `convert_unary_cont_vec4` launches and +3.4 %
  prefill when restored (issue ggml-org#226 follow-up).

R175 amendment: the QSA combine launch passes the new `block_q8_1 * q8` argument
of `flash_attn_combine_results` (added by block 10's FA-combine Q8_1 publish) as
`nullptr` -- QSA's output is not fed to a quantized matmul, so it publishes
nothing.
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Nov 4, 2026
…r, QSA/indexer)

The qwen4exp (Qwen3.8-Flash-Next) architecture support, split out of the old
block 10 (r109) so the model graph, the sparse-attention op and the
hyper-connections no longer share a commit with the slab, the fusion dispatcher
and the async input ring.  The tree is unchanged: block 10 plus this commit is
exactly what the old block 10 carried.

Contents:

- src/models/qwen4exp.cpp: the model, the HC (hyper-connection) graph, the MTP
  draft head, the PLE gather, the QSA selection/attention graph
  (build_qsa_store_k / build_qsa_top_k / build_attn_qsa) and the QSA arm policy.
- QSA/indexer: fattn-qsa.{cu,cuh}, fattn-qsa3.cu, indexer-score.{cu,cuh},
  indexer-topk.{cu,cuh}, the 4-head WMMA indexer scorer in lightning-indexer.cu,
  with the CUDA dispatch (GGML_OP_FLASH_ATTN_QSA / INDEXER_TOPK / INDEXER_SCORE /
  INDEXER_FILL) and their CPU references; the keys-only indexer cache
  (LLAMA_QSA_KEYS_ONLY, no V tensor at all) in llama-memory-hybrid-idx and the
  v_enabled parameter on llama_kv_cache.
- HC ops GGML_OP_HC_MIX / HC_COMBINE (dispatch, supports_op, the Meta split
  states, the hc_combine_mix / hc_mix / hc_combine_norm / hc_gate_mix fusion
  arms and the HC16 planar layout) in hc-mix.{cu,cuh} and hyperconn.{cu,cuh}.
- The managed lazy reader (llama-lazy-reader) and the loader's managed_budget
  (LLAMA_LAZY_BUF_MB, TENSOR_SKIP_MANAGED, lazy_read::add_range) for the PLE
  n-gram table; off by default (it measured slower than both the mmap and the
  resident path on gfx1151).
- The QSA/HC op definitions in ggml.h / ggml.c, the scheduler op allowlists, the
  CPU references, and the qwen4exp tensor-split arch gate in llama-arch.cpp (with
  the ggml-hip CMakeLists publishing GGML_USE_HIP to the main libraries so the
  dynamic-backend build reads it).
- The qwen4exp MTP draft context gets a hybrid-idx memory instead of a plain KV
  cache (LLAMA_MTP_SPARSE=0 restores the dense draft), and llama_memory_recurrent
  stops warning about the speculative verify positions for a context whose
  recurrent filter matches nothing.
- Loader/user-path fix: TENSOR_READ_LAZY is only consulted when the loader has
  files (the llama_model_init_from_user path has nothing to lazy-read from).
- The qwen4exp-family fusion arms that live in this block's own TUs, and the
  graph-optimizer passes they need: the HC_BLK16/RES16 BF16-stream marks and
  their alloc deps, and the prefill indexer relu-sum alloc dep.
- Tests: test-hc-mix and test_flash_attn_qsa in test-backend-ops (the QSA CPU
  oracle: `test-backend-ops -o FLASH_ATTN_QSA`, 18/18 minimum), test-lazy-reader,
  and the lazy_buf_size handover in test-llama-archs.

Split note (r109): the infrastructure this block is built on -- the slab, the
fusion dispatcher TU, the async input ring, the GDN/MMB/HC16 kernel work -- is
block 10 and is listed there.  A qwen4exp-only change that is implemented inside
a general kernel TU (the GDN gate/beta BF16 fusion, the HC16 MMB BF16 streams,
the weighted-down reduction, the PLE conv fusion) deliberately stays with that
TU in block 10; only the code that needs this block's own symbols is here.

- The separate-tensor (pre-ggml-org#31028) HC mixer emits its inject product right
  behind the down product, i.e. adjacent in the graph, and expands both: the two
  BF16 GEMMs read the same F32 `xn`, and the CUDA BF16 src1 cache (block 10)
  only holds one converted tensor.  ggml-org#31028's ordering (inject last, after the
  gate product whose src1 is the silu output, which evicts the entry) converted
  the whole [hc*n_embd, n_tok] tensor twice per mixer -- measured on Flash-Next
  GSQ-IQ3_XXS as 2x the F32->BF16 `convert_unary_cont_vec4` launches and +3.4 %
  prefill when restored (issue ggml-org#226 follow-up).

R175 amendment: the QSA combine launch passes the new `block_q8_1 * q8` argument
of `flash_attn_combine_results` (added by block 10's FA-combine Q8_1 publish) as
`nullptr` -- QSA's output is not fed to a quantized matmul, so it publishes
nothing.
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Nov 4, 2026
…r, QSA/indexer)

The qwen4exp (Qwen3.8-Flash-Next) architecture support, split out of the old
block 10 (r109) so the model graph, the sparse-attention op and the
hyper-connections no longer share a commit with the slab, the fusion dispatcher
and the async input ring.  The tree is unchanged: block 10 plus this commit is
exactly what the old block 10 carried.

Contents:

- src/models/qwen4exp.cpp: the model, the HC (hyper-connection) graph, the MTP
  draft head, the PLE gather, the QSA selection/attention graph
  (build_qsa_store_k / build_qsa_top_k / build_attn_qsa) and the QSA arm policy.
- QSA/indexer: fattn-qsa.{cu,cuh}, fattn-qsa3.cu, indexer-score.{cu,cuh},
  indexer-topk.{cu,cuh}, the 4-head WMMA indexer scorer in lightning-indexer.cu,
  with the CUDA dispatch (GGML_OP_FLASH_ATTN_QSA / INDEXER_TOPK / INDEXER_SCORE /
  INDEXER_FILL) and their CPU references; the keys-only indexer cache
  (LLAMA_QSA_KEYS_ONLY, no V tensor at all) in llama-memory-hybrid-idx and the
  v_enabled parameter on llama_kv_cache.
- HC ops GGML_OP_HC_MIX / HC_COMBINE (dispatch, supports_op, the Meta split
  states, the hc_combine_mix / hc_mix / hc_combine_norm / hc_gate_mix fusion
  arms and the HC16 planar layout) in hc-mix.{cu,cuh} and hyperconn.{cu,cuh}.
- The managed lazy reader (llama-lazy-reader) and the loader's managed_budget
  (LLAMA_LAZY_BUF_MB, TENSOR_SKIP_MANAGED, lazy_read::add_range) for the PLE
  n-gram table; off by default (it measured slower than both the mmap and the
  resident path on gfx1151).
- The QSA/HC op definitions in ggml.h / ggml.c, the scheduler op allowlists, the
  CPU references, and the qwen4exp tensor-split arch gate in llama-arch.cpp (with
  the ggml-hip CMakeLists publishing GGML_USE_HIP to the main libraries so the
  dynamic-backend build reads it).
- The qwen4exp MTP draft context gets a hybrid-idx memory instead of a plain KV
  cache (LLAMA_MTP_SPARSE=0 restores the dense draft), and llama_memory_recurrent
  stops warning about the speculative verify positions for a context whose
  recurrent filter matches nothing.
- Loader/user-path fix: TENSOR_READ_LAZY is only consulted when the loader has
  files (the llama_model_init_from_user path has nothing to lazy-read from).
- The qwen4exp-family fusion arms that live in this block's own TUs, and the
  graph-optimizer passes they need: the HC_BLK16/RES16 BF16-stream marks and
  their alloc deps, and the prefill indexer relu-sum alloc dep.
- Tests: test-hc-mix and test_flash_attn_qsa in test-backend-ops (the QSA CPU
  oracle: `test-backend-ops -o FLASH_ATTN_QSA`, 18/18 minimum), test-lazy-reader,
  and the lazy_buf_size handover in test-llama-archs.

Split note (r109): the infrastructure this block is built on -- the slab, the
fusion dispatcher TU, the async input ring, the GDN/MMB/HC16 kernel work -- is
block 10 and is listed there.  A qwen4exp-only change that is implemented inside
a general kernel TU (the GDN gate/beta BF16 fusion, the HC16 MMB BF16 streams,
the weighted-down reduction, the PLE conv fusion) deliberately stays with that
TU in block 10; only the code that needs this block's own symbols is here.

- The separate-tensor (pre-ggml-org#31028) HC mixer emits its inject product right
  behind the down product, i.e. adjacent in the graph, and expands both: the two
  BF16 GEMMs read the same F32 `xn`, and the CUDA BF16 src1 cache (block 10)
  only holds one converted tensor.  ggml-org#31028's ordering (inject last, after the
  gate product whose src1 is the silu output, which evicts the entry) converted
  the whole [hc*n_embd, n_tok] tensor twice per mixer -- measured on Flash-Next
  GSQ-IQ3_XXS as 2x the F32->BF16 `convert_unary_cont_vec4` launches and +3.4 %
  prefill when restored (issue ggml-org#226 follow-up).

R175 amendment: the QSA combine launch passes the new `block_q8_1 * q8` argument
of `flash_attn_combine_results` (added by block 10's FA-combine Q8_1 publish) as
`nullptr` -- QSA's output is not fed to a quantized matmul, so it publishes
nothing.
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Nov 5, 2026
…r, QSA/indexer)

The qwen4exp (Qwen3.8-Flash-Next) architecture support, split out of the old
block 10 (r109) so the model graph, the sparse-attention op and the
hyper-connections no longer share a commit with the slab, the fusion dispatcher
and the async input ring.  The tree is unchanged: block 10 plus this commit is
exactly what the old block 10 carried.

Contents:

- src/models/qwen4exp.cpp: the model, the HC (hyper-connection) graph, the MTP
  draft head, the PLE gather, the QSA selection/attention graph
  (build_qsa_store_k / build_qsa_top_k / build_attn_qsa) and the QSA arm policy.
- QSA/indexer: fattn-qsa.{cu,cuh}, fattn-qsa3.cu, indexer-score.{cu,cuh},
  indexer-topk.{cu,cuh}, the 4-head WMMA indexer scorer in lightning-indexer.cu,
  with the CUDA dispatch (GGML_OP_FLASH_ATTN_QSA / INDEXER_TOPK / INDEXER_SCORE /
  INDEXER_FILL) and their CPU references; the keys-only indexer cache
  (LLAMA_QSA_KEYS_ONLY, no V tensor at all) in llama-memory-hybrid-idx and the
  v_enabled parameter on llama_kv_cache.
- HC ops GGML_OP_HC_MIX / HC_COMBINE (dispatch, supports_op, the Meta split
  states, the hc_combine_mix / hc_mix / hc_combine_norm / hc_gate_mix fusion
  arms and the HC16 planar layout) in hc-mix.{cu,cuh} and hyperconn.{cu,cuh}.
- The managed lazy reader (llama-lazy-reader) and the loader's managed_budget
  (LLAMA_LAZY_BUF_MB, TENSOR_SKIP_MANAGED, lazy_read::add_range) for the PLE
  n-gram table; off by default (it measured slower than both the mmap and the
  resident path on gfx1151).
- The QSA/HC op definitions in ggml.h / ggml.c, the scheduler op allowlists, the
  CPU references, and the qwen4exp tensor-split arch gate in llama-arch.cpp (with
  the ggml-hip CMakeLists publishing GGML_USE_HIP to the main libraries so the
  dynamic-backend build reads it).
- The qwen4exp MTP draft context gets a hybrid-idx memory instead of a plain KV
  cache (LLAMA_MTP_SPARSE=0 restores the dense draft), and llama_memory_recurrent
  stops warning about the speculative verify positions for a context whose
  recurrent filter matches nothing.
- Loader/user-path fix: TENSOR_READ_LAZY is only consulted when the loader has
  files (the llama_model_init_from_user path has nothing to lazy-read from).
- The qwen4exp-family fusion arms that live in this block's own TUs, and the
  graph-optimizer passes they need: the HC_BLK16/RES16 BF16-stream marks and
  their alloc deps, and the prefill indexer relu-sum alloc dep.
- Tests: test-hc-mix and test_flash_attn_qsa in test-backend-ops (the QSA CPU
  oracle: `test-backend-ops -o FLASH_ATTN_QSA`, 18/18 minimum), test-lazy-reader,
  and the lazy_buf_size handover in test-llama-archs.

Split note (r109): the infrastructure this block is built on -- the slab, the
fusion dispatcher TU, the async input ring, the GDN/MMB/HC16 kernel work -- is
block 10 and is listed there.  A qwen4exp-only change that is implemented inside
a general kernel TU (the GDN gate/beta BF16 fusion, the HC16 MMB BF16 streams,
the weighted-down reduction, the PLE conv fusion) deliberately stays with that
TU in block 10; only the code that needs this block's own symbols is here.

- The separate-tensor (pre-ggml-org#31028) HC mixer emits its inject product right
  behind the down product, i.e. adjacent in the graph, and expands both: the two
  BF16 GEMMs read the same F32 `xn`, and the CUDA BF16 src1 cache (block 10)
  only holds one converted tensor.  ggml-org#31028's ordering (inject last, after the
  gate product whose src1 is the silu output, which evicts the entry) converted
  the whole [hc*n_embd, n_tok] tensor twice per mixer -- measured on Flash-Next
  GSQ-IQ3_XXS as 2x the F32->BF16 `convert_unary_cont_vec4` launches and +3.4 %
  prefill when restored (issue ggml-org#226 follow-up).

R175 amendment: the QSA combine launch passes the new `block_q8_1 * q8` argument
of `flash_attn_combine_results` (added by block 10's FA-combine Q8_1 publish) as
`nullptr` -- QSA's output is not fed to a quantized matmul, so it publishes
nothing.
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Nov 5, 2026
…r, QSA/indexer)

The qwen4exp (Qwen3.8-Flash-Next) architecture support, split out of the old
block 10 (r109) so the model graph, the sparse-attention op and the
hyper-connections no longer share a commit with the slab, the fusion dispatcher
and the async input ring.  The tree is unchanged: block 10 plus this commit is
exactly what the old block 10 carried.

Contents:

- src/models/qwen4exp.cpp: the model, the HC (hyper-connection) graph, the MTP
  draft head, the PLE gather, the QSA selection/attention graph
  (build_qsa_store_k / build_qsa_top_k / build_attn_qsa) and the QSA arm policy.
- QSA/indexer: fattn-qsa.{cu,cuh}, fattn-qsa3.cu, indexer-score.{cu,cuh},
  indexer-topk.{cu,cuh}, the 4-head WMMA indexer scorer in lightning-indexer.cu,
  with the CUDA dispatch (GGML_OP_FLASH_ATTN_QSA / INDEXER_TOPK / INDEXER_SCORE /
  INDEXER_FILL) and their CPU references; the keys-only indexer cache
  (LLAMA_QSA_KEYS_ONLY, no V tensor at all) in llama-memory-hybrid-idx and the
  v_enabled parameter on llama_kv_cache.
- HC ops GGML_OP_HC_MIX / HC_COMBINE (dispatch, supports_op, the Meta split
  states, the hc_combine_mix / hc_mix / hc_combine_norm / hc_gate_mix fusion
  arms and the HC16 planar layout) in hc-mix.{cu,cuh} and hyperconn.{cu,cuh}.
- The managed lazy reader (llama-lazy-reader) and the loader's managed_budget
  (LLAMA_LAZY_BUF_MB, TENSOR_SKIP_MANAGED, lazy_read::add_range) for the PLE
  n-gram table; off by default (it measured slower than both the mmap and the
  resident path on gfx1151).
- The QSA/HC op definitions in ggml.h / ggml.c, the scheduler op allowlists, the
  CPU references, and the qwen4exp tensor-split arch gate in llama-arch.cpp (with
  the ggml-hip CMakeLists publishing GGML_USE_HIP to the main libraries so the
  dynamic-backend build reads it).
- The qwen4exp MTP draft context gets a hybrid-idx memory instead of a plain KV
  cache (LLAMA_MTP_SPARSE=0 restores the dense draft), and llama_memory_recurrent
  stops warning about the speculative verify positions for a context whose
  recurrent filter matches nothing.
- Loader/user-path fix: TENSOR_READ_LAZY is only consulted when the loader has
  files (the llama_model_init_from_user path has nothing to lazy-read from).
- The qwen4exp-family fusion arms that live in this block's own TUs, and the
  graph-optimizer passes they need: the HC_BLK16/RES16 BF16-stream marks and
  their alloc deps, and the prefill indexer relu-sum alloc dep.
- Tests: test-hc-mix and test_flash_attn_qsa in test-backend-ops (the QSA CPU
  oracle: `test-backend-ops -o FLASH_ATTN_QSA`, 18/18 minimum), test-lazy-reader,
  and the lazy_buf_size handover in test-llama-archs.

Split note (r109): the infrastructure this block is built on -- the slab, the
fusion dispatcher TU, the async input ring, the GDN/MMB/HC16 kernel work -- is
block 10 and is listed there.  A qwen4exp-only change that is implemented inside
a general kernel TU (the GDN gate/beta BF16 fusion, the HC16 MMB BF16 streams,
the weighted-down reduction, the PLE conv fusion) deliberately stays with that
TU in block 10; only the code that needs this block's own symbols is here.

- The separate-tensor (pre-ggml-org#31028) HC mixer emits its inject product right
  behind the down product, i.e. adjacent in the graph, and expands both: the two
  BF16 GEMMs read the same F32 `xn`, and the CUDA BF16 src1 cache (block 10)
  only holds one converted tensor.  ggml-org#31028's ordering (inject last, after the
  gate product whose src1 is the silu output, which evicts the entry) converted
  the whole [hc*n_embd, n_tok] tensor twice per mixer -- measured on Flash-Next
  GSQ-IQ3_XXS as 2x the F32->BF16 `convert_unary_cont_vec4` launches and +3.4 %
  prefill when restored (issue ggml-org#226 follow-up).

R175 amendment: the QSA combine launch passes the new `block_q8_1 * q8` argument
of `flash_attn_combine_results` (added by block 10's FA-combine Q8_1 publish) as
`nullptr` -- QSA's output is not fed to a quantized matmul, so it publishes
nothing.
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Nov 5, 2026
…r, QSA/indexer)

The qwen4exp (Qwen3.8-Flash-Next) architecture support, split out of the old
block 10 (r109) so the model graph, the sparse-attention op and the
hyper-connections no longer share a commit with the slab, the fusion dispatcher
and the async input ring.  The tree is unchanged: block 10 plus this commit is
exactly what the old block 10 carried.

Contents:

- src/models/qwen4exp.cpp: the model, the HC (hyper-connection) graph, the MTP
  draft head, the PLE gather, the QSA selection/attention graph
  (build_qsa_store_k / build_qsa_top_k / build_attn_qsa) and the QSA arm policy.
- QSA/indexer: fattn-qsa.{cu,cuh}, fattn-qsa3.cu, indexer-score.{cu,cuh},
  indexer-topk.{cu,cuh}, the 4-head WMMA indexer scorer in lightning-indexer.cu,
  with the CUDA dispatch (GGML_OP_FLASH_ATTN_QSA / INDEXER_TOPK / INDEXER_SCORE /
  INDEXER_FILL) and their CPU references; the keys-only indexer cache
  (LLAMA_QSA_KEYS_ONLY, no V tensor at all) in llama-memory-hybrid-idx and the
  v_enabled parameter on llama_kv_cache.
- HC ops GGML_OP_HC_MIX / HC_COMBINE (dispatch, supports_op, the Meta split
  states, the hc_combine_mix / hc_mix / hc_combine_norm / hc_gate_mix fusion
  arms and the HC16 planar layout) in hc-mix.{cu,cuh} and hyperconn.{cu,cuh}.
- The managed lazy reader (llama-lazy-reader) and the loader's managed_budget
  (LLAMA_LAZY_BUF_MB, TENSOR_SKIP_MANAGED, lazy_read::add_range) for the PLE
  n-gram table; off by default (it measured slower than both the mmap and the
  resident path on gfx1151).
- The QSA/HC op definitions in ggml.h / ggml.c, the scheduler op allowlists, the
  CPU references, and the qwen4exp tensor-split arch gate in llama-arch.cpp (with
  the ggml-hip CMakeLists publishing GGML_USE_HIP to the main libraries so the
  dynamic-backend build reads it).
- The qwen4exp MTP draft context gets a hybrid-idx memory instead of a plain KV
  cache (LLAMA_MTP_SPARSE=0 restores the dense draft), and llama_memory_recurrent
  stops warning about the speculative verify positions for a context whose
  recurrent filter matches nothing.
- Loader/user-path fix: TENSOR_READ_LAZY is only consulted when the loader has
  files (the llama_model_init_from_user path has nothing to lazy-read from).
- The qwen4exp-family fusion arms that live in this block's own TUs, and the
  graph-optimizer passes they need: the HC_BLK16/RES16 BF16-stream marks and
  their alloc deps, and the prefill indexer relu-sum alloc dep.
- Tests: test-hc-mix and test_flash_attn_qsa in test-backend-ops (the QSA CPU
  oracle: `test-backend-ops -o FLASH_ATTN_QSA`, 18/18 minimum), test-lazy-reader,
  and the lazy_buf_size handover in test-llama-archs.

Split note (r109): the infrastructure this block is built on -- the slab, the
fusion dispatcher TU, the async input ring, the GDN/MMB/HC16 kernel work -- is
block 10 and is listed there.  A qwen4exp-only change that is implemented inside
a general kernel TU (the GDN gate/beta BF16 fusion, the HC16 MMB BF16 streams,
the weighted-down reduction, the PLE conv fusion) deliberately stays with that
TU in block 10; only the code that needs this block's own symbols is here.

- The separate-tensor (pre-ggml-org#31028) HC mixer emits its inject product right
  behind the down product, i.e. adjacent in the graph, and expands both: the two
  BF16 GEMMs read the same F32 `xn`, and the CUDA BF16 src1 cache (block 10)
  only holds one converted tensor.  ggml-org#31028's ordering (inject last, after the
  gate product whose src1 is the silu output, which evicts the entry) converted
  the whole [hc*n_embd, n_tok] tensor twice per mixer -- measured on Flash-Next
  GSQ-IQ3_XXS as 2x the F32->BF16 `convert_unary_cont_vec4` launches and +3.4 %
  prefill when restored (issue ggml-org#226 follow-up).

R175 amendment: the QSA combine launch passes the new `block_q8_1 * q8` argument
of `flash_attn_combine_results` (added by block 10's FA-combine Q8_1 publish) as
`nullptr` -- QSA's output is not fed to a quantized matmul, so it publishes
nothing.
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Nov 5, 2026
…r, QSA/indexer)

The qwen4exp (Qwen3.8-Flash-Next) architecture support, split out of the old
block 10 (r109) so the model graph, the sparse-attention op and the
hyper-connections no longer share a commit with the slab, the fusion dispatcher
and the async input ring.  The tree is unchanged: block 10 plus this commit is
exactly what the old block 10 carried.

Contents:

- src/models/qwen4exp.cpp: the model, the HC (hyper-connection) graph, the MTP
  draft head, the PLE gather, the QSA selection/attention graph
  (build_qsa_store_k / build_qsa_top_k / build_attn_qsa) and the QSA arm policy.
- QSA/indexer: fattn-qsa.{cu,cuh}, fattn-qsa3.cu, indexer-score.{cu,cuh},
  indexer-topk.{cu,cuh}, the 4-head WMMA indexer scorer in lightning-indexer.cu,
  with the CUDA dispatch (GGML_OP_FLASH_ATTN_QSA / INDEXER_TOPK / INDEXER_SCORE /
  INDEXER_FILL) and their CPU references; the keys-only indexer cache
  (LLAMA_QSA_KEYS_ONLY, no V tensor at all) in llama-memory-hybrid-idx and the
  v_enabled parameter on llama_kv_cache.
- HC ops GGML_OP_HC_MIX / HC_COMBINE (dispatch, supports_op, the Meta split
  states, the hc_combine_mix / hc_mix / hc_combine_norm / hc_gate_mix fusion
  arms and the HC16 planar layout) in hc-mix.{cu,cuh} and hyperconn.{cu,cuh}.
- The managed lazy reader (llama-lazy-reader) and the loader's managed_budget
  (LLAMA_LAZY_BUF_MB, TENSOR_SKIP_MANAGED, lazy_read::add_range) for the PLE
  n-gram table; off by default (it measured slower than both the mmap and the
  resident path on gfx1151).
- The QSA/HC op definitions in ggml.h / ggml.c, the scheduler op allowlists, the
  CPU references, and the qwen4exp tensor-split arch gate in llama-arch.cpp (with
  the ggml-hip CMakeLists publishing GGML_USE_HIP to the main libraries so the
  dynamic-backend build reads it).
- The qwen4exp MTP draft context gets a hybrid-idx memory instead of a plain KV
  cache (LLAMA_MTP_SPARSE=0 restores the dense draft), and llama_memory_recurrent
  stops warning about the speculative verify positions for a context whose
  recurrent filter matches nothing.
- Loader/user-path fix: TENSOR_READ_LAZY is only consulted when the loader has
  files (the llama_model_init_from_user path has nothing to lazy-read from).
- The qwen4exp-family fusion arms that live in this block's own TUs, and the
  graph-optimizer passes they need: the HC_BLK16/RES16 BF16-stream marks and
  their alloc deps, and the prefill indexer relu-sum alloc dep.
- Tests: test-hc-mix and test_flash_attn_qsa in test-backend-ops (the QSA CPU
  oracle: `test-backend-ops -o FLASH_ATTN_QSA`, 18/18 minimum), test-lazy-reader,
  and the lazy_buf_size handover in test-llama-archs.

Split note (r109): the infrastructure this block is built on -- the slab, the
fusion dispatcher TU, the async input ring, the GDN/MMB/HC16 kernel work -- is
block 10 and is listed there.  A qwen4exp-only change that is implemented inside
a general kernel TU (the GDN gate/beta BF16 fusion, the HC16 MMB BF16 streams,
the weighted-down reduction, the PLE conv fusion) deliberately stays with that
TU in block 10; only the code that needs this block's own symbols is here.

- The separate-tensor (pre-ggml-org#31028) HC mixer emits its inject product right
  behind the down product, i.e. adjacent in the graph, and expands both: the two
  BF16 GEMMs read the same F32 `xn`, and the CUDA BF16 src1 cache (block 10)
  only holds one converted tensor.  ggml-org#31028's ordering (inject last, after the
  gate product whose src1 is the silu output, which evicts the entry) converted
  the whole [hc*n_embd, n_tok] tensor twice per mixer -- measured on Flash-Next
  GSQ-IQ3_XXS as 2x the F32->BF16 `convert_unary_cont_vec4` launches and +3.4 %
  prefill when restored (issue ggml-org#226 follow-up).

R175 amendment: the QSA combine launch passes the new `block_q8_1 * q8` argument
of `flash_attn_combine_results` (added by block 10's FA-combine Q8_1 publish) as
`nullptr` -- QSA's output is not fed to a quantized matmul, so it publishes
nothing.
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Nov 6, 2026
…r, QSA/indexer)

The qwen4exp (Qwen3.8-Flash-Next) architecture support, split out of the old
block 10 (r109) so the model graph, the sparse-attention op and the
hyper-connections no longer share a commit with the slab, the fusion dispatcher
and the async input ring.  The tree is unchanged: block 10 plus this commit is
exactly what the old block 10 carried.

Contents:

- src/models/qwen4exp.cpp: the model, the HC (hyper-connection) graph, the MTP
  draft head, the PLE gather, the QSA selection/attention graph
  (build_qsa_store_k / build_qsa_top_k / build_attn_qsa) and the QSA arm policy.
- QSA/indexer: fattn-qsa.{cu,cuh}, fattn-qsa3.cu, indexer-score.{cu,cuh},
  indexer-topk.{cu,cuh}, the 4-head WMMA indexer scorer in lightning-indexer.cu,
  with the CUDA dispatch (GGML_OP_FLASH_ATTN_QSA / INDEXER_TOPK / INDEXER_SCORE /
  INDEXER_FILL) and their CPU references; the keys-only indexer cache
  (LLAMA_QSA_KEYS_ONLY, no V tensor at all) in llama-memory-hybrid-idx and the
  v_enabled parameter on llama_kv_cache.
- HC ops GGML_OP_HC_MIX / HC_COMBINE (dispatch, supports_op, the Meta split
  states, the hc_combine_mix / hc_mix / hc_combine_norm / hc_gate_mix fusion
  arms and the HC16 planar layout) in hc-mix.{cu,cuh} and hyperconn.{cu,cuh}.
- The managed lazy reader (llama-lazy-reader) and the loader's managed_budget
  (LLAMA_LAZY_BUF_MB, TENSOR_SKIP_MANAGED, lazy_read::add_range) for the PLE
  n-gram table; off by default (it measured slower than both the mmap and the
  resident path on gfx1151).
- The QSA/HC op definitions in ggml.h / ggml.c, the scheduler op allowlists, the
  CPU references, and the qwen4exp tensor-split arch gate in llama-arch.cpp (with
  the ggml-hip CMakeLists publishing GGML_USE_HIP to the main libraries so the
  dynamic-backend build reads it).
- The qwen4exp MTP draft context gets a hybrid-idx memory instead of a plain KV
  cache (LLAMA_MTP_SPARSE=0 restores the dense draft), and llama_memory_recurrent
  stops warning about the speculative verify positions for a context whose
  recurrent filter matches nothing.
- Loader/user-path fix: TENSOR_READ_LAZY is only consulted when the loader has
  files (the llama_model_init_from_user path has nothing to lazy-read from).
- The qwen4exp-family fusion arms that live in this block's own TUs, and the
  graph-optimizer passes they need: the HC_BLK16/RES16 BF16-stream marks and
  their alloc deps, and the prefill indexer relu-sum alloc dep.
- Tests: test-hc-mix and test_flash_attn_qsa in test-backend-ops (the QSA CPU
  oracle: `test-backend-ops -o FLASH_ATTN_QSA`, 18/18 minimum), test-lazy-reader,
  and the lazy_buf_size handover in test-llama-archs.

Split note (r109): the infrastructure this block is built on -- the slab, the
fusion dispatcher TU, the async input ring, the GDN/MMB/HC16 kernel work -- is
block 10 and is listed there.  A qwen4exp-only change that is implemented inside
a general kernel TU (the GDN gate/beta BF16 fusion, the HC16 MMB BF16 streams,
the weighted-down reduction, the PLE conv fusion) deliberately stays with that
TU in block 10; only the code that needs this block's own symbols is here.

- The separate-tensor (pre-ggml-org#31028) HC mixer emits its inject product right
  behind the down product, i.e. adjacent in the graph, and expands both: the two
  BF16 GEMMs read the same F32 `xn`, and the CUDA BF16 src1 cache (block 10)
  only holds one converted tensor.  ggml-org#31028's ordering (inject last, after the
  gate product whose src1 is the silu output, which evicts the entry) converted
  the whole [hc*n_embd, n_tok] tensor twice per mixer -- measured on Flash-Next
  GSQ-IQ3_XXS as 2x the F32->BF16 `convert_unary_cont_vec4` launches and +3.4 %
  prefill when restored (issue ggml-org#226 follow-up).

R175 amendment: the QSA combine launch passes the new `block_q8_1 * q8` argument
of `flash_attn_combine_results` (added by block 10's FA-combine Q8_1 publish) as
`nullptr` -- QSA's output is not fed to a quantized matmul, so it publishes
nothing.
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Nov 6, 2026
…r, QSA/indexer)

The qwen4exp (Qwen3.8-Flash-Next) architecture support, split out of the old
block 10 (r109) so the model graph, the sparse-attention op and the
hyper-connections no longer share a commit with the slab, the fusion dispatcher
and the async input ring.  The tree is unchanged: block 10 plus this commit is
exactly what the old block 10 carried.

Contents:

- src/models/qwen4exp.cpp: the model, the HC (hyper-connection) graph, the MTP
  draft head, the PLE gather, the QSA selection/attention graph
  (build_qsa_store_k / build_qsa_top_k / build_attn_qsa) and the QSA arm policy.
- QSA/indexer: fattn-qsa.{cu,cuh}, fattn-qsa3.cu, indexer-score.{cu,cuh},
  indexer-topk.{cu,cuh}, the 4-head WMMA indexer scorer in lightning-indexer.cu,
  with the CUDA dispatch (GGML_OP_FLASH_ATTN_QSA / INDEXER_TOPK / INDEXER_SCORE /
  INDEXER_FILL) and their CPU references; the keys-only indexer cache
  (LLAMA_QSA_KEYS_ONLY, no V tensor at all) in llama-memory-hybrid-idx and the
  v_enabled parameter on llama_kv_cache.
- HC ops GGML_OP_HC_MIX / HC_COMBINE (dispatch, supports_op, the Meta split
  states, the hc_combine_mix / hc_mix / hc_combine_norm / hc_gate_mix fusion
  arms and the HC16 planar layout) in hc-mix.{cu,cuh} and hyperconn.{cu,cuh}.
- The managed lazy reader (llama-lazy-reader) and the loader's managed_budget
  (LLAMA_LAZY_BUF_MB, TENSOR_SKIP_MANAGED, lazy_read::add_range) for the PLE
  n-gram table; off by default (it measured slower than both the mmap and the
  resident path on gfx1151).
- The QSA/HC op definitions in ggml.h / ggml.c, the scheduler op allowlists, the
  CPU references, and the qwen4exp tensor-split arch gate in llama-arch.cpp (with
  the ggml-hip CMakeLists publishing GGML_USE_HIP to the main libraries so the
  dynamic-backend build reads it).
- The qwen4exp MTP draft context gets a hybrid-idx memory instead of a plain KV
  cache (LLAMA_MTP_SPARSE=0 restores the dense draft), and llama_memory_recurrent
  stops warning about the speculative verify positions for a context whose
  recurrent filter matches nothing.
- Loader/user-path fix: TENSOR_READ_LAZY is only consulted when the loader has
  files (the llama_model_init_from_user path has nothing to lazy-read from).
- The qwen4exp-family fusion arms that live in this block's own TUs, and the
  graph-optimizer passes they need: the HC_BLK16/RES16 BF16-stream marks and
  their alloc deps, and the prefill indexer relu-sum alloc dep.
- Tests: test-hc-mix and test_flash_attn_qsa in test-backend-ops (the QSA CPU
  oracle: `test-backend-ops -o FLASH_ATTN_QSA`, 18/18 minimum), test-lazy-reader,
  and the lazy_buf_size handover in test-llama-archs.

Split note (r109): the infrastructure this block is built on -- the slab, the
fusion dispatcher TU, the async input ring, the GDN/MMB/HC16 kernel work -- is
block 10 and is listed there.  A qwen4exp-only change that is implemented inside
a general kernel TU (the GDN gate/beta BF16 fusion, the HC16 MMB BF16 streams,
the weighted-down reduction, the PLE conv fusion) deliberately stays with that
TU in block 10; only the code that needs this block's own symbols is here.

- The separate-tensor (pre-ggml-org#31028) HC mixer emits its inject product right
  behind the down product, i.e. adjacent in the graph, and expands both: the two
  BF16 GEMMs read the same F32 `xn`, and the CUDA BF16 src1 cache (block 10)
  only holds one converted tensor.  ggml-org#31028's ordering (inject last, after the
  gate product whose src1 is the silu output, which evicts the entry) converted
  the whole [hc*n_embd, n_tok] tensor twice per mixer -- measured on Flash-Next
  GSQ-IQ3_XXS as 2x the F32->BF16 `convert_unary_cont_vec4` launches and +3.4 %
  prefill when restored (issue ggml-org#226 follow-up).

R175 amendment: the QSA combine launch passes the new `block_q8_1 * q8` argument
of `flash_attn_combine_results` (added by block 10's FA-combine Q8_1 publish) as
`nullptr` -- QSA's output is not fed to a quantized matmul, so it publishes
nothing.
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Nov 7, 2026
…r, QSA/indexer)

The qwen4exp (Qwen3.8-Flash-Next) architecture support, split out of the old
block 10 (r109) so the model graph, the sparse-attention op and the
hyper-connections no longer share a commit with the slab, the fusion dispatcher
and the async input ring.  The tree is unchanged: block 10 plus this commit is
exactly what the old block 10 carried.

Contents:

- src/models/qwen4exp.cpp: the model, the HC (hyper-connection) graph, the MTP
  draft head, the PLE gather, the QSA selection/attention graph
  (build_qsa_store_k / build_qsa_top_k / build_attn_qsa) and the QSA arm policy.
- QSA/indexer: fattn-qsa.{cu,cuh}, fattn-qsa3.cu, indexer-score.{cu,cuh},
  indexer-topk.{cu,cuh}, the 4-head WMMA indexer scorer in lightning-indexer.cu,
  with the CUDA dispatch (GGML_OP_FLASH_ATTN_QSA / INDEXER_TOPK / INDEXER_SCORE /
  INDEXER_FILL) and their CPU references; the keys-only indexer cache
  (LLAMA_QSA_KEYS_ONLY, no V tensor at all) in llama-memory-hybrid-idx and the
  v_enabled parameter on llama_kv_cache.
- HC ops GGML_OP_HC_MIX / HC_COMBINE (dispatch, supports_op, the Meta split
  states, the hc_combine_mix / hc_mix / hc_combine_norm / hc_gate_mix fusion
  arms and the HC16 planar layout) in hc-mix.{cu,cuh} and hyperconn.{cu,cuh}.
- The managed lazy reader (llama-lazy-reader) and the loader's managed_budget
  (LLAMA_LAZY_BUF_MB, TENSOR_SKIP_MANAGED, lazy_read::add_range) for the PLE
  n-gram table; off by default (it measured slower than both the mmap and the
  resident path on gfx1151).
- The QSA/HC op definitions in ggml.h / ggml.c, the scheduler op allowlists, the
  CPU references, and the qwen4exp tensor-split arch gate in llama-arch.cpp (with
  the ggml-hip CMakeLists publishing GGML_USE_HIP to the main libraries so the
  dynamic-backend build reads it).
- The qwen4exp MTP draft context gets a hybrid-idx memory instead of a plain KV
  cache (LLAMA_MTP_SPARSE=0 restores the dense draft), and llama_memory_recurrent
  stops warning about the speculative verify positions for a context whose
  recurrent filter matches nothing.
- Loader/user-path fix: TENSOR_READ_LAZY is only consulted when the loader has
  files (the llama_model_init_from_user path has nothing to lazy-read from).
- The qwen4exp-family fusion arms that live in this block's own TUs, and the
  graph-optimizer passes they need: the HC_BLK16/RES16 BF16-stream marks and
  their alloc deps, and the prefill indexer relu-sum alloc dep.
- Tests: test-hc-mix and test_flash_attn_qsa in test-backend-ops (the QSA CPU
  oracle: `test-backend-ops -o FLASH_ATTN_QSA`, 18/18 minimum), test-lazy-reader,
  and the lazy_buf_size handover in test-llama-archs.

Split note (r109): the infrastructure this block is built on -- the slab, the
fusion dispatcher TU, the async input ring, the GDN/MMB/HC16 kernel work -- is
block 10 and is listed there.  A qwen4exp-only change that is implemented inside
a general kernel TU (the GDN gate/beta BF16 fusion, the HC16 MMB BF16 streams,
the weighted-down reduction, the PLE conv fusion) deliberately stays with that
TU in block 10; only the code that needs this block's own symbols is here.

- The separate-tensor (pre-ggml-org#31028) HC mixer emits its inject product right
  behind the down product, i.e. adjacent in the graph, and expands both: the two
  BF16 GEMMs read the same F32 `xn`, and the CUDA BF16 src1 cache (block 10)
  only holds one converted tensor.  ggml-org#31028's ordering (inject last, after the
  gate product whose src1 is the silu output, which evicts the entry) converted
  the whole [hc*n_embd, n_tok] tensor twice per mixer -- measured on Flash-Next
  GSQ-IQ3_XXS as 2x the F32->BF16 `convert_unary_cont_vec4` launches and +3.4 %
  prefill when restored (issue ggml-org#226 follow-up).

R175 amendment: the QSA combine launch passes the new `block_q8_1 * q8` argument
of `flash_attn_combine_results` (added by block 10's FA-combine Q8_1 publish) as
`nullptr` -- QSA's output is not fed to a quantized matmul, so it publishes
nothing.
stew675 pushed a commit to stew675/llama.cpp that referenced this pull request Nov 8, 2026
…r, QSA/indexer)

The qwen4exp (Qwen3.8-Flash-Next) architecture support, split out of the old
block 10 (r109) so the model graph, the sparse-attention op and the
hyper-connections no longer share a commit with the slab, the fusion dispatcher
and the async input ring.  The tree is unchanged: block 10 plus this commit is
exactly what the old block 10 carried.

Contents:

- src/models/qwen4exp.cpp: the model, the HC (hyper-connection) graph, the MTP
  draft head, the PLE gather, the QSA selection/attention graph
  (build_qsa_store_k / build_qsa_top_k / build_attn_qsa) and the QSA arm policy.
- QSA/indexer: fattn-qsa.{cu,cuh}, fattn-qsa3.cu, indexer-score.{cu,cuh},
  indexer-topk.{cu,cuh}, the 4-head WMMA indexer scorer in lightning-indexer.cu,
  with the CUDA dispatch (GGML_OP_FLASH_ATTN_QSA / INDEXER_TOPK / INDEXER_SCORE /
  INDEXER_FILL) and their CPU references; the keys-only indexer cache
  (LLAMA_QSA_KEYS_ONLY, no V tensor at all) in llama-memory-hybrid-idx and the
  v_enabled parameter on llama_kv_cache.
- HC ops GGML_OP_HC_MIX / HC_COMBINE (dispatch, supports_op, the Meta split
  states, the hc_combine_mix / hc_mix / hc_combine_norm / hc_gate_mix fusion
  arms and the HC16 planar layout) in hc-mix.{cu,cuh} and hyperconn.{cu,cuh}.
- The managed lazy reader (llama-lazy-reader) and the loader's managed_budget
  (LLAMA_LAZY_BUF_MB, TENSOR_SKIP_MANAGED, lazy_read::add_range) for the PLE
  n-gram table; off by default (it measured slower than both the mmap and the
  resident path on gfx1151).
- The QSA/HC op definitions in ggml.h / ggml.c, the scheduler op allowlists, the
  CPU references, and the qwen4exp tensor-split arch gate in llama-arch.cpp (with
  the ggml-hip CMakeLists publishing GGML_USE_HIP to the main libraries so the
  dynamic-backend build reads it).
- The qwen4exp MTP draft context gets a hybrid-idx memory instead of a plain KV
  cache (LLAMA_MTP_SPARSE=0 restores the dense draft), and llama_memory_recurrent
  stops warning about the speculative verify positions for a context whose
  recurrent filter matches nothing.
- Loader/user-path fix: TENSOR_READ_LAZY is only consulted when the loader has
  files (the llama_model_init_from_user path has nothing to lazy-read from).
- The qwen4exp-family fusion arms that live in this block's own TUs, and the
  graph-optimizer passes they need: the HC_BLK16/RES16 BF16-stream marks and
  their alloc deps, and the prefill indexer relu-sum alloc dep.
- Tests: test-hc-mix and test_flash_attn_qsa in test-backend-ops (the QSA CPU
  oracle: `test-backend-ops -o FLASH_ATTN_QSA`, 18/18 minimum), test-lazy-reader,
  and the lazy_buf_size handover in test-llama-archs.

Split note (r109): the infrastructure this block is built on -- the slab, the
fusion dispatcher TU, the async input ring, the GDN/MMB/HC16 kernel work -- is
block 10 and is listed there.  A qwen4exp-only change that is implemented inside
a general kernel TU (the GDN gate/beta BF16 fusion, the HC16 MMB BF16 streams,
the weighted-down reduction, the PLE conv fusion) deliberately stays with that
TU in block 10; only the code that needs this block's own symbols is here.

- The separate-tensor (pre-ggml-org#31028) HC mixer emits its inject product right
  behind the down product, i.e. adjacent in the graph, and expands both: the two
  BF16 GEMMs read the same F32 `xn`, and the CUDA BF16 src1 cache (block 10)
  only holds one converted tensor.  ggml-org#31028's ordering (inject last, after the
  gate product whose src1 is the silu output, which evicts the entry) converted
  the whole [hc*n_embd, n_tok] tensor twice per mixer -- measured on Flash-Next
  GSQ-IQ3_XXS as 2x the F32->BF16 `convert_unary_cont_vec4` launches and +3.4 %
  prefill when restored (issue ggml-org#226 follow-up).

R175 amendment: the QSA combine launch passes the new `block_q8_1 * q8` argument
of `flash_attn_combine_results` (added by block 10's FA-combine Q8_1 publish) as
`nullptr` -- QSA's output is not fed to a quantized matmul, so it publishes
nothing.
jammm pushed a commit to jammm/llama.cpp that referenced this pull request Nov 19, 2026
## Overview

Enable the existing HRX row64 weight preference for `LLM_ARCH_MISTRAL3` and add its case to the existing architecture policy test matrix. Compatible prefill, decode and tied-embedding consumers then reuse the same packed weights. Two lines added, using the existing matchers, kernels, format fallbacks and numerical tolerances.

Related to ROCm/ggml-staging-automation#165. Based on `509007ec8`, including merged ggml-org#225.

## Validation

Tested only the staging `bb769c0` manifest-listed `Ministral-3-3B-Instruct-2512-Q4_K_M.gguf`. Verified 2,147,023,008 bytes and SHA-256 `9ed150d4367e68df0ac8e1540f6ddc65b42d0ee26378329d1ecbca60f93fc5f8`. The file uses `mistral3`, 156 Q4_K weights, 27 Q6_K weights and a tied Q6_K token embedding/output. Its GGUF includes YaRN factor 16 and attention temperature scale 0.1. Mistral-Small3.2 uses `llama` and supplies no coverage here.

Radeon 8065S gfx1151, `ROCR_VISIBLE_DEVICES=0`, hrx-system `b859a32e`, Release clang/ROCm `10.1.0a20260822-1151`. Four CPU threads, full offload, flash attention. Pinned wiki.test.raw SHA-256 `173c87a53759e0201f33e0ccf978e510c2042d7f2cb78229d9a50d79b9e7dd08`.

Both established staging perplexity regimes passed with the unchanged HRX/Vulkan ratio tolerance of 1.1.

| Regime | Baseline HRX | Candidate HRX | Vulkan both |
|---|---|---|---|
| ctx512/b512/ub512/chunks32 | 7.8129 +/- 0.21338 | 7.8129 +/- 0.21338 | 7.8113 +/- 0.21327 |
| ctx512/b512/ub1/chunks2 | 8.1786 +/- 1.00393 | 8.1786 +/- 1.00393 | 8.1869 +/- 1.0061 |

An additional ctx17408/b512/ub512/chunks1 probe crosses the attention temperature floor at position 16384. Baseline/candidate HRX both report `4.4844 +/- 0.10203`, Vulkan reports `4.4849 +/- 0.10205`. Captured real-model graphs use the tied-embedding reader and `ggml_rope_token_scale_f32`.

Existing focused policy/reference checks passed 187/187, including row64 tied-embedding readers. Attention postprocess/head128 flash-attention checks passed 8/8. Changed-file EditorConfig, 174 model mappings and diff whitespace checks passed.

## Throughput and measured tradeoff

Two default-warmed standalone llama-bench ABBA blocks, five repeats per invocation, 240 timed samples. Same b512/ub512 for both variants, with separate diagnostic runs. All samples retained.

| Case | Baseline median t/s | Candidate median t/s | Change | Block1 | Block2 |
|---|---|---|---|---|---|
| pp66 | 934.16 | 1215.95 | +30.17% | +46.17% | +26.77% |
| pp128 | 1463.10 | 2481.51 | +69.61% | +74.91% | +67.80% |
| pp256 | 3733.52 | 3802.85 | +1.86% | +7.93% | +6.18% |
| pp512 | 4926.09 | 4773.82 | -3.09% | +4.45% | -3.21% |
| pp1024 | 4517.65 | 4572.91 | +1.22% | -4.68% | +9.10% |
| tg128 | 84.71 | 84.76 | +0.05% | +0.48% | +1.44% |

Larger-prompt variation prompted a separate ABBA with 30 repeats per invocation,360 additional samples.

| Case | Baseline median t/s | Candidate median t/s | Median change | Mean change |
|---|---|---|---|---|
| pp256 | 3499.46 | 3921.07 | +12.05% | +7.77% |
| pp512 | 4526.33 | 4545.06 | +0.41% | +3.87% |
| pp1024 | 4225.76 | 4069.93 | -3.69% | -5.82% |

The main sweep has a pooled pp512 cost of 3.09%. The longer focused run has a pp1024 median cost of 3.69% and mean cost of 5.82%. Parent review must decide whether this measured tradeoff is acceptable before merge. Large-prompt block changes vary in sign. The separate focus results and all invocation medians are retained in summary.json. This GPU measurement covers these settings and model only. pp1024 runs in two ub512 chunks.

## Residency

Synchronized captures after prefill and through 128-token decode at prompts 66/128/256/512/1024 show candidate cached weights remain at 237 allocations and 2,468,917,248 bytes with zero decode materializations or duplicate-layout warnings. Baseline reaches 416 allocations/179 warnings for pp66/128, and 262 allocations/25 warnings for pp256/512/1024. Cached weight savings are 1,671.40 MiB and 297.77 MiB respectively.

Device memory was measured separately using synchronized DRM resident snapshots, deduplicated by client ID. On this UMA GPU, pp66 resident GTT changes from 4,489,633,792 to 2,737,070,080 bytes, with VRAM changing from 1,773,568 to 974,848 bytes. pp512 GTT changes from 3,337,646,080 to 3,025,408,000 bytes, with VRAM from 1,081,344 to 958,464 bytes. These device snapshots include model mappings, KV, activations and runtime allocations beyond the weight cache.

At pp512, all 417 kernel names and the transient plan match, with 25 Q6 commands changing only compile parameters. All 289 decode command records match exactly.

Raw evidence is retained in the worker's `artifacts/row64-mistral3/`, including report.md, summary.json, main-samples.csv, commands/environment, binary hashes, graph programs, residency counters and DRM fdinfo. Parent performs independent review and the user owns merge.

## Requirements

- I have read the contributing guidelines. This change targets the AMD-Ecosystem fork under the user's explicit PR publication authorization.
- AI usage disclosure YES. Codex implemented the two-line opt-in, ran validation and prepared the evidence and PR. Parent reviews independently. The submitting contributor is responsible for the changes.
jammm pushed a commit to jammm/llama.cpp that referenced this pull request Nov 19, 2026
## Overview

The validated change adds SmolLM3 to the existing HRX row64 architecture preference and policy test matrix. Two source lines added on merged origin/hrx-graph-develop-v2 at 5ab7ff3, including ggml-org#226. Existing matchers, kernels and tolerances are preserved. Related issue ROCm/ggml-staging-automation#171 and bead lemonade-ws-bpes.10.

Only the staging bb769c0 manifest-listed SmolLM3-3B-128K-UD-Q4_K_XL.gguf was tested. Verified 1,940,419,168 bytes and SHA-256 0e4e576593099b672b02ee5b516983d35db56ed29eeef5f9135633d339bf1e74, repository revision 3d9d3591996644952b74d2efb7b433450fd3da82. It has 156 Q4_K, 52 Q6_K, 25 Q5_K, 20 IQ4_XS and 73 F32 tensors, a tied Q6_K token embedding/output and 36 attention layers. The source audit and tensor inventory describe eligible and fallback consumers.

GPU Radeon 8065S gfx1151, ROCR_VISIBLE_DEVICES=0. Release clang/ROCm 10.1.0a20260822-1151, hrx-system b859a32e, four CPU threads, full offload, flash attention. Previous family dependency sources, compiled HRX/loomc, Loom tools and corpus are reused read-only. Both llama.cpp variants were built and snapshotted here. Corpus SHA-256 173c87a53759e0201f33e0ccf978e510c2042d7f2cb78229d9a50d79b9e7dd08. Final configuration, binary hashes, commands and environment are retained.

Both established staging perplexity regimes pass the unchanged HRX/Vulkan ratio tolerance 1.1.

| Regime | Baseline HRX | Candidate HRX | Vulkan both |
|---|---|---|---|
| ctx512/b512/ub512/chunks32 | 8.9931 +/- 0.26299 | 8.9931 +/- 0.26299 | 9.0002 +/- 0.26314 |
| ctx512/b512/ub1/chunks2 | 7.4655 +/- 0.93595 | 7.4655 +/- 0.93595 | 7.4646 +/- 0.9359 |

All 212 existing focused policy/reference cases pass, covering both target policies, row64 Q4_K/Q6_K readers, tied embeddings, Q5_K/IQ4_XS metadata/fallback readers and head128 attention. Automatic codex review reports no findings and independently passes 124 host route checks. Changed-file EditorConfig, 174 model mappings and diff whitespace checks pass.

Two default-warmed standalone llama-bench ABBA blocks, five repeats per invocation, 240 timed samples. Both variants use b512/ub512. Each case has 20 timed samples per variant. Diagnostic runs follow the throughput runs. All samples, including invocation-level output, remain in the raw JSON files and main-samples.csv.

| Case | Baseline median t/s | Candidate median t/s | Pooled change | Block1 | Block2 |
|---|---|---|---|---|---|
| pp66 | 1044.88 | 1187.24 | +13.63% | +13.52% | +17.36% |
| pp128 | 1783.17 | 2416.75 | +35.53% | +35.25% | +34.49% |
| pp256 | 3472.57 | 3517.98 | +1.31% | +0.72% | +2.08% |
| pp512 | 3863.43 | 3857.96 | -0.14% | -0.66% | -0.12% |
| pp1024 | 3683.51 | 3691.51 | +0.22% | +0.61% | +0.26% |
| tg128 | 90.05 | 89.95 | -0.11% | -0.42% | +0.07% |

The measured costs are pp512 pooled -0.14% and decode pooled -0.11%. Individual block pp512 changes are -0.66% and -0.12%, and decode changes are -0.42% and +0.07%. No material throughput regression appeared in these samples. Coverage is this model, GPU and settings. pp1024 executes in two ub512 chunks. Long-context performance and other GGUF formats were outside this validation.

Synchronized measurements after prefill and through 128-token decode show candidate cached weights remain at 327 allocations and 2,148,044,800 bytes for prompts 66/128/256/512/1024. There are zero additional decode materializations and zero duplicate-layout warnings. Baseline reaches 529 allocations/202 warnings at pp66/128, and 373 allocations/46 warnings at pp256/512/1024. Shared weight-cache savings are 1,239,834,624 bytes (1182.40 MiB) and 215,900,160 bytes (205.90 MiB), respectively. The 327 candidate allocations include existing metadata representations for fallback formats.

Separately measured device residency comes from synchronized DRM fdinfo snapshots, deduplicated by client ID. These UMA resident GTT/VRAM values include model mappings, KV, activations and runtime allocations beyond the weight cache.

| Prompt | Variant | Weight cache bytes after decode | Resident GTT bytes | Resident VRAM bytes |
|---|---|---|---|---|
| 66 | baseline | 3387879424 | 3639926784 | 1875968 |
| 66 | candidate | 2148044800 | 2400120832 | 1114112 |
| 128 | baseline | 3387879424 | 3681832960 | 1875968 |
| 128 | candidate | 2148044800 | 2441998336 | 1114112 |
| 256 | baseline | 2363944960 | 2760925184 | 1257472 |
| 256 | candidate | 2148044800 | 2545025024 | 1118208 |
| 512 | baseline | 2363944960 | 2876911616 | 1249280 |
| 512 | candidate | 2148044800 | 2661011456 | 1126400 |
| 1024 | baseline | 2363944960 | 2916884480 | 1290240 |
| 1024 | candidate | 2148044800 | 2700984320 | 1110016 |

Captured pp512 production programs have 542 commands in each variant, with identical kernel names and transient plans. Fifty Q6 prefill and one Q6 vector command change compile parameters to the row64 representation. Decode has 326 commands in each variant, with the same kernel names and transient plan, and five Q6 vector commands change format parameters. The pp512 graph includes 36 flash-attention commands, 27 query RoPE and 27 key RoPE/set-rows commands, exercising nine no-RoPE layers as well as 27 RoPE layers. Both phases include the tied embedding reader. Q5_K/IQ4_XS fallback command records retain their existing routes.

Evidence includes summary.json, main-samples.csv, model-identity.json, tensor-inventory.json, source-audit.md, pins.json, configure-command.json, binary-identity.json, commands.jsonl, execution.jsonl, focused-tests.log, automatic-review.log, production graph programs, synchronized residency counters and DRM fdinfo. Parent performs independent review, the user owns merge and the parent closes the bead/ticket after acceptance.

## Requirements

- I have read the contributing guidelines. This PR targets the AMD-Ecosystem fork under explicit publication authorization.
- AI usage disclosure YES. Codex implemented the preference and matrix opt-in, ran validation and automatic review, and prepared this evidence and PR. The submitting contributor owns the changes. Parent reviews independently and the user merges.
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.

2 participants