Skip to content

feat(BACKEND-TENSTORRENT-KEEPQUANT): the 27B arm — on-core decode residency, TT grouped keep-quant GEMM, e2e gate #3030

Description

@lu-zero

Row: BACKEND-TENSTORRENT-KEEPQUANT

Qwen3.8-27B Q4_K_M on the P150: restore the on-core decode residency the
27B memory budget forces, run the arm end to end, and gate it against the
pinned llama.cpp oracle.

The 27B artifact decides the residency reconciliation W3 left open
(.agents/specs/tenstorrent-keepquant.md ## Owed, NEEDS_DECISION).
Measured on the pinned artifact (unsloth/Qwen3.8-27B-GGUF @ fe1e2a23,
sha256 7e78da5d...fe169, 17,106,775,008 bytes; 866 tensors; zero IQ, zero
vision):

set packed bf16 twin
token_embd (Q4_K, [5120,248320]) 0.68 GB 2.37 GB
output (Q6_K, untied head) 0.97 GB 2.37 GB
experts (Q4_K x294) 9.81 GB 32.37 GB
non-expert keep-quant (attn_qkv Q6_K x48, attn_v, ssm_out, ...) 6.01 GB 18.47 GB

The shipped W3 residency — a memoized bf16 twin per keep-quant weight
(DecodedWeightShadow) as MatmulBTQuantKernel's weight operand — is a
0.8B-only shape. On 27B the non-expert twins alone are 18.47 GiB and the
experts are 32.37 GiB: the twin path cannot fit, full stop. W4 therefore
promotes the word-shadow on-core decode (landed, bit-exact vs
vt::cpu::BlockToFloat, capture-guarded, and currently read by no
production path) to the production residency for matmul consumers, and
keeps the twin only where semantics require a materialized table: the
embedding gather (token_embd, 2.37 GiB — acceptable).

Budget on the 32 GB P150: ~16 GiB resident i32 word shadows (all four
encodings; 210/34-byte blocks pad to 53/9 words) + 2.37 GiB embedding twin

  • activations/KV. Fits with headroom; record the axis.

Scope:

  1. Production residency flip: MatmulBTQuantKernel consumes the per-call
    on-core decode from the resident word shadow for {Q4_K,Q5_K,Q6_K,Q8_0};
    the twin survives for token_embd only. Red-first: the smallest failing
    test is the 0.8B vehicle gate under the flipped residency (the W3 gate
    must stay green — the OOM it memorized was twin CONSTRUCTION, not shadow
    use). Capture-safety: the eager warm step stages every word shadow once
    pre-capture; the captured replay reads stable tensors and stages nothing
    (the property the spec already records for this machinery).
  2. kMatmulBTQuantGrouped on kTENSTORRENT (pulled in from ## Owed — the
    27B arm is not e2e without it): the seam already exists (ops.cpp:220,
    weight[E*N,K]) with a production ROCm kernel
    (MatmulBTQuantGroupedKernelRocm, native Q8_0/Q4_K/Q6_K) fed by the
    stacked keep-quant expert tower loader (qwen3_5_gguf_weights.cpp:1287).
    TT work = port the grouped kernel beside the W3 dense decode chains
    (which already cover Q5_K too), consuming the same stacked tower; verify
    the 27B rides the qwen3_5 MoE registration at implementation. Experts
    stay packed and fully resident (9.81 GB stacked). Note: runtime
    per-token on-demand expert loading does NOT exist in the tree — what
    exists is load-phase streaming + host-release (qwen3_5_weights.cpp:1720,
    cuda.cpp:118); the fit comes from packed residency, not from demand
    loading.
  3. MTP blk.64.* tensors: skip or refuse by name with a message that names
    the missing part (decide at implementation; record the one-liner).
  4. Gate: 27B e2e greedy near-tie gate on the TT arm, checkpoint-gated
    opt-in loud-skip (Qwen3-4B on Tenstorrent: both decode arms put 5/16 gate prompts beyond the 0.5-nat near-tie band #2811 precedent), golden pair minted against the
    pinned llama.cpp b10451 oracle (already gateable) on identical prompts;
    500-mnat band + 0 forward-divergent bar as W3.
  5. docs/USAGE.md pin in the same change: repo, revision, file, size,
    sha256, refused arms named.

Out of scope: IQ-family (zero tensors in this artifact), the int8-dot lever
(its own PR), vision towers (none in the artifact).

Risks:

  • The 0.8B gate under the flipped residency is the red-first test AND the
    regression risk (capture must stage shadows pre-capture exactly once —
    the staging counter CHECK from W3 guards it).
  • 27B oracle goldens need the llama.cpp oracle run on the host (17 GB
    artifact, CPU-side RAM fine); the near-tie band may need more prompts at
    27B scale — keep the minting script parameterized.
  • Expert grouped decode is expert-count-dependent; if profile shows decode
    dominates, the int8-dot lever is the booked repayment — sequence, do not
    bundle.
  • If the 27B does NOT ride the qwen3_5 MoE registration, the loader needs
    the A3 stacked-KQ path mirrored for the 3.8 registration — discover at
    implementation, one-line record either way.

FOLLOWING_AGENTS_PROTOCOL

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions