Skip to content

gemm: an IQ3_S grouped prompt GEMM (gemm_iq3s), so IQ3_S expert stacks reach the card leg - #645

Merged
midagedev merged 3 commits into
mainfrom
iq3gemm
Oct 22, 2026
Merged

midagedev merged 3 commits into
mainfrom
iq3gemm

Conversation

@midagedev

Copy link
Copy Markdown
Owner

What

IQ3_S gains a grouped prompt GEMM (gemm_iq3s). Until now the IQ3_S row's gemm column was -. So
prompt_leg_gate_up / prompt_leg_down refused an IQ3_S expert stack, and every layer of such a file stayed on the
host. With the column set, the card leg takes them with no other change.

  • GemmEntry::Iq3s (crates/gguf/src/card.rs) and the IQ3_S row's gemm column (crates/gguf/src/qtype.rs).
  • GemmWeight::Iq3S, iq3s_dec!, iq3s_lane and gemm_iq3s (crates/gpu/src/gemm/). They read the file's
    110-byte blocks the way gemm_iq3xxs reads its own, and reuse the existing GRID3S and sign helpers.
  • gate_gemm: IQ3_S cases (types, gate synth, down synth, ragged), a NaN-d check, and refusal checks.
  • Fixture variant q35iq3s6 (IQ3_S gate and up with a Q6_K down) on gate-gpu-qwen35moe-leg.
  • The tables that list the leg's types (placement/kernels.rs, accepts.rs, model/arch/coverage.rs,
    card_leg.rs, qwen3moe/swap.rs) gain IQ3_S under PIN(2026-10-22).
  • tools/unsafe-ratchet.txt: gpu 2119 → 2121, for the kernel's two blocks.

Published files this opens: Qwen3.6-35B-A3B unsloth UD-IQ4_XS, UD-IQ4_NL and UD-Q3_K_S, bartowski IQ3_M and IQ3_XS,
and GLM-5.3-Flash UD-IQ4_XS's gate and up.

Prediction and measurement

Card docs/cards/iq3gemm-decode.card [derived]: Qwen3.6-35B-A3B UD-IQ4_XS on one RTX 3090, serving defaults, ctx
262144. Predicted +25..+45 %.

Plan read before the sitting: base card_experts=0 (Body35 refuses iq3_s), this branch card_experts=10240
(host_experts=0, every expert on the card).

base be69eb0 this branch difference, 95 % interval
tg tok/s @ D 6 91.94 135.62 +47.52 % ± 7.64 %
pp tok/s @ D 6 85.01 125.49 +47.61 % ± 36.97 %

Measurement: just depth-serve, RTX 3090 at its 250 W cap. Four rounds, N 128, lead hold up, 0 of 8 rows
[cpu-busy] or [other-busy]. The file is
/models/Qwen3.6-35B-A3B/Qwen3.6-35B-A3B-UD-IQ4_XS.gguf, sha256 649d7508…ebbb3, equal to the hub's.

The result is a little above the band. Per the card's decide-above: land it, and record the base rate beside the
ratio. The whole file fits the card, so the host leg is gone, not shortened.

Gates

From the round (tools/gate-batch.sh --round-ledger):

  • Fixture: DONE total=6 red=0 — gate-ptx-spill, gate-gpu-iq-sel, gate-gpu-qwen35moe-leg, the same with
    @q35iq3s6, gate-gpu-glm5next-gemm, gate-ops.
  • Real: DONE total=2 red=0 — gate-gpu-gemm, gate-placement.
  • gate-gpu-lib with the swap.rs pin: DONE total=1 red=0.

just ptx-compare on generate_ds41: added-only (rc 0). 384 → 385 entries, only gemm_iq3s (128 regs, spill 0).

FAIL-first:

  • One wrong sign shift or scale in the kernel gives contract_bits_differ=4096.
  • The gemm column back to - turns these red:
    • the placement and gate-ops table tests;
    • the leg clause, "0 of 4 layers hold stacks the common card leg runs";
    • hw_a_stack_routes_by_the_tables_gemm_entry.

After the rebase onto #640 (both qwen3moe bodies share the arms now), the coverage pins name iq3_s for both bodies.
bloomery-model coverage passes 20 tests and bloomery-placement passes 174. The release batch runs the full
just affected list.

🤖 Generated with Claude Code

midagedev and others added 3 commits October 22, 2026 11:59
…s reach the card leg

GemmEntry::Iq3s and GemmWeight::Iq3S read the file's 110-byte blocks as
gemm_iq3xxs reads its own; the IQ3_S row's gemm column names it, so
prompt_leg_gate_up/prompt_leg_down admit IQ3_S with no other change.
gate_gemm gains the IQ3_S cases; the q35iq3s6 fixture variant proves the
placed common leg on gate-gpu-qwen35moe-leg.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@midagedev midagedev added enhancement New feature or request gpu The card engine: crates/gpu*, crates/app placement Placement planning: crates/placement needs-gpu Changes code a card must check, and carries no gate run on a card labels Oct 22, 2026
@github-actions github-actions Bot added model The CPU engine and model files: crates/model, models, hf, gguf, tokenizer, jinja tools Tools, recipes, CI and the toolchain: tools/, justfile, .github/, Cargo labels Oct 22, 2026

@github-actions github-actions Bot left a comment

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.

Verdict: CLEAN: No must-fix finding remains after validation.

Non-blocking

⚠ Complete GPU and timing evidence: crates/gpu/src/gemm/kernels.rs:696. The PR gives run summaries without the nvidia-smi card/driver line, both full commit hashes, or exact gate commands and output. Attach that evidence with the timing output so the reported gain can be reproduced. Include prefill A/B at P=512 and P=4096, as required for a prompt-path change; the reported D=6 row does not cover those conditions.

Checked

Duplicates: dryer reported zero pairs in the scanned gguf, model and placement crates.

Complexity: decode 28→32 and check_ref 20→21 add format match arms; run 35→36 adds a case call. This is uniform format coverage, not a new orchestration responsibility.

Silent failure: failed type/refusal checks reach the gate's error exit. The omitted GEMV diagnostic leaves the f64 and bit comparisons active.

Tests: the new IQ3_S gate cases call the shared reference and bit comparisons, NaN-scale check and type-refusal checks. The placement test explicitly pins IQ3_S admission. Routing maps the new table entry through GemmWeight::Iq3S to gemm_iq3s.

Gates: IQ3_S admission and unsafe-count changes have dated PIN reasons. No numeric tolerance was relaxed.

Escape catalog: C1–C4 have no matching additions.

Notes

Validator checks used source inspection; no Rust build or GPU gate was run.

dryer excluded crates/gpu and crates/gpu-gates.

Card check: needs-gpu. This pull request changes crates/gpu-gates/src/bin/gate_gemm.rs, crates/gpu/src/arch/qwen3moe/swap.rs, crates/gpu/src/card_leg.rs … and carries no gate run on a card (CONTRIBUTING's evidence list); a maintainer adds gpu-verified after one.

🔨 Shingler, bloomery's review bot: approves a clean pull request and requests changes on a must-fix (how it works)

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

Labels

enhancement New feature or request gpu The card engine: crates/gpu*, crates/app model The CPU engine and model files: crates/model, models, hf, gguf, tokenizer, jinja needs-gpu Changes code a card must check, and carries no gate run on a card placement Placement planning: crates/placement tools Tools, recipes, CI and the toolchain: tools/, justfile, .github/, Cargo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant