`forward-serve` on Qwen3.8-27B-NPU2 (qwen3_5, 64 layers of which 48 are
GDN) loaded all seven geometry-derived ELFs, reported "ready (full ELF)"
and then decoded `"!!!!!!!!"`. Three separate defects, each hidden
behind the previous one:
- alpha/beta dequant: ssm_alpha_proj/ssm_beta_proj are stored row-padded
to the 32-row tile (48 value heads -> 64 rows, Q8: 40 tiles x 8704 B),
and dequant_any() refuses a height that is not tile-aligned. New
deq_pad() dequantises at the stored height and keeps the first `rows`.
- weight-cache key collision: the cache is keyed (layer, int), and the
GDN path packed ssm_out_proj (N = H) under key 2, which the FFN tail of
the same layer then claimed for gate_proj (N = IM = 17408). The gate
GEMM read a BO packed for 5120 columns -- its scale vector had 5120
entries for a 17408-wide output -- and produced ~1e28, hence the
garbage. ssm_out_proj moves to key 6. The MLA path had the same bug
twice: key 2 held kv_a (a few hundred wide) before gate_proj, and key 3
held o_proj before up_proj; they move to 6 and 7.
- per-token re-dequantisation: the three big GDN projections are only
read through q4nx_assemble_B() when their packed BO is not cached yet,
but load_gdn_layer() dequantised ~1.5 GB per layer per token anyway
(dense_weights_cached requires lin_kd_ == 0, which is false for every
GDN model). They are now skipped when keys 0/1/6 are cached; the small
members the host reads each token are still refreshed.
Measured on strixhalo (NPU, ~/npu.lock held, accel0 free): the 27B now
answers instead of emitting `!`; per-GEMM pack time drops 184.7 -> 9.2 ms.
Speed is still ~50 s/token and is a separate problem (one blocking NPU
submit per GEMM), not addressed here.
Follow-up to #617 (which shipped only the chunk check).
forward-serveonQwen3.8-27B-NPU2(qwen3_5, 48 GDN + 16 full layers) now produces text on the NPU instead of"!!!!!!!!".Three defects, each masked by the previous one
ssm_alpha_proj/ssm_beta_projare stored row-padded to the 32-row tile (48 value heads → 64 rows, Q8: 40 tiles × 8704 B).dequant_any()rejects a non-tile-aligned height, sodeq_pad()dequantises at the stored height and keeps the firstrows.(layer, int). The GDN path packedssm_out_proj(N = H = 5120) under key 2, and the FFN tail of the same layer then claimed key 2 forgate_proj(N = IM = 17408). The gate GEMM got a BO packed for 5120 columns — its scale vector had 5120 entries for a 17408-wide output — and produced ~1e28, which is the garbage.ssm_out_proj→ key 6. The MLA path had the same bug twice: key 2 heldkv_abeforegate_proj, key 3 heldo_projbeforeup_proj→ keys 6 and 7.q4nx_assemble_B()when their packed BO is not cached, butload_gdn_layer()dequantised ~1.5 GB per layer per token anyway (dense_weights_cachedrequireslin_kd_ == 0, false for every GDN model). They are skipped when keys 0/1/6 are cached.Evidence (strixhalo,
~/npu.lockheld,accel0free, 5/5):Not fixed: speed. ~50 s/token remains, because every GEMM is a separate blocking NPU submit (
wait≈31 ms× ~365 GEMMs/token). That is the next issue, not this one.Not verified: the MLA keys have no checkpoint here (DeepSeek2), so that half is reasoned, not measured.
docs/untouched.