Skip to content

feat(humming): port the Humming CUDA GEMM backend - #5966

Merged
Qubitium merged 3 commits into
mainfrom
feat/humming-backend
Nov 21, 2026
Merged

Qubitium merged 3 commits into
mainfrom
feat/humming-backend

Conversation

@Qubitium

@Qubitium Qubitium commented Nov 21, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Ports the Humming weight-only CUDA GEMM into GPT-QModel as the opt-in BACKEND.HUMMING.

Humming is the Apache-2.0 JIT-compiled W1–W8 kernel library both projects consume through the optional
humming-kernels PyPI package, so nothing is vendored into gptqmodel_ext: gptqmodel/utils/humming.py
is the only module that imports it, and a missing package degrades into a normal kernel-selection
rejection instead of an import error.

The same backend also serves two float sub-kernels — FP8 (E4M3) and OCP MXFP4 — so
BACKEND.HUMMING is a single opt-in target for GPTQ, AWQ, FP8 and MXFP4 checkpoints.

What Changed

  • gptqmodel/utils/backend.py: BACKEND.HUMMING, plus gptq_humming / awq_humming legacy aliases.
  • gptqmodel/utils/humming.py (new): import guard, SM75+/CUDA-only device gates, humming-kernels
    schema conversion, per-layer Stream-K locks, and the explicit compute policy.
  • gptqmodel/nn_modules/qlinear/humming.py (new): HummingLinear (GPTQ W2/W4/W8),
    AwqHummingLinear (AWQ W4), HummingFP8Linear (FP8 E4M3) and HummingMXFP4Linear (OCP MXFP4).
    post_init() converts the checkpoint tensors once through Humming's own GPTQWeightSchema /
    AWQWeightSchema / Fp8WeightSchema / Mxfp4WeightSchema; forward() calls humming_forward().
    A shared _HummingKernelMixin lets each sub-kernel name its own checkpoint operands
    (HUMMING_WEIGHT_ATTR / HUMMING_SCALE_ATTR / HUMMING_ZERO_POINT_ATTR), so GPTQ/AWQ keep
    qweight/scales/qzeros while FP8 and MXFP4 reuse their native buffers.
  • prepare_humming_fp8_tensors covers the three FP8 scale layouts (tensor, row, block) and
    normalizes weight_scale_inv into Humming's multiplier convention;
    prepare_humming_mxfp4_tensors is a zero-copy handoff because MACaQ's nibble-packed E2M1 weights
    and E8M0 block scales are already byte-identical to Humming's layout.
  • gptqmodel/utils/packing.py: both kernels are ABI-transforming after post_init(), so they are
    rejected as repack sources (same rule as Marlin/Machete/Swordfish/BitBLAS).
  • tests/kernels/test_humming.py (new): 35 registration and numeric tests.
  • docs/humming.md (new), docs/support-matrix.md, docs/hf_packing_api.md, CREDITS.md,
    tests/test_backend_naming.py, tests/test_rocm_kernel_contracts.py (CUDA-only inventory).

Behavior notes:

  • Opt-in only. SUPPORTS_FORMATS priority 0 registers the kernels for explicit selection while
    leaving BACKEND.AUTO on the existing default kernels (Humming JIT-compiles one image per shape).
  • post_init() replaces the checkpoint tensors with Humming's transformed operands, so a loaded layer
    is inference-only, exactly like Marlin/Swordfish.
  • No environment switches: the compute policy is an explicit argument
    (humming_compute_config(batch_invariant=..., f16_accum=...)), and layers always run the
    deterministic dense/fp32-accumulate default.
  • Unsupported layouts are rejected at construction with actionable errors: GPTQ 3/5/6/7-bit
    (different word packing), GPTQ desc_act=True, ROCm, CPU, non-SM75 devices.

Tests

Hardware/runtime: 1× RTX 4090 (SM89), CUDA 13.2, torch 2.15.0+cu132, Python 3.14,
humming-kernels==0.1.20. No mocks were used for the numeric cases.

pytest tests/kernels/test_humming.py tests/test_backend_naming.py tests/test_rocm_kernel_contracts.py \
  tests/kernels/test_selection.py tests/kernels/test_qlinear_hierarchy.py \
  tests/test_hf_packing_api.py tests/test_packing_numeric_boundaries.py -q
ruff check gptqmodel docs/eora tests setup.py   # ruff 0.14.2 (CI pin)
Suite Result
tests/kernels/test_humming.py 35 passed
tests/test_backend_naming.py 21 passed
tests/test_rocm_kernel_contracts.py 487 passed, 1 failed (pre-existing)
tests/kernels/test_selection.py 154 passed, 41 skipped
tests/kernels/test_qlinear_hierarchy.py 11 passed
tests/test_hf_packing_api.py 56 passed, 1 skipped, 2 failed (pre-existing)
tests/test_packing_numeric_boundaries.py 115 passed
combined 879 passed, 42 skipped, 3 failed
ruff check (repo-wide, 0.14.2) clean

The 3 failures are pre-existing on pristine origin/main (d4712ee1) and unrelated to this branch;
each was reproduced in a clean detached worktree at the same base revision:

  • tests/test_rocm_kernel_contracts.py::test_hip_shims_provide_every_cuda_only_intrinsic_used_under_hip
  • tests/test_hf_packing_api.py::test_hf_repack_layer_between_compatible_kernels
  • tests/test_hf_packing_api.py::test_gpu_feasibility_and_best_format

Kernel numerics vs an independent Torch FP32 oracle

fp16 weights/activations, K=512 / N=256 unless noted, batch 13 (GPTQ) or 9 (AWQ). The oracle
dequantizes the packed codes in FP32 and rounds the dequantized weight to the kernel's compute dtype
before an FP32 matmul; the visible output is compared after its mandatory output-dtype rounding.
Normalized is ||got - ref|| / ||ref|| (Frobenius), the repository's 2e-3 inference gate.

Case Max abs err Mean abs err Normalized ref mean abs
GPTQ 2-bit, gs 128 0.028118 0.002457 3.00e-4 10.11
GPTQ 4-bit, gs 128 0.018349 0.002092 2.88e-4 8.99
GPTQ 8-bit, gs 128 0.017437 0.002162 2.91e-4 9.04
GPTQ 2-bit, gs 32 0.027283 0.002328 2.84e-4 10.14
GPTQ 4-bit, gs 32 0.026115 0.002274 3.02e-4 9.32
GPTQ 8-bit, gs 32 0.020546 0.002200 2.92e-4 9.13
GPTQ 2-bit, gs -1 0.024517 0.002231 2.90e-4 9.39
GPTQ 2-bit, gs 128, K=2048 0.071350 0.006974 3.84e-4 20.08
AWQ 4-bit, gs 32 0.019432 0.002140 2.95e-4 8.97
AWQ 4-bit, gs 128 0.023399 0.002155 2.91e-4 9.06
AWQ 4-bit, gs -1 0.024254 0.002373 3.03e-4 9.54

The bf16 tile-misaligned case (in=384, out=200, gs=128, output shape 3×7×200) stays within one
bf16 output ulp elementwise and 2.81e-3 normalized against the fp32 oracle (bound 4e-3 for bf16's
8-bit weight-dequantization mantissa; the fp16 cases use 2e-3).

End-to-end logits (Qwen2.5-0.5B, 168 converted layers)

Fixed 2×16 token IDs, fp16, device="cuda:0". Each backend loaded the same checkpoint in a separate
process. Normalized is ||a - b|| / ||b||.

Model Comparison Max abs Mean abs Normalized
GPTQ-Int4 Humming vs Torch 0.082031 0.007183 3.81e-3
GPTQ-Int4 Humming vs Marlin 0.093750 0.007035 3.77e-3
GPTQ-Int4 Marlin vs Torch (baseline) 0.070312 0.005946 3.16e-3
AWQ Humming vs Torch 0.073364 0.008733 4.65e-3
AWQ Humming vs Marlin 0.281250 0.009761 6.35e-3
AWQ Marlin vs Torch (baseline) 0.289062 0.009282 6.21e-3

Humming's distance from the Torch reference is the same order as Marlin's own distance from it
(GPTQ 3.81e-3 vs 3.16e-3; AWQ 4.65e-3 vs 6.21e-3), and the large AWQ max-abs outliers are shared by
Marlin. The model-level drift accumulates over 24 layers; the per-layer kernel error is the 3e-4
normalized value in the table above.

Determinism

Policy 20 repeated forwards, max drift
Default (dense, fp32 accumulate) 0.000000
humming_compute_config(batch_invariant=True) 0.000000 (bit-exact)

Humming's Stream-K reduction may reorder partial tiles; the batch-invariant policy pins that order and
is available through an explicit argument, never an environment variable.

Coverage and limits

Dimension Supported / declared
Methods GPTQ (FORMAT.GPTQ, FORMAT.GPTQ_V2), AWQ (FORMAT.GEMM), FP8 (FORMAT.FP8), MACaQ (FORMAT.MXFP4)
Bits GPTQ 2/4/8; AWQ 4; FP8 8 (E4M3); MXFP4 4 (E2M1)
Group sizes -1 (per-channel), 32, 64, 128; FP8 tensor / per-row / 128x128 block; MXFP4 E8M0 block-32
Symmetry sym=True and sym=False (GPTQ v1 qzeros corrected before packing); N/A for FP8/MXFP4
Activation/weight dtype torch.float16, torch.bfloat16
Devices NVIDIA SM75+ (Turing or newer), Linux
Shapes Any in_features/out_features; operands padded to 128×256 tiles internally
Sharding SUPPORTS_SHARDS / SUPPORTS_SHARDED_LOAD
Adapters LoRA
Training Not supported (SUPPORTS_TRAINING = False)
Unavailable ROCm (no HIP port), CPU, GPTQ 3/5/6/7-bit planar/word layouts, GPTQ desc_act=True, FP8 per-token activation scaling, MACaQ-rotated MXFP4 (rotation/pre_mode != none)
Not wired Humming MoE/indexed GEMM (dense linear only), NVFP4 (no GPT-QModel checkpoint loader), activation-quantized W4A4/W8A8 recipes

Measured Impact

This is a new backend, so the comparison is Humming against the existing Marlin and Torch kernels on
the same checkpoint, hardware and settings; there is no "before" revision that shipped Humming.

Conditions: Qwen2.5-0.5B (24 layers, 168 converted linears), batch 1, fp16, device="cuda:0",
RTX 4090 (SM89), CUDA 13.2, torch 2.15.0+cu132, humming-kernels==0.1.20. Latencies are medians of
synchronized iterations after warmup: 8× prefill-512, 5× prefill-2048, 20× decode-M=1; generate is
32 prompt + 32 greedy new tokens, median of 5. Each backend was loaded in a separate process.

Model Backend Prefill 512 (tok/s) Prefill 2048 (tok/s) Decode M=1 (steps/s) Generate (tok/s) Peak VRAM (GiB) Cold 1st forward (ms) Load (s)
GPTQ-Int4 Humming 38,811 121,218 63.0 61.8 1.05 1,637 3.2
GPTQ-Int4 Marlin 34,062 113,976 68.9 69.5 1.04 435 4.3
GPTQ-Int4 Torch 15,344 61,489 46.9 47.2 1.04 824 22.3
AWQ Humming 31,588 119,256 58.2 63.1 1.06 1,439 3.3
AWQ Marlin 33,657 120,790 71.7 68.9 1.04 464 6.5
AWQ Torch 13,955 53,390 28.8 27.5 1.04 420 19.1
Model vs Marlin: prefill 512 prefill 2048 decode M=1 generate
GPTQ-Int4 1.14× 1.06× 0.91× 0.89×
AWQ 0.94× 0.99× 0.81× 0.92×
Model vs Torch: prefill 512 prefill 2048 decode M=1 generate
GPTQ-Int4 2.53× 1.97× 1.34× 1.31×
AWQ 2.26× 2.23× 2.02× 2.29×
  • Prefill: Humming matches or beats Marlin for GPTQ (+14% at 512 tokens, +6% at 2048) and is at parity
    for AWQ, while running ~2× the Torch kernels.
  • Decode: Marlin is 9% (GPTQ) / 19% (AWQ) faster at M=1. Humming's dense Stream-K path is tuned for
    larger M, and model-level M=1 is dominated by fixed per-step overhead rather than the GEMM.
  • Cold start: the first forward JIT-compiles the shape (1.4–1.6 s here) and is included in
    Cold 1st forward; steady-state numbers exclude it. This is why the backend is opt-in and not in
    BACKEND.AUTO.
  • Peak VRAM is unchanged (~1.05 GiB): the converted operands replace the checkpoint tensors, and no
    dense weight copy is retained.

Additional Formats (FP8 / MXFP4)

Two float sub-kernels extend the same backend. Both are weight-only (A16) and register with
SUPPORTS_FORMATS priority 0, so they are explicit-selection only, exactly like the GPTQ/AWQ
sub-kernels.

Class Method Format Checkpoint buffers Scale layouts
HummingFP8Linear METHOD.FP8 FORMAT.FP8 weight (E4M3), weight_scale_inv (fp32) tensor, per-row, 128x128 block
HummingMXFP4Linear METHOD.MACAQ FORMAT.MXFP4 W_packed (uint8 E2M1), W_scales (uint8 E8M0) E8M0 block-32

Weight-only numerics (A16), fp16 compute

relL2 = ||kernel - oracle|| / ||oracle|| against a torch FP32 dequantized oracle, M in
{1, 4, 16, 64, 128}, N=256, K=512. relL2 is dominated by the mandatory fp16 output rounding, so
~2e-4 is the floor rather than an error budget. Worst case over M is shown; all 26 cells passed.

Weights Scales RTX 4090 (SM89) RTX 5090 (SM120) MMA path
INT2 group-32 fp16 2.078e-4 2.078e-4 mma.sync
INT4 group-32 fp16 2.916e-4 2.909e-4 mma.sync
INT4 group-64 fp16 2.721e-4 2.721e-4 mma.sync
INT4 group-128 fp16 2.894e-4 2.894e-4 mma.sync
INT4 per-channel fp16 3.007e-4 3.007e-4 mma.sync
INT8 group-128 fp16 2.881e-4 2.881e-4 mma.sync
FP8 E4M3 fp32 tensor 2.242e-4 2.242e-4 native FP8 dequant
FP8 E4M3 fp32 128x128 block 2.937e-4 2.937e-4 native FP8 dequant
MXFP4 E2M1 E8M0 block-32 2.111e-4 2.111e-4 register dequant
NVFP4 E2M1 E4M3 block-16 + fp32 global 2.086e-4 2.086e-4 register dequant
MXFP8 E4M3 E8M0 block-32 2.101e-4 2.101e-4 native FP8 dequant
E3M4 (undocumented) E8M0 block-32 2.090e-4 2.090e-4 cubin-patched
E0M3 (undocumented) E8M0 block-32 2.310e-4 2.310e-4 cubin-patched

On SM89 the float rows run MmaType.MMA with register dequant; on SM120 they take
use_native_dequant=True.

Block-scaled MMA (needs quantized activations)

These recipes additionally quantize the input, so they are documented as library capability rather
than exposed through GPT-QModel today:

Recipe SM89 (4090) SM120/121 (5090, DGX Spark) SM100/103 (B200)
MXFP4 W4A4 (scale_vec::2X, E8M0) unsupported 5.394e-5 via UMMA
NVFP4 W4A4 (scale_vec::4X, E4M3) unsupported 3.116e-3 (M>=64) via UMMA
MXFP8 W8A8 (scale_vec::1X, E8M0) unsupported 2.063e-4 via UMMA
FP8 W8A8 per-token 3.087e-4 1.706e-3 (M=16..64) via UMMA

Wiring decisions

  • FP8 reuses the existing FORMAT.FP8 checkpoint layout, so an FP8 checkpoint can be served by
    either TorchFP8Linear or HummingFP8Linear. post_init() normalizes weight_scale_inv into
    Humming's multiplier convention; both inverse and multiplier semantics are accepted.
    activation_quant_method="per_token" is rejected at construction with an actionable error.
  • MXFP4 consumes MACaQ's existing storage with no repack. Rotated checkpoints
    (rotation/pre_mode other than none) and block sizes other than 32 are rejected.
  • NVFP4 is not wired: GPT-QModel has no NVFP4 checkpoint loader (only modelopt /
    compressed-tensors in Humming). It would need a new schema plus loader, which is out of scope here.
  • W4A4/W8A8 are not wired: both new classes are weight-only A16. The recipes above are reachable
    only by a future activation-quantizing backend.
  • Neither new class is a repack source (hf_check_packing_feasibility(..., repack=True) returns
    False), because post_init() replaces the checkpoint tensors in place.

Host coverage

Host Compute capability Status
RTX 4090 SM89 validated (integer + float rows)
RTX 5090 SM120 validated (integer + float rows, native FP8 dequant)
DGX Spark SM121 expected to match SM120; not validated in this PR
A100 SM80 expected to work via register dequant (native FP8 dequant needs SM89+); not validated in this PR
B200 SM100/103 block-scaled MMA via UMMA; not validated in this PR

End-to-end checkpoint loads (real production checkpoints)

The rows above are layer-level. These load real saved checkpoints through
GPTQModel.load(..., backend=BACKEND.HUMMING) and compare model logits against the backend that
normally serves the same file. Fixed 1x16 token IDs, fp16/fp32 logits.

Checkpoint Format Layers converted Reference backend Max abs Mean abs Normalized
Qwen/Qwen3-0.6B-FP8 (block 128x128) FP8 196 / 196 BACKEND.TORCH 0.7188 7.16e-2 3.67e-2
Qwen2.5-0.5B, MACaQ plain (rotation="none") MXFP4 168 / 168 BACKEND.MACAQ_TORCH 2.4814 1.11e-1 6.49e-2

Those deltas are dominated by each checkpoint's own quantization error, not by the kernel. Measured
against the unquantized original:

Checkpoint Backend vs bf16 original (normalized)
Qwen3-0.6B-FP8 Torch FP8 1.471e-1
Qwen3-0.6B-FP8 Humming FP8 1.282e-1
Qwen2.5-0.5B MACaQ plain MACaQ torch 4.959e-1
Qwen2.5-0.5B MACaQ plain Humming MXFP4 4.901e-1

Humming is at or slightly closer to the unquantized model than the incumbent backend on both formats,
so the inter-backend numbers above are two approximations of a lossy checkpoint, not a regression.

Per-projection agreement on identical inputs (layer 0, same checkpoint, same activation tensor):

Projection FP8 (N=2048/1024, K=1024/2048) MXFP4
q_proj 6.72e-5 9.87e-4
k_proj 2.01e-5 -
v_proj 1.82e-5 -
o_proj 3.03e-3 0 (bit-exact)
gate_proj 1.40e-4 -
up_proj 5.54e-5 -
down_proj 3.22e-3 3.80e-3

Both backends sit ~2e-3 from an exact FP32 dequant oracle on the FP8 shapes, which is the bf16
output-rounding floor; the larger o_proj/down_proj deltas are tiling differences on N < K
shapes, not scale-handling errors (a full-mantissa block-scale stress test produced bit-identical
output whether the scales were kept in FP32 or cast to the compute dtype).

Note that plain MXFP4 (rotation="none", pre_mode="none") is intentionally the low-accuracy export:
~0.49 normalized from the original on Qwen2.5-0.5B. The rotated default (FORMAT.MXFP4_MACAQ) keeps
the Hadamard transform and is not served by this backend.

Model Support / Module Plan

Not applicable: no MODEL_MAP, model definition, alias or module-plan change. The new classes are
inference kernels selected by BACKEND.HUMMING; tests/kernels/test_selection.py and
tests/kernels/test_qlinear_hierarchy.py pass unchanged.

AWQ onboarding safety

Not applicable: no new model or AWQ grouping/search/replay/fold change. AwqHummingLinear consumes the
existing classic interleaved FORMAT.GEMM layout through Humming's AWQWeightSchema.

Logic Flow Documentation

Not applicable: the change adds an opt-in backend with format priority 0, so BACKEND.AUTO
selection order is unchanged. docs/humming.md documents the new conversion and forward path,
including the failure paths (missing package, ROCm, CPU, unsupported bits/desc_act).

Review Requirements

  • Reviewed this PR and checked it matches the existing kernel structure (SwordfishLinear /
    MarlinLinear conventions: post_init() conversion, SUPPORTS_* declarations, validate_once).
  • Used the project's normal extension points (BACKEND enum, SUPPORTS_FORMATS, importer
    discovery) with no monkeypatching in the implementation.
  • Kept the code surface minimal: no vendored CUDA, no new gptqmodel_ext target, one import-guarded
    facade module.

Kernel Accuracy Requirements

  • Accuracy was measured against an independent Torch FP32 oracle on the target GPU; tables above.
  • Fusion support is unchanged; no fusion backend was admitted.
  • Inventory/limits are listed above and asserted by test_rocm_kernel_contracts.py
    (HummingLinear / AwqHummingLinear are in the CUDA-only audit set).

Notes

  • humming-kernels is an optional runtime dependency; CI without it still imports gptqmodel, and
    the numeric tests skip with a precise reason. validate_once() reports the install hint.
  • A Humming-loaded model cannot be used as a repack source; reload the checkpoint or repack from a
    checkpoint-format kernel first.

Port the vLLM/SGLang Humming integration as an optional GPT-QModel backend.
Humming owns the packed layouts, so post_init() converts the checkpoint
tensors through Humming's own schema objects and forward() calls
humming_forward(); no CUDA source is vendored into gptqmodel_ext.

- BACKEND.HUMMING with gptq_humming/awq_humming legacy aliases
- HummingLinear (GPTQ W2/W4/W8) and AwqHummingLinear (AWQ W4)
- import-guarded, SM75+ CUDA-only, opt-in via format priority 0
- 27 registration/numeric tests, docs page, CREDITS entry
@Qubitium
Qubitium marked this pull request as ready for review November 21, 2026 04:34
Comment thread gptqmodel/utils/humming.py Fixed
Extend the shared Humming backend beyond GPTQ/AWQ integer weight-only
kernels with two float sub-kernels, and generalize the mixin so each
sub-kernel names its own checkpoint operands.

* `HummingFP8Linear` (METHOD.FP8, FORMAT.FP8): E4M3 `weight` +
  float32 `weight_scale_inv`, supporting tensor / row / block scale
  layouts and both inverse and multiplier scale semantics. Rejects
  per-token activation scaling (weight-only A16 path).
* `HummingMXFP4Linear` (METHOD.MACAQ, FORMAT.MXFP4): zero-copy handoff
  of MACaQ's nibble-packed E2M1 weights and E8M0 block scales, whose
  layout is byte-identical to humming's. Rejects MACaQ-rotated
  checkpoints.
* `prepare_humming_fp8_tensors` / `prepare_humming_mxfp4_tensors` in
  `gptqmodel/utils/humming.py`.
* `_HummingKernelMixin` gains `HUMMING_WEIGHT_ATTR` /
  `HUMMING_SCALE_ATTR` / `HUMMING_ZERO_POINT_ATTR` so GPTQ/AWQ keep
  `qweight`/`scales`/`qzeros` while FP8 and MXFP4 reuse their native
  checkpoint buffers.

Both kernels register with priority 0, i.e. explicit selection only;
humming JIT-compiles one kernel per layer shape so it never silently
displaces the default kernel. Neither is a repack source.

Validated on RTX 4090 (SM89) and RTX 5090 (SM120); see docs/humming.md
for the measured error tables.
@Qubitium Qubitium changed the title feat(humming): port the W2/W4/W8 CUDA GEMM backend from vLLM/SGLang feat(humming): port the Humming CUDA GEMM backend from vLLM/SGLang Nov 21, 2026
Both humming modules assigned `log = setup_logger()` without ever using it.
Remove the assignment and the now-unused import, as flagged by the
code-quality review on #5966.
@Qubitium Qubitium changed the title feat(humming): port the Humming CUDA GEMM backend from vLLM/SGLang feat(humming): port the Humming CUDA GEMM backend Nov 21, 2026
@Qubitium
Qubitium merged commit 9e349d0 into main Nov 21, 2026
6 checks passed
@Qubitium
Qubitium deleted the feat/humming-backend branch November 21, 2026 10:41
Qubitium added a commit that referenced this pull request Nov 22, 2026
…rip, PARO/offload, LFM3 tests) (#5980)

* fix(awq): restore scale search for PanGu, Bailing-MoE, Nemotron-H, Inkling2

#5978 deferred AWQ scaling for four families by returning empty fold groups.
Restore every group that measures output-neutral on the real forward and keep
only the folds that are provably non-neutral:

- gpt_pangu: generic planner, minus the top block's `attn.q_proj` in the
  `ln_1` group (it consumes `custom_query`, not the norm). `ln_1 -> k/v`,
  `attn.v_proj -> attn.c_proj`, `ln_2 -> mlp.c_fc` are neutral; the
  `c_fc -> c_proj` source stays `nosrc`.
- bailing_moe: drop the `isinstance(BailingConfig): return []` override and
  use the generic planner. All groups are neutral on dense/mla/hybrid/
  legacy_gqa (worst 1.9e-07).
- nemotron_h: generic planner for dense Mamba/attention/MLP mixers. Only the
  native `NemotronHMoE` mixer stays plain (one norm feeds shared and routed
  experts; shared-only fold 2.4e-2). Also move `A_log`/`D`/`dt_bias` out of
  the `mixer` tuple: as Parameters they closed the q/k/v subset and folded
  `o_proj` from the block norm (8.1e-2).
- inkling2_loop: keep the per-expert `up_proj -> down_proj` folds
  (1.9e-07..3.5e-06). Drop the tree-order `post_attention_layernorm` and
  `o_proj.linear -> gate_proj` groups, which follow module order rather than
  data flow and change the layer output by 8e-2..4e-1.

Tests pin neutrality on production configs and pin the dropped folds as
non-neutral, so a future planner change cannot silently reintroduce them.

* fix(quantize): honor the quantization device dtype and leave the model in eval

Three independent round-trip bugs that made an in-session model disagree with
the checkpoint it just saved:

- loader: auto dtype only followed `quantize_config.device` for MiMo sources.
  On an MPS/CUDA host a CPU quantization therefore loaded and re-saved the
  dense source in the host dtype (fp16) while a CPU reload resolved bf16,
  so the round trip was not dtype-preserving. Honor the quantization device
  for every `BaseQuantizeConfig`.
- torch qlinear: wide `_decode_248_weight` cast fp16 scales to bf16 before
  the multiply while the fused/compiled path multiplies in fp32 and rounds
  once. Compute wide decodes in fp32 (fp64 when requested) and cast the
  product once, so eager and compiled decode are bitwise equal (#5740).
- base: the quantize loop installs fresh kernel modules that start in
  training mode; their `train` transition also restores the checkpoint
  zero-point layout. Call `model.eval()` at the end of `quantize()` so an
  in-session forward decodes through the same path as the saved checkpoint.

* fix: stop a PARO placeholder rotation and a cached import traceback from failing runs

- paro_processor: `pack_module()` treated the minimal placeholder triple
  `pairs=(1,)`, `theta=(1,)`, `channel_scales=(1,)` used by packing-only
  callers as real rotation state and raised the #5659 `(8,128)` vs `(1,)`
  shape error. Keep the freshly built layer's identity rotation for that
  exact placeholder; a real krot mismatch still raises.
- humming: the optional-import `ModuleNotFoundError` was cached with its
  traceback. Kernel discovery imports every qlinear module from inside
  `quantize()`, so the retained stack pinned the model and its run-exit
  state; `del model` could never run the offload finalizer and left
  `offload/run-*` behind (#4595). Clear `__traceback__`/`__context__`/
  `__cause__`; type and message are unchanged.

* test: record Humming as fusion-excluded and fix the PARO looper stub

- test_fusion_kernel_backends: `HummingLinear`/`AwqHummingLinear` were added
  by #5966 without a fusion spec or an `EXCLUDED` entry, so the registry
  contract failed. Humming's `post_init()` replaces checkpoint tensors with
  shape-padded JIT operands and a per-layer `LayerConfig`; there is no
  concatenable native layout, so list both as excluded with that rationale.
- test_paro: `_replay_layer_outputs()` now always passes `consume_inputs=`
  (since #5928) but the first `_DummyLooper` stub kept the old signature.
  Accept and discard the keyword; test semantics are unchanged.

* test(lfm3): match the shipped AWQ fold contract

#5978 suppresses the `operator_norm -> q/k/v` fold on LFM3 attention layers
because the sigmoid gate consumer is left on the divided norm (uncompensated
delta 5.5e-2; compensating it rewrites non-quantized gate weights). The conv
layer still folds both input norms. Update the LFM3 tests to that contract
instead of the pre-#5978 expectation, and pin the suppression plus its
measured error so the decision is explicit.

* test(fusion): skip the TorchInt8Linear cache-race pair on darwin

`TorchInt8Linear` has no darwin implementation, so the two race tests failed
with a backend-availability error rather than exercising the cache. Gate the
module on the platform the kernel supports.
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.

1 participant