Skip to content

feat(KERNEL-QUANT-CIQ-GEMM-ROCM): land the W1 keep-quant providers on kROCM - #2782

Open
ghazni101 wants to merge 4 commits into
mudler:mainfrom
ghazni101:row/GFX1100-TG200-F1
Open

feat(KERNEL-QUANT-CIQ-GEMM-ROCM): land the W1 keep-quant providers on kROCM#2782
ghazni101 wants to merge 4 commits into
mudler:mainfrom
ghazni101:row/GFX1100-TG200-F1

Conversation

@ghazni101

Copy link
Copy Markdown
Contributor

Closes #2781.

Row: GFX1100-TG200

Lands the ROCm keep-quant GEMM infrastructure: the kROCM provider for
OpId::kMatmulBTQuant and OpId::kMatmulBTQuantGrouped. The provider does
the dequant-in-kernel dot product on-device, keeping the weight in its
block-quantized form through the GEMM rather than expanding to bf16 at load
time. VT_GGUF_KEEP_QUANT=0 restores load-time expansion.

The new provider lives in src/vt/rocm/rocm_quant_dot.hip and registers
itself for kROCM. The old MatmulBTQuantKernelRocm registration in
rocm_ops.hip (which routed to the limited rocm_grouped_gemm.hip
Q8_0/Q4_K/Q5_K/Q6_K-only dispatch) is removed so the new provider takes
effect.

Gates on gfx1100 / ROCm 7.14.0: test_rocm_quant_dot 132,094 assertions
green across all ten encodings (decode through prefill shapes, broadcast
and per-row grouped arms over a poisoned output buffer). Token-identical
to upstream baseline on Qwen3.5-4B Q4_K, 32-token greedy decode, seed 0.

This is the foundation PR for the GFX1100-TG200 decode campaign. Most
lever PRs depend on the keep-quant GEMM infrastructure it introduces.

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: AGENT:GLM-5-2 [OMP]

ghazni101 added a commit to ghazni101/vllm.cpp that referenced this pull request Sep 3, 2026
Adds the VT_GEMV_MMVQ=1 opt-in K-quant decode GEMV arm for MatmulBTQuant,
bit-exact vs the CPU oracle. The arm folds activation quant into the MMVQ
GEMV prologue (deleting the standalone QuantizeQ8KK launch) and widens the
gate to engine dtypes (bf16/f16 activations, bf16/f32 outputs).

Sub-levers:
- lever-B1: VT_GEMV_MMVQ_FOLD_MAX makes the fold crossover tunable at runtime
- lever-B2: VT_SKINNY_BF16=1 f32-out decode-skinny arm for GDN BA projections
- repair: m-gates the whole dispatch and makes the GEMV bit-equal to baseline
- repair-2: host-side dispatch-route counters + F1/F2 routing-witness gates
- lever-B2 test: red-first f32-out decode-skinny gate, true-unset routing window

Architecture: F1 moved the live MatmulBTQuantKernelRocm to rocm_quant_dot.hip
(anonymous namespace, internal linkage). T4a's MMVQ arm lives in
rocm_grouped_gemm.hip's version (external linkage, renamed to *Gdn). This PR
adds delegation: rocm_quant_dot.hip forwards Q4_K/Q5_K/Q6_K calls to the Gdn
version, preserving F1's IQ-type providers while activating T4a's MMVQ arm.

The default path (VT_GEMV_MMVQ unset) is byte-unchanged from F1. The arm is
opt-in and validated by test_rocm_quant_dot (6/6 cases, 719 assertions) and
test_rocm_skinny_f32 (2/2 cases, 51 assertions). Token-identical to upstream
baseline on Qwen3.5-4B Q4_K, 32-token greedy decode, seed 0.

Depends on mudler#2782 (F1 keep-quant GEMM infra).

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: AGENT:GLM-5-2 [OMP]
ghazni101 added a commit to ghazni101/vllm.cpp that referenced this pull request Sep 3, 2026
Adds the VT_GEMV_MMVQ=1 opt-in K-quant decode GEMV arm for MatmulBTQuant,
bit-exact vs the CPU oracle. The arm folds activation quant into the MMVQ
GEMV prologue (deleting the standalone QuantizeQ8KK launch) and widens the
gate to engine dtypes (bf16/f16 activations, bf16/f32 outputs).

Sub-levers:
- lever-B1: VT_GEMV_MMVQ_FOLD_MAX makes the fold crossover tunable at runtime
- lever-B2: VT_SKINNY_BF16=1 f32-out decode-skinny arm for GDN BA projections
- repair: m-gates the whole dispatch and makes the GEMV bit-equal to baseline
- repair-2: host-side dispatch-route counters + F1/F2 routing-witness gates
- lever-B2 test: red-first f32-out decode-skinny gate, true-unset routing window

Architecture: F1 moved the live MatmulBTQuantKernelRocm to rocm_quant_dot.hip
(anonymous namespace, internal linkage). T4a's MMVQ arm lives in
rocm_grouped_gemm.hip's version (external linkage, renamed to *Gdn). This PR
adds delegation: rocm_quant_dot.hip forwards Q4_K/Q5_K/Q6_K calls to the Gdn
version, preserving F1's IQ-type providers while activating T4a's MMVQ arm.

The default path (VT_GEMV_MMVQ unset) is byte-unchanged from F1. The arm is
opt-in and validated by test_rocm_quant_dot (6/6 cases, 719 assertions) and
test_rocm_skinny_f32 (2/2 cases, 51 assertions). Token-identical to upstream
baseline on Qwen3.5-4B Q4_K, 32-token greedy decode, seed 0.

Depends on mudler#2782 (F1 keep-quant GEMM infra).

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: AGENT:GLM-5-2 [OMP]
@ghazni101
ghazni101 force-pushed the row/GFX1100-TG200-F1 branch from dc036a4 to 29eebfc Compare September 3, 2026 19:24
ghazni101 added a commit to ghazni101/vllm.cpp that referenced this pull request Sep 3, 2026
Adds the VT_GEMV_MMVQ=1 opt-in K-quant decode GEMV arm for MatmulBTQuant,
bit-exact vs the CPU oracle. The arm folds activation quant into the MMVQ
GEMV prologue (deleting the standalone QuantizeQ8KK launch) and widens the
gate to engine dtypes (bf16/f16 activations, bf16/f32 outputs).

Sub-levers:
- lever-B1: VT_GEMV_MMVQ_FOLD_MAX makes the fold crossover tunable at runtime
- lever-B2: VT_SKINNY_BF16=1 f32-out decode-skinny arm for GDN BA projections
- repair: m-gates the whole dispatch and makes the GEMV bit-equal to baseline
- repair-2: host-side dispatch-route counters + F1/F2 routing-witness gates
- lever-B2 test: red-first f32-out decode-skinny gate, true-unset routing window

Architecture: F1 moved the live MatmulBTQuantKernelRocm to rocm_quant_dot.hip
(anonymous namespace, internal linkage). T4a's MMVQ arm lives in
rocm_grouped_gemm.hip's version (external linkage, renamed to *Gdn). This PR
adds delegation: rocm_quant_dot.hip forwards Q4_K/Q5_K/Q6_K calls to the Gdn
version, preserving F1's IQ-type providers while activating T4a's MMVQ arm.

The default path (VT_GEMV_MMVQ unset) is byte-unchanged from F1. The arm is
opt-in and validated by test_rocm_quant_dot (6/6 cases, 719 assertions) and
test_rocm_skinny_f32 (2/2 cases, 51 assertions). Token-identical to upstream
baseline on Qwen3.5-4B Q4_K, 32-token greedy decode, seed 0.

Depends on mudler#2782 (F1 keep-quant GEMM infra).

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: AGENT:GLM-5-2 [OMP]
ghazni101 added a commit to ghazni101/vllm.cpp that referenced this pull request Sep 3, 2026
…Norm epilogue

Lever-C adds an opt-in fused norm-quant epilogue (VT_NORM_QUANT_FUSED=1):
RmsNormRowKernel emits the row's Q8_K blocks alongside its normal output,
and MatmulBTQuant's K-quant branch skips the standalone QuantizeQ8KK when
the consuming activation matches the producer token. Byte-identical to the
standalone path by construction (shared QuantQ8KSBlock body).

New files:
- src/vt/rocm/rocm_act_quant.h: shared Q8_K quant-block body
- src/vt/rocm/rocm_norm_quant_bridge.h: producer-consumer token contract

Also fixes T4a routing counter placement (moved outside anonymous namespace
for external linkage) and restores VT_GEMV_MMVQ_FOLD_MAX env var reading
that was lost during cherry-pick conflict resolution.

The default path (VT_NORM_QUANT_FUSED unset) is byte-unchanged. Validated by
test_rocm_quant_dot (12/12 cases, 797 assertions). Token-identical to upstream
baseline on Qwen3.5-4B Q4_K, 32-token greedy decode, seed 0.

Depends on mudler#2782 (F1) and mudler#2790 (T4a).

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: AGENT:GLM-5-2 [OMP]
@ghazni101
ghazni101 force-pushed the row/GFX1100-TG200-F1 branch from 29eebfc to 73478f6 Compare September 4, 2026 07:34
ghazni101 added a commit to ghazni101/vllm.cpp that referenced this pull request Sep 4, 2026
Adds the VT_GEMV_MMVQ=1 opt-in K-quant decode GEMV arm for MatmulBTQuant,
bit-exact vs the CPU oracle. The arm folds activation quant into the MMVQ
GEMV prologue (deleting the standalone QuantizeQ8KK launch) and widens the
gate to engine dtypes (bf16/f16 activations, bf16/f32 outputs).

Sub-levers:
- lever-B1: VT_GEMV_MMVQ_FOLD_MAX makes the fold crossover tunable at runtime
- lever-B2: VT_SKINNY_BF16=1 f32-out decode-skinny arm for GDN BA projections
- repair: m-gates the whole dispatch and makes the GEMV bit-equal to baseline
- repair-2: host-side dispatch-route counters + F1/F2 routing-witness gates
- lever-B2 test: red-first f32-out decode-skinny gate, true-unset routing window

Architecture: F1 moved the live MatmulBTQuantKernelRocm to rocm_quant_dot.hip
(anonymous namespace, internal linkage). T4a's MMVQ arm lives in
rocm_grouped_gemm.hip's version (external linkage, renamed to *Gdn). This PR
adds delegation: rocm_quant_dot.hip forwards Q4_K/Q5_K/Q6_K calls to the Gdn
version, preserving F1's IQ-type providers while activating T4a's MMVQ arm.

The default path (VT_GEMV_MMVQ unset) is byte-unchanged from F1. The arm is
opt-in and validated by test_rocm_quant_dot (6/6 cases, 719 assertions) and
test_rocm_skinny_f32 (2/2 cases, 51 assertions). Token-identical to upstream
baseline on Qwen3.5-4B Q4_K, 32-token greedy decode, seed 0.

Depends on mudler#2782 (F1 keep-quant GEMM infra).

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: AGENT:GLM-5-2 [OMP]
ghazni101 added a commit to ghazni101/vllm.cpp that referenced this pull request Sep 4, 2026
…Norm epilogue

Lever-C adds an opt-in fused norm-quant epilogue (VT_NORM_QUANT_FUSED=1):
RmsNormRowKernel emits the row's Q8_K blocks alongside its normal output,
and MatmulBTQuant's K-quant branch skips the standalone QuantizeQ8KK when
the consuming activation matches the producer token. Byte-identical to the
standalone path by construction (shared QuantQ8KSBlock body).

New files:
- src/vt/rocm/rocm_act_quant.h: shared Q8_K quant-block body
- src/vt/rocm/rocm_norm_quant_bridge.h: producer-consumer token contract

Also fixes T4a routing counter placement (moved outside anonymous namespace
for external linkage) and restores VT_GEMV_MMVQ_FOLD_MAX env var reading
that was lost during cherry-pick conflict resolution.

The default path (VT_NORM_QUANT_FUSED unset) is byte-unchanged. Validated by
test_rocm_quant_dot (12/12 cases, 797 assertions). Token-identical to upstream
baseline on Qwen3.5-4B Q4_K, 32-token greedy decode, seed 0.

Depends on mudler#2782 (F1) and mudler#2790 (T4a).

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: AGENT:GLM-5-2 [OMP]
ghazni101 added a commit to ghazni101/vllm.cpp that referenced this pull request Sep 6, 2026
…Norm epilogue

Lever-C adds an opt-in fused norm-quant epilogue (VT_NORM_QUANT_FUSED=1):
RmsNormRowKernel emits the row's Q8_K blocks alongside its normal output,
and MatmulBTQuant's K-quant branch skips the standalone QuantizeQ8KK when
the consuming activation matches the producer token. Byte-identical to the
standalone path by construction (shared QuantQ8KSBlock body).

New files:
- src/vt/rocm/rocm_act_quant.h: shared Q8_K quant-block body
- src/vt/rocm/rocm_norm_quant_bridge.h: producer-consumer token contract

Also fixes T4a routing counter placement (moved outside anonymous namespace
for external linkage) and restores VT_GEMV_MMVQ_FOLD_MAX env var reading
that was lost during cherry-pick conflict resolution.

The default path (VT_NORM_QUANT_FUSED unset) is byte-unchanged. Validated by
test_rocm_quant_dot (12/12 cases, 797 assertions). Token-identical to upstream
baseline on Qwen3.5-4B Q4_K, 32-token greedy decode, seed 0.

Depends on mudler#2782 (F1) and mudler#2790 (T4a).

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: AGENT:GLM-5-2 [OMP]
ghazni101 added a commit to ghazni101/vllm.cpp that referenced this pull request Sep 6, 2026
Adds the VT_GEMV_MMVQ=1 opt-in K-quant decode GEMV arm for MatmulBTQuant,
bit-exact vs the CPU oracle. The arm folds activation quant into the MMVQ
GEMV prologue (deleting the standalone QuantizeQ8KK launch) and widens the
gate to engine dtypes (bf16/f16 activations, bf16/f32 outputs).

Sub-levers:
- lever-B1: VT_GEMV_MMVQ_FOLD_MAX makes the fold crossover tunable at runtime
- lever-B2: VT_SKINNY_BF16=1 f32-out decode-skinny arm for GDN BA projections
- repair: m-gates the whole dispatch and makes the GEMV bit-equal to baseline
- repair-2: host-side dispatch-route counters + F1/F2 routing-witness gates
- lever-B2 test: red-first f32-out decode-skinny gate, true-unset routing window

Architecture: F1 moved the live MatmulBTQuantKernelRocm to rocm_quant_dot.hip
(anonymous namespace, internal linkage). T4a's MMVQ arm lives in
rocm_grouped_gemm.hip's version (external linkage, renamed to *Gdn). This PR
adds delegation: rocm_quant_dot.hip forwards Q4_K/Q5_K/Q6_K calls to the Gdn
version, preserving F1's IQ-type providers while activating T4a's MMVQ arm.

The default path (VT_GEMV_MMVQ unset) is byte-unchanged from F1. The arm is
opt-in and validated by test_rocm_quant_dot (6/6 cases, 719 assertions) and
test_rocm_skinny_f32 (2/2 cases, 51 assertions). Token-identical to upstream
baseline on Qwen3.5-4B Q4_K, 32-token greedy decode, seed 0.

Rebased onto the external-contributor landing branch (staging tip
b9f2ef4), which already carries F1 (mudler#2782) and its grouped-Q8_0 repair
(mudler#2927). This version carries NONE of the removals the previous base commit
51f5222 made: the ten-row kCases table, kMaxNmseErr/nmse_ref_max and the
three F1 provider cases are restored beside this arm's kKQuantCases (mudler#2938);
Dp4a keeps the __ockl_sdot4 hardware dot (mudler#2939); the documented
VT_ROCM_Q8K_BLOCK selector (SelectQ8KQuantArm/LaunchQ8KQuantizer), the mudler#2472
cooperative gfx1100 default (QuantizeQ8KCooperativeK) and the
VT_ROCM_Q6K_SMALL_PRIVATE A/B arm are restored with their witness helpers;
the shared bench-evidence file keeps lever B1's section 14 record, whose
truncation this branch had carried.

Depends on mudler#2782 (F1 keep-quant GEMM infra).

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: AGENT:GLM-5-2 [OMP]
Assisted-by: AGENT:OMEN-ALPHA [OMP]
ghazni101 added a commit to ghazni101/vllm.cpp that referenced this pull request Sep 6, 2026
…Norm epilogue

Lever-C adds an opt-in fused norm-quant epilogue (VT_NORM_QUANT_FUSED=1):
RmsNormRowKernel emits the row's Q8_K blocks alongside its normal output,
and MatmulBTQuant's K-quant branch skips the standalone QuantizeQ8KK when
the consuming activation matches the producer token. Byte-identical to the
standalone path by construction (shared QuantQ8KSBlock body).

New files:
- src/vt/rocm/rocm_act_quant.h: shared Q8_K quant-block body
- src/vt/rocm/rocm_norm_quant_bridge.h: producer-consumer token contract

Also fixes T4a routing counter placement (moved outside anonymous namespace
for external linkage) and restores VT_GEMV_MMVQ_FOLD_MAX env var reading
that was lost during cherry-pick conflict resolution.

The default path (VT_NORM_QUANT_FUSED unset) is byte-unchanged. Validated by
test_rocm_quant_dot (12/12 cases, 797 assertions). Token-identical to upstream
baseline on Qwen3.5-4B Q4_K, 32-token greedy decode, seed 0.

Depends on mudler#2782 (F1) and mudler#2790 (T4a).

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: AGENT:GLM-5-2 [OMP]
ghazni101 added a commit to ghazni101/vllm.cpp that referenced this pull request Sep 6, 2026
Adds the VT_GEMV_MMVQ=1 opt-in K-quant decode GEMV arm for MatmulBTQuant,
bit-exact vs the CPU oracle. The arm folds activation quant into the MMVQ
GEMV prologue (deleting the standalone QuantizeQ8KK launch) and widens the
gate to engine dtypes (bf16/f16 activations, bf16/f32 outputs).

Sub-levers:
- lever-B1: VT_GEMV_MMVQ_FOLD_MAX makes the fold crossover tunable at runtime
- lever-B2: VT_SKINNY_BF16=1 f32-out decode-skinny arm for GDN BA projections
- repair: m-gates the whole dispatch and makes the GEMV bit-equal to baseline
- repair-2: host-side dispatch-route counters + F1/F2 routing-witness gates
- lever-B2 test: red-first f32-out decode-skinny gate, true-unset routing window

Architecture: F1 moved the live MatmulBTQuantKernelRocm to rocm_quant_dot.hip
(anonymous namespace, internal linkage). T4a's MMVQ arm lives in
rocm_grouped_gemm.hip's version (external linkage, renamed to *Gdn). This PR
adds delegation: rocm_quant_dot.hip forwards Q4_K/Q5_K/Q6_K calls to the Gdn
version, preserving F1's IQ-type providers while activating T4a's MMVQ arm.

The default path (VT_GEMV_MMVQ unset) is byte-unchanged from F1. The arm is
opt-in and validated by test_rocm_quant_dot (6/6 cases, 719 assertions) and
test_rocm_skinny_f32 (2/2 cases, 51 assertions). Token-identical to upstream
baseline on Qwen3.5-4B Q4_K, 32-token greedy decode, seed 0.

Rebased onto the external-contributor landing branch (staging tip
b9f2ef4), which already carries F1 (mudler#2782) and its grouped-Q8_0 repair
(mudler#2927). This version carries NONE of the removals the previous base commit
51f5222 made: the ten-row kCases table, kMaxNmseErr/nmse_ref_max and the
three F1 provider cases are restored beside this arm's kKQuantCases (mudler#2938);
Dp4a keeps the __ockl_sdot4 hardware dot (mudler#2939); the documented
VT_ROCM_Q8K_BLOCK selector (SelectQ8KQuantArm/LaunchQ8KQuantizer), the mudler#2472
cooperative gfx1100 default (QuantizeQ8KCooperativeK) and the
VT_ROCM_Q6K_SMALL_PRIVATE A/B arm are restored with their witness helpers;
the shared bench-evidence file keeps lever B1's section 14 record, whose
truncation this branch had carried.

Depends on mudler#2782 (F1 keep-quant GEMM infra).

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: AGENT:GLM-5-2 [OMP]
Assisted-by: AGENT:OMEN-ALPHA [OMP]
ghazni101 added a commit to ghazni101/vllm.cpp that referenced this pull request Sep 6, 2026
…Norm epilogue

Lever-C adds an opt-in fused norm-quant epilogue (VT_NORM_QUANT_FUSED=1):
RmsNormRowKernel emits the row's Q8_K blocks alongside its normal output,
and MatmulBTQuant's K-quant branch skips the standalone QuantizeQ8KK when
the consuming activation matches the producer token. Byte-identical to the
standalone path by construction (shared QuantQ8KSBlock body).

New files:
- src/vt/rocm/rocm_act_quant.h: shared Q8_K quant-block body
- src/vt/rocm/rocm_norm_quant_bridge.h: producer-consumer token contract

Also fixes T4a routing counter placement (moved outside anonymous namespace
for external linkage) and restores VT_GEMV_MMVQ_FOLD_MAX env var reading
that was lost during cherry-pick conflict resolution.

The default path (VT_NORM_QUANT_FUSED unset) is byte-unchanged. Validated by
test_rocm_quant_dot (12/12 cases, 797 assertions). Token-identical to upstream
baseline on Qwen3.5-4B Q4_K, 32-token greedy decode, seed 0.

Depends on mudler#2782 (F1) and mudler#2790 (T4a).

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: AGENT:GLM-5-2 [OMP]
ghazni101 added a commit to ghazni101/vllm.cpp that referenced this pull request Sep 6, 2026
Adds the VT_GEMV_MMVQ=1 opt-in K-quant decode GEMV arm for MatmulBTQuant,
bit-exact vs the CPU oracle. The arm folds activation quant into the MMVQ
GEMV prologue (deleting the standalone QuantizeQ8KK launch) and widens the
gate to engine dtypes (bf16/f16 activations, bf16/f32 outputs).

Sub-levers:
- lever-B1: VT_GEMV_MMVQ_FOLD_MAX makes the fold crossover tunable at runtime
- lever-B2: VT_SKINNY_BF16=1 f32-out decode-skinny arm for GDN BA projections
- repair: m-gates the whole dispatch and makes the GEMV bit-equal to baseline
- repair-2: host-side dispatch-route counters + F1/F2 routing-witness gates
- lever-B2 test: red-first f32-out decode-skinny gate, true-unset routing window

Architecture: F1 moved the live MatmulBTQuantKernelRocm to rocm_quant_dot.hip
(anonymous namespace, internal linkage). T4a's MMVQ arm lives in
rocm_grouped_gemm.hip's version (external linkage, renamed to *Gdn). This PR
adds delegation: rocm_quant_dot.hip forwards Q4_K/Q5_K/Q6_K calls to the Gdn
version, preserving F1's IQ-type providers while activating T4a's MMVQ arm.

The default path (VT_GEMV_MMVQ unset) is byte-unchanged from F1. The arm is
opt-in and validated by test_rocm_quant_dot (6/6 cases, 719 assertions) and
test_rocm_skinny_f32 (2/2 cases, 51 assertions). Token-identical to upstream
baseline on Qwen3.5-4B Q4_K, 32-token greedy decode, seed 0.

Rebased onto the external-contributor landing branch (staging tip
b9f2ef4), which already carries F1 (mudler#2782) and its grouped-Q8_0 repair
(mudler#2927). This version carries NONE of the removals the previous base commit
51f5222 made: the ten-row kCases table, kMaxNmseErr/nmse_ref_max and the
three F1 provider cases are restored beside this arm's kKQuantCases (mudler#2938);
Dp4a keeps the __ockl_sdot4 hardware dot (mudler#2939); the documented
VT_ROCM_Q8K_BLOCK selector (SelectQ8KQuantArm/LaunchQ8KQuantizer), the mudler#2472
cooperative gfx1100 default (QuantizeQ8KCooperativeK) and the
VT_ROCM_Q6K_SMALL_PRIVATE A/B arm are restored with their witness helpers;
the shared bench-evidence file keeps lever B1's section 14 record, whose
truncation this branch had carried.

Depends on mudler#2782 (F1 keep-quant GEMM infra).

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: AGENT:GLM-5-2 [OMP]
Assisted-by: AGENT:OMEN-ALPHA [OMP]
ghazni101 added a commit to ghazni101/vllm.cpp that referenced this pull request Sep 6, 2026
…Norm epilogue

Lever-C adds an opt-in fused norm-quant epilogue (VT_NORM_QUANT_FUSED=1):
RmsNormRowKernel emits the row's Q8_K blocks alongside its normal output,
and MatmulBTQuant's K-quant branch skips the standalone QuantizeQ8KK when
the consuming activation matches the producer token. Byte-identical to the
standalone path by construction (shared QuantQ8KSBlock body).

New files:
- src/vt/rocm/rocm_act_quant.h: shared Q8_K quant-block body
- src/vt/rocm/rocm_norm_quant_bridge.h: producer-consumer token contract

Also fixes T4a routing counter placement (moved outside anonymous namespace
for external linkage) and restores VT_GEMV_MMVQ_FOLD_MAX env var reading
that was lost during cherry-pick conflict resolution.

The default path (VT_NORM_QUANT_FUSED unset) is byte-unchanged. Validated by
test_rocm_quant_dot (12/12 cases, 797 assertions). Token-identical to upstream
baseline on Qwen3.5-4B Q4_K, 32-token greedy decode, seed 0.

Depends on mudler#2782 (F1) and mudler#2790 (T4a).

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: AGENT:GLM-5-2 [OMP]
ghazni101 added a commit to ghazni101/vllm.cpp that referenced this pull request Sep 6, 2026
Adds the VT_GEMV_MMVQ=1 opt-in K-quant decode GEMV arm for MatmulBTQuant,
bit-exact vs the CPU oracle. The arm folds activation quant into the MMVQ
GEMV prologue (deleting the standalone QuantizeQ8KK launch) and widens the
gate to engine dtypes (bf16/f16 activations, bf16/f32 outputs).

Sub-levers:
- lever-B1: VT_GEMV_MMVQ_FOLD_MAX makes the fold crossover tunable at runtime
- lever-B2: VT_SKINNY_BF16=1 f32-out decode-skinny arm for GDN BA projections
- repair: m-gates the whole dispatch and makes the GEMV bit-equal to baseline
- repair-2: host-side dispatch-route counters + F1/F2 routing-witness gates
- lever-B2 test: red-first f32-out decode-skinny gate, true-unset routing window

Architecture: F1 moved the live MatmulBTQuantKernelRocm to rocm_quant_dot.hip
(anonymous namespace, internal linkage). T4a's MMVQ arm lives in
rocm_grouped_gemm.hip's version (external linkage, renamed to *Gdn). This PR
adds delegation: rocm_quant_dot.hip forwards Q4_K/Q5_K/Q6_K calls to the Gdn
version, preserving F1's IQ-type providers while activating T4a's MMVQ arm.

The default path (VT_GEMV_MMVQ unset) is byte-unchanged from F1. The arm is
opt-in and validated by test_rocm_quant_dot (6/6 cases, 719 assertions) and
test_rocm_skinny_f32 (2/2 cases, 51 assertions). Token-identical to upstream
baseline on Qwen3.5-4B Q4_K, 32-token greedy decode, seed 0.

Rebased onto the external-contributor landing branch (staging tip
b9f2ef4), which already carries F1 (mudler#2782) and its grouped-Q8_0 repair
(mudler#2927). This version carries NONE of the removals the previous base commit
51f5222 made: the ten-row kCases table, kMaxNmseErr/nmse_ref_max and the
three F1 provider cases are restored beside this arm's kKQuantCases (mudler#2938);
Dp4a keeps the __ockl_sdot4 hardware dot (mudler#2939); the documented
VT_ROCM_Q8K_BLOCK selector (SelectQ8KQuantArm/LaunchQ8KQuantizer), the mudler#2472
cooperative gfx1100 default (QuantizeQ8KCooperativeK) and the
VT_ROCM_Q6K_SMALL_PRIVATE A/B arm are restored with their witness helpers;
the shared bench-evidence file keeps lever B1's section 14 record, whose
truncation this branch had carried.

Depends on mudler#2782 (F1 keep-quant GEMM infra).

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: AGENT:GLM-5-2 [OMP]
Assisted-by: AGENT:OMEN-ALPHA [OMP]
ghazni101 added a commit to ghazni101/vllm.cpp that referenced this pull request Sep 6, 2026
…Norm epilogue

Lever-C adds an opt-in fused norm-quant epilogue (VT_NORM_QUANT_FUSED=1):
RmsNormRowKernel emits the row's Q8_K blocks alongside its normal output,
and MatmulBTQuant's K-quant branch skips the standalone QuantizeQ8KK when
the consuming activation matches the producer token. Byte-identical to the
standalone path by construction (shared QuantQ8KSBlock body).

New files:
- src/vt/rocm/rocm_act_quant.h: shared Q8_K quant-block body
- src/vt/rocm/rocm_norm_quant_bridge.h: producer-consumer token contract

Also fixes T4a routing counter placement (moved outside anonymous namespace
for external linkage) and restores VT_GEMV_MMVQ_FOLD_MAX env var reading
that was lost during cherry-pick conflict resolution.

The default path (VT_NORM_QUANT_FUSED unset) is byte-unchanged. Validated by
test_rocm_quant_dot (12/12 cases, 797 assertions). Token-identical to upstream
baseline on Qwen3.5-4B Q4_K, 32-token greedy decode, seed 0.

Depends on mudler#2782 (F1) and mudler#2790 (T4a).

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: AGENT:GLM-5-2 [OMP]
ghazni101 added a commit to ghazni101/vllm.cpp that referenced this pull request Sep 6, 2026
Adds the VT_GEMV_MMVQ=1 opt-in K-quant decode GEMV arm for MatmulBTQuant,
bit-exact vs the CPU oracle. The arm folds activation quant into the MMVQ
GEMV prologue (deleting the standalone QuantizeQ8KK launch) and widens the
gate to engine dtypes (bf16/f16 activations, bf16/f32 outputs).

Sub-levers:
- lever-B1: VT_GEMV_MMVQ_FOLD_MAX makes the fold crossover tunable at runtime
- lever-B2: VT_SKINNY_BF16=1 f32-out decode-skinny arm for GDN BA projections
- repair: m-gates the whole dispatch and makes the GEMV bit-equal to baseline
- repair-2: host-side dispatch-route counters + F1/F2 routing-witness gates
- lever-B2 test: red-first f32-out decode-skinny gate, true-unset routing window

Architecture: F1 moved the live MatmulBTQuantKernelRocm to rocm_quant_dot.hip
(anonymous namespace, internal linkage). T4a's MMVQ arm lives in
rocm_grouped_gemm.hip's version (external linkage, renamed to *Gdn). This PR
adds delegation: rocm_quant_dot.hip forwards Q4_K/Q5_K/Q6_K calls to the Gdn
version, preserving F1's IQ-type providers while activating T4a's MMVQ arm.

The default path (VT_GEMV_MMVQ unset) is byte-unchanged from F1. The arm is
opt-in and validated by test_rocm_quant_dot (6/6 cases, 719 assertions) and
test_rocm_skinny_f32 (2/2 cases, 51 assertions). Token-identical to upstream
baseline on Qwen3.5-4B Q4_K, 32-token greedy decode, seed 0.

Rebased onto the external-contributor landing branch (staging tip
b9f2ef4), which already carries F1 (mudler#2782) and its grouped-Q8_0 repair
(mudler#2927). This version carries NONE of the removals the previous base commit
51f5222 made: the ten-row kCases table, kMaxNmseErr/nmse_ref_max and the
three F1 provider cases are restored beside this arm's kKQuantCases (mudler#2938);
Dp4a keeps the __ockl_sdot4 hardware dot (mudler#2939); the documented
VT_ROCM_Q8K_BLOCK selector (SelectQ8KQuantArm/LaunchQ8KQuantizer), the mudler#2472
cooperative gfx1100 default (QuantizeQ8KCooperativeK) and the
VT_ROCM_Q6K_SMALL_PRIVATE A/B arm are restored with their witness helpers;
the shared bench-evidence file keeps lever B1's section 14 record, whose
truncation this branch had carried.

Depends on mudler#2782 (F1 keep-quant GEMM infra).

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: AGENT:GLM-5-2 [OMP]
Assisted-by: AGENT:OMEN-ALPHA [OMP]
ghazni101 added a commit to ghazni101/vllm.cpp that referenced this pull request Sep 6, 2026
…Norm epilogue

Lever-C adds an opt-in fused norm-quant epilogue (VT_NORM_QUANT_FUSED=1):
RmsNormRowKernel emits the row's Q8_K blocks alongside its normal output,
and MatmulBTQuant's K-quant branch skips the standalone QuantizeQ8KK when
the consuming activation matches the producer token. Byte-identical to the
standalone path by construction (shared QuantQ8KSBlock body).

New files:
- src/vt/rocm/rocm_act_quant.h: shared Q8_K quant-block body
- src/vt/rocm/rocm_norm_quant_bridge.h: producer-consumer token contract

Also fixes T4a routing counter placement (moved outside anonymous namespace
for external linkage) and restores VT_GEMV_MMVQ_FOLD_MAX env var reading
that was lost during cherry-pick conflict resolution.

The default path (VT_NORM_QUANT_FUSED unset) is byte-unchanged. Validated by
test_rocm_quant_dot (12/12 cases, 797 assertions). Token-identical to upstream
baseline on Qwen3.5-4B Q4_K, 32-token greedy decode, seed 0.

Depends on mudler#2782 (F1) and mudler#2790 (T4a).

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: AGENT:GLM-5-2 [OMP]
ghazni101 added a commit to ghazni101/vllm.cpp that referenced this pull request Sep 6, 2026
Adds the VT_GEMV_MMVQ=1 opt-in K-quant decode GEMV arm for MatmulBTQuant,
bit-exact vs the CPU oracle. The arm folds activation quant into the MMVQ
GEMV prologue (deleting the standalone QuantizeQ8KK launch) and widens the
gate to engine dtypes (bf16/f16 activations, bf16/f32 outputs).

Sub-levers:
- lever-B1: VT_GEMV_MMVQ_FOLD_MAX makes the fold crossover tunable at runtime
- lever-B2: VT_SKINNY_BF16=1 f32-out decode-skinny arm for GDN BA projections
- repair: m-gates the whole dispatch and makes the GEMV bit-equal to baseline
- repair-2: host-side dispatch-route counters + F1/F2 routing-witness gates
- lever-B2 test: red-first f32-out decode-skinny gate, true-unset routing window

Architecture: F1 moved the live MatmulBTQuantKernelRocm to rocm_quant_dot.hip
(anonymous namespace, internal linkage). T4a's MMVQ arm lives in
rocm_grouped_gemm.hip's version (external linkage, renamed to *Gdn). This PR
adds delegation: rocm_quant_dot.hip forwards Q4_K/Q5_K/Q6_K calls to the Gdn
version, preserving F1's IQ-type providers while activating T4a's MMVQ arm.

The default path (VT_GEMV_MMVQ unset) is byte-unchanged from F1. The arm is
opt-in and validated by test_rocm_quant_dot (6/6 cases, 719 assertions) and
test_rocm_skinny_f32 (2/2 cases, 51 assertions). Token-identical to upstream
baseline on Qwen3.5-4B Q4_K, 32-token greedy decode, seed 0.

Rebased onto the external-contributor landing branch (staging tip
b9f2ef4), which already carries F1 (mudler#2782) and its grouped-Q8_0 repair
(mudler#2927). This version carries NONE of the removals the previous base commit
51f5222 made: the ten-row kCases table, kMaxNmseErr/nmse_ref_max and the
three F1 provider cases are restored beside this arm's kKQuantCases (mudler#2938);
Dp4a keeps the __ockl_sdot4 hardware dot (mudler#2939); the documented
VT_ROCM_Q8K_BLOCK selector (SelectQ8KQuantArm/LaunchQ8KQuantizer), the mudler#2472
cooperative gfx1100 default (QuantizeQ8KCooperativeK) and the
VT_ROCM_Q6K_SMALL_PRIVATE A/B arm are restored with their witness helpers;
the shared bench-evidence file keeps lever B1's section 14 record, whose
truncation this branch had carried.

Depends on mudler#2782 (F1 keep-quant GEMM infra).

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: AGENT:GLM-5-2 [OMP]
Assisted-by: AGENT:OMEN-ALPHA [OMP]
ghazni101 added a commit to ghazni101/vllm.cpp that referenced this pull request Sep 6, 2026
…Norm epilogue

Lever-C adds an opt-in fused norm-quant epilogue (VT_NORM_QUANT_FUSED=1):
RmsNormRowKernel emits the row's Q8_K blocks alongside its normal output,
and MatmulBTQuant's K-quant branch skips the standalone QuantizeQ8KK when
the consuming activation matches the producer token. Byte-identical to the
standalone path by construction (shared QuantQ8KSBlock body).

New files:
- src/vt/rocm/rocm_act_quant.h: shared Q8_K quant-block body
- src/vt/rocm/rocm_norm_quant_bridge.h: producer-consumer token contract

Also fixes T4a routing counter placement (moved outside anonymous namespace
for external linkage) and restores VT_GEMV_MMVQ_FOLD_MAX env var reading
that was lost during cherry-pick conflict resolution.

The default path (VT_NORM_QUANT_FUSED unset) is byte-unchanged. Validated by
test_rocm_quant_dot (12/12 cases, 797 assertions). Token-identical to upstream
baseline on Qwen3.5-4B Q4_K, 32-token greedy decode, seed 0.

Depends on mudler#2782 (F1) and mudler#2790 (T4a).

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: AGENT:GLM-5-2 [OMP]
ghazni101 added a commit to ghazni101/vllm.cpp that referenced this pull request Sep 6, 2026
Adds the VT_GEMV_MMVQ=1 opt-in K-quant decode GEMV arm for MatmulBTQuant,
bit-exact vs the CPU oracle. The arm folds activation quant into the MMVQ
GEMV prologue (deleting the standalone QuantizeQ8KK launch) and widens the
gate to engine dtypes (bf16/f16 activations, bf16/f32 outputs).

Sub-levers:
- lever-B1: VT_GEMV_MMVQ_FOLD_MAX makes the fold crossover tunable at runtime
- lever-B2: VT_SKINNY_BF16=1 f32-out decode-skinny arm for GDN BA projections
- repair: m-gates the whole dispatch and makes the GEMV bit-equal to baseline
- repair-2: host-side dispatch-route counters + F1/F2 routing-witness gates
- lever-B2 test: red-first f32-out decode-skinny gate, true-unset routing window

Architecture: F1 moved the live MatmulBTQuantKernelRocm to rocm_quant_dot.hip
(anonymous namespace, internal linkage). T4a's MMVQ arm lives in
rocm_grouped_gemm.hip's version (external linkage, renamed to *Gdn). This PR
adds delegation: rocm_quant_dot.hip forwards Q4_K/Q5_K/Q6_K calls to the Gdn
version, preserving F1's IQ-type providers while activating T4a's MMVQ arm.

The default path (VT_GEMV_MMVQ unset) is byte-unchanged from F1. The arm is
opt-in and validated by test_rocm_quant_dot (6/6 cases, 719 assertions) and
test_rocm_skinny_f32 (2/2 cases, 51 assertions). Token-identical to upstream
baseline on Qwen3.5-4B Q4_K, 32-token greedy decode, seed 0.

Rebased onto the external-contributor landing branch (staging tip
b9f2ef4), which already carries F1 (mudler#2782) and its grouped-Q8_0 repair
(mudler#2927). This version carries NONE of the removals the previous base commit
51f5222 made: the ten-row kCases table, kMaxNmseErr/nmse_ref_max and the
three F1 provider cases are restored beside this arm's kKQuantCases (mudler#2938);
Dp4a keeps the __ockl_sdot4 hardware dot (mudler#2939); the documented
VT_ROCM_Q8K_BLOCK selector (SelectQ8KQuantArm/LaunchQ8KQuantizer), the mudler#2472
cooperative gfx1100 default (QuantizeQ8KCooperativeK) and the
VT_ROCM_Q6K_SMALL_PRIVATE A/B arm are restored with their witness helpers;
the shared bench-evidence file keeps lever B1's section 14 record, whose
truncation this branch had carried.

Depends on mudler#2782 (F1 keep-quant GEMM infra).

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: AGENT:GLM-5-2 [OMP]
Assisted-by: AGENT:OMEN-ALPHA [OMP]
ghazni101 added a commit to ghazni101/vllm.cpp that referenced this pull request Sep 6, 2026
…Norm epilogue

Lever-C adds an opt-in fused norm-quant epilogue (VT_NORM_QUANT_FUSED=1):
RmsNormRowKernel emits the row's Q8_K blocks alongside its normal output,
and MatmulBTQuant's K-quant branch skips the standalone QuantizeQ8KK when
the consuming activation matches the producer token. Byte-identical to the
standalone path by construction (shared QuantQ8KSBlock body).

New files:
- src/vt/rocm/rocm_act_quant.h: shared Q8_K quant-block body
- src/vt/rocm/rocm_norm_quant_bridge.h: producer-consumer token contract

Also fixes T4a routing counter placement (moved outside anonymous namespace
for external linkage) and restores VT_GEMV_MMVQ_FOLD_MAX env var reading
that was lost during cherry-pick conflict resolution.

The default path (VT_NORM_QUANT_FUSED unset) is byte-unchanged. Validated by
test_rocm_quant_dot (12/12 cases, 797 assertions). Token-identical to upstream
baseline on Qwen3.5-4B Q4_K, 32-token greedy decode, seed 0.

Depends on mudler#2782 (F1) and mudler#2790 (T4a).

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: AGENT:GLM-5-2 [OMP]
ghazni101 added a commit to ghazni101/vllm.cpp that referenced this pull request Sep 6, 2026
Adds the VT_GEMV_MMVQ=1 opt-in K-quant decode GEMV arm for MatmulBTQuant,
bit-exact vs the CPU oracle. The arm folds activation quant into the MMVQ
GEMV prologue (deleting the standalone QuantizeQ8KK launch) and widens the
gate to engine dtypes (bf16/f16 activations, bf16/f32 outputs).

Sub-levers:
- lever-B1: VT_GEMV_MMVQ_FOLD_MAX makes the fold crossover tunable at runtime
- lever-B2: VT_SKINNY_BF16=1 f32-out decode-skinny arm for GDN BA projections
- repair: m-gates the whole dispatch and makes the GEMV bit-equal to baseline
- repair-2: host-side dispatch-route counters + F1/F2 routing-witness gates
- lever-B2 test: red-first f32-out decode-skinny gate, true-unset routing window

Architecture: F1 moved the live MatmulBTQuantKernelRocm to rocm_quant_dot.hip
(anonymous namespace, internal linkage). T4a's MMVQ arm lives in
rocm_grouped_gemm.hip's version (external linkage, renamed to *Gdn). This PR
adds delegation: rocm_quant_dot.hip forwards Q4_K/Q5_K/Q6_K calls to the Gdn
version, preserving F1's IQ-type providers while activating T4a's MMVQ arm.

The default path (VT_GEMV_MMVQ unset) is byte-unchanged from F1. The arm is
opt-in and validated by test_rocm_quant_dot (6/6 cases, 719 assertions) and
test_rocm_skinny_f32 (2/2 cases, 51 assertions). Token-identical to upstream
baseline on Qwen3.5-4B Q4_K, 32-token greedy decode, seed 0.

Rebased onto the external-contributor landing branch (staging tip
b9f2ef4), which already carries F1 (mudler#2782) and its grouped-Q8_0 repair
(mudler#2927). This version carries NONE of the removals the previous base commit
51f5222 made: the ten-row kCases table, kMaxNmseErr/nmse_ref_max and the
three F1 provider cases are restored beside this arm's kKQuantCases (mudler#2938);
Dp4a keeps the __ockl_sdot4 hardware dot (mudler#2939); the documented
VT_ROCM_Q8K_BLOCK selector (SelectQ8KQuantArm/LaunchQ8KQuantizer), the mudler#2472
cooperative gfx1100 default (QuantizeQ8KCooperativeK) and the
VT_ROCM_Q6K_SMALL_PRIVATE A/B arm are restored with their witness helpers;
the shared bench-evidence file keeps lever B1's section 14 record, whose
truncation this branch had carried.

Depends on mudler#2782 (F1 keep-quant GEMM infra).

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: AGENT:GLM-5-2 [OMP]
Assisted-by: AGENT:OMEN-ALPHA [OMP]
ghazni101 added a commit to ghazni101/vllm.cpp that referenced this pull request Sep 6, 2026
…Norm epilogue

Lever-C adds an opt-in fused norm-quant epilogue (VT_NORM_QUANT_FUSED=1):
RmsNormRowKernel emits the row's Q8_K blocks alongside its normal output,
and MatmulBTQuant's K-quant branch skips the standalone QuantizeQ8KK when
the consuming activation matches the producer token. Byte-identical to the
standalone path by construction (shared QuantQ8KSBlock body).

New files:
- src/vt/rocm/rocm_act_quant.h: shared Q8_K quant-block body
- src/vt/rocm/rocm_norm_quant_bridge.h: producer-consumer token contract

Also fixes T4a routing counter placement (moved outside anonymous namespace
for external linkage) and restores VT_GEMV_MMVQ_FOLD_MAX env var reading
that was lost during cherry-pick conflict resolution.

The default path (VT_NORM_QUANT_FUSED unset) is byte-unchanged. Validated by
test_rocm_quant_dot (12/12 cases, 797 assertions). Token-identical to upstream
baseline on Qwen3.5-4B Q4_K, 32-token greedy decode, seed 0.

Depends on mudler#2782 (F1) and mudler#2790 (T4a).

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: AGENT:GLM-5-2 [OMP]
ghazni101 added a commit to ghazni101/vllm.cpp that referenced this pull request Sep 6, 2026
Adds the VT_GEMV_MMVQ=1 opt-in K-quant decode GEMV arm for MatmulBTQuant,
bit-exact vs the CPU oracle. The arm folds activation quant into the MMVQ
GEMV prologue (deleting the standalone QuantizeQ8KK launch) and widens the
gate to engine dtypes (bf16/f16 activations, bf16/f32 outputs).

Sub-levers:
- lever-B1: VT_GEMV_MMVQ_FOLD_MAX makes the fold crossover tunable at runtime
- lever-B2: VT_SKINNY_BF16=1 f32-out decode-skinny arm for GDN BA projections
- repair: m-gates the whole dispatch and makes the GEMV bit-equal to baseline
- repair-2: host-side dispatch-route counters + F1/F2 routing-witness gates
- lever-B2 test: red-first f32-out decode-skinny gate, true-unset routing window

Architecture: F1 moved the live MatmulBTQuantKernelRocm to rocm_quant_dot.hip
(anonymous namespace, internal linkage). T4a's MMVQ arm lives in
rocm_grouped_gemm.hip's version (external linkage, renamed to *Gdn). This PR
adds delegation: rocm_quant_dot.hip forwards Q4_K/Q5_K/Q6_K calls to the Gdn
version, preserving F1's IQ-type providers while activating T4a's MMVQ arm.

The default path (VT_GEMV_MMVQ unset) is byte-unchanged from F1. The arm is
opt-in and validated by test_rocm_quant_dot (6/6 cases, 719 assertions) and
test_rocm_skinny_f32 (2/2 cases, 51 assertions). Token-identical to upstream
baseline on Qwen3.5-4B Q4_K, 32-token greedy decode, seed 0.

Rebased onto the external-contributor landing branch (staging tip
b9f2ef4), which already carries F1 (mudler#2782) and its grouped-Q8_0 repair
(mudler#2927). This version carries NONE of the removals the previous base commit
51f5222 made: the ten-row kCases table, kMaxNmseErr/nmse_ref_max and the
three F1 provider cases are restored beside this arm's kKQuantCases (mudler#2938);
Dp4a keeps the __ockl_sdot4 hardware dot (mudler#2939); the documented
VT_ROCM_Q8K_BLOCK selector (SelectQ8KQuantArm/LaunchQ8KQuantizer), the mudler#2472
cooperative gfx1100 default (QuantizeQ8KCooperativeK) and the
VT_ROCM_Q6K_SMALL_PRIVATE A/B arm are restored with their witness helpers;
the shared bench-evidence file keeps lever B1's section 14 record, whose
truncation this branch had carried.

Depends on mudler#2782 (F1 keep-quant GEMM infra).

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: AGENT:GLM-5-2 [OMP]
Assisted-by: AGENT:OMEN-ALPHA [OMP]
ghazni101 added a commit to ghazni101/vllm.cpp that referenced this pull request Sep 6, 2026
…Norm epilogue

Lever-C adds an opt-in fused norm-quant epilogue (VT_NORM_QUANT_FUSED=1):
RmsNormRowKernel emits the row's Q8_K blocks alongside its normal output,
and MatmulBTQuant's K-quant branch skips the standalone QuantizeQ8KK when
the consuming activation matches the producer token. Byte-identical to the
standalone path by construction (shared QuantQ8KSBlock body).

New files:
- src/vt/rocm/rocm_act_quant.h: shared Q8_K quant-block body
- src/vt/rocm/rocm_norm_quant_bridge.h: producer-consumer token contract

Also fixes T4a routing counter placement (moved outside anonymous namespace
for external linkage) and restores VT_GEMV_MMVQ_FOLD_MAX env var reading
that was lost during cherry-pick conflict resolution.

The default path (VT_NORM_QUANT_FUSED unset) is byte-unchanged. Validated by
test_rocm_quant_dot (12/12 cases, 797 assertions). Token-identical to upstream
baseline on Qwen3.5-4B Q4_K, 32-token greedy decode, seed 0.

Depends on mudler#2782 (F1) and mudler#2790 (T4a).

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: AGENT:GLM-5-2 [OMP]
ghazni101 added a commit to ghazni101/vllm.cpp that referenced this pull request Sep 6, 2026
Adds the VT_GEMV_MMVQ=1 opt-in K-quant decode GEMV arm for MatmulBTQuant,
bit-exact vs the CPU oracle. The arm folds activation quant into the MMVQ
GEMV prologue (deleting the standalone QuantizeQ8KK launch) and widens the
gate to engine dtypes (bf16/f16 activations, bf16/f32 outputs).

Sub-levers:
- lever-B1: VT_GEMV_MMVQ_FOLD_MAX makes the fold crossover tunable at runtime
- lever-B2: VT_SKINNY_BF16=1 f32-out decode-skinny arm for GDN BA projections
- repair: m-gates the whole dispatch and makes the GEMV bit-equal to baseline
- repair-2: host-side dispatch-route counters + F1/F2 routing-witness gates
- lever-B2 test: red-first f32-out decode-skinny gate, true-unset routing window

Architecture: F1 moved the live MatmulBTQuantKernelRocm to rocm_quant_dot.hip
(anonymous namespace, internal linkage). T4a's MMVQ arm lives in
rocm_grouped_gemm.hip's version (external linkage, renamed to *Gdn). This PR
adds delegation: rocm_quant_dot.hip forwards Q4_K/Q5_K/Q6_K calls to the Gdn
version, preserving F1's IQ-type providers while activating T4a's MMVQ arm.

The default path (VT_GEMV_MMVQ unset) is byte-unchanged from F1. The arm is
opt-in and validated by test_rocm_quant_dot (6/6 cases, 719 assertions) and
test_rocm_skinny_f32 (2/2 cases, 51 assertions). Token-identical to upstream
baseline on Qwen3.5-4B Q4_K, 32-token greedy decode, seed 0.

Rebased onto the external-contributor landing branch (staging tip
b9f2ef4), which already carries F1 (mudler#2782) and its grouped-Q8_0 repair
(mudler#2927). This version carries NONE of the removals the previous base commit
51f5222 made: the ten-row kCases table, kMaxNmseErr/nmse_ref_max and the
three F1 provider cases are restored beside this arm's kKQuantCases (mudler#2938);
Dp4a keeps the __ockl_sdot4 hardware dot (mudler#2939); the documented
VT_ROCM_Q8K_BLOCK selector (SelectQ8KQuantArm/LaunchQ8KQuantizer), the mudler#2472
cooperative gfx1100 default (QuantizeQ8KCooperativeK) and the
VT_ROCM_Q6K_SMALL_PRIVATE A/B arm are restored with their witness helpers;
the shared bench-evidence file keeps lever B1's section 14 record, whose
truncation this branch had carried.

Depends on mudler#2782 (F1 keep-quant GEMM infra).

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: AGENT:GLM-5-2 [OMP]
Assisted-by: AGENT:OMEN-ALPHA [OMP]
ghazni101 added a commit to ghazni101/vllm.cpp that referenced this pull request Sep 6, 2026
…Norm epilogue

Lever-C adds an opt-in fused norm-quant epilogue (VT_NORM_QUANT_FUSED=1):
RmsNormRowKernel emits the row's Q8_K blocks alongside its normal output,
and MatmulBTQuant's K-quant branch skips the standalone QuantizeQ8KK when
the consuming activation matches the producer token. Byte-identical to the
standalone path by construction (shared QuantQ8KSBlock body).

New files:
- src/vt/rocm/rocm_act_quant.h: shared Q8_K quant-block body
- src/vt/rocm/rocm_norm_quant_bridge.h: producer-consumer token contract

Also fixes T4a routing counter placement (moved outside anonymous namespace
for external linkage) and restores VT_GEMV_MMVQ_FOLD_MAX env var reading
that was lost during cherry-pick conflict resolution.

The default path (VT_NORM_QUANT_FUSED unset) is byte-unchanged. Validated by
test_rocm_quant_dot (12/12 cases, 797 assertions). Token-identical to upstream
baseline on Qwen3.5-4B Q4_K, 32-token greedy decode, seed 0.

Depends on mudler#2782 (F1) and mudler#2790 (T4a).

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: AGENT:GLM-5-2 [OMP]
ghazni101 added a commit to ghazni101/vllm.cpp that referenced this pull request Sep 6, 2026
Adds the VT_GEMV_MMVQ=1 opt-in K-quant decode GEMV arm for MatmulBTQuant,
bit-exact vs the CPU oracle. The arm folds activation quant into the MMVQ
GEMV prologue (deleting the standalone QuantizeQ8KK launch) and widens the
gate to engine dtypes (bf16/f16 activations, bf16/f32 outputs).

Sub-levers:
- lever-B1: VT_GEMV_MMVQ_FOLD_MAX makes the fold crossover tunable at runtime
- lever-B2: VT_SKINNY_BF16=1 f32-out decode-skinny arm for GDN BA projections
- repair: m-gates the whole dispatch and makes the GEMV bit-equal to baseline
- repair-2: host-side dispatch-route counters + F1/F2 routing-witness gates
- lever-B2 test: red-first f32-out decode-skinny gate, true-unset routing window

Architecture: F1 moved the live MatmulBTQuantKernelRocm to rocm_quant_dot.hip
(anonymous namespace, internal linkage). T4a's MMVQ arm lives in
rocm_grouped_gemm.hip's version (external linkage, renamed to *Gdn). This PR
adds delegation: rocm_quant_dot.hip forwards Q4_K/Q5_K/Q6_K calls to the Gdn
version, preserving F1's IQ-type providers while activating T4a's MMVQ arm.

The default path (VT_GEMV_MMVQ unset) is byte-unchanged from F1. The arm is
opt-in and validated by test_rocm_quant_dot (6/6 cases, 719 assertions) and
test_rocm_skinny_f32 (2/2 cases, 51 assertions). Token-identical to upstream
baseline on Qwen3.5-4B Q4_K, 32-token greedy decode, seed 0.

Rebased onto the external-contributor landing branch (staging tip
b9f2ef4), which already carries F1 (mudler#2782) and its grouped-Q8_0 repair
(mudler#2927). This version carries NONE of the removals the previous base commit
51f5222 made: the ten-row kCases table, kMaxNmseErr/nmse_ref_max and the
three F1 provider cases are restored beside this arm's kKQuantCases (mudler#2938);
Dp4a keeps the __ockl_sdot4 hardware dot (mudler#2939); the documented
VT_ROCM_Q8K_BLOCK selector (SelectQ8KQuantArm/LaunchQ8KQuantizer), the mudler#2472
cooperative gfx1100 default (QuantizeQ8KCooperativeK) and the
VT_ROCM_Q6K_SMALL_PRIVATE A/B arm are restored with their witness helpers;
the shared bench-evidence file keeps lever B1's section 14 record, whose
truncation this branch had carried.

Depends on mudler#2782 (F1 keep-quant GEMM infra).

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: AGENT:GLM-5-2 [OMP]
Assisted-by: AGENT:OMEN-ALPHA [OMP]
ghazni101 added a commit to ghazni101/vllm.cpp that referenced this pull request Sep 6, 2026
…Norm epilogue

Lever-C adds an opt-in fused norm-quant epilogue (VT_NORM_QUANT_FUSED=1):
RmsNormRowKernel emits the row's Q8_K blocks alongside its normal output,
and MatmulBTQuant's K-quant branch skips the standalone QuantizeQ8KK when
the consuming activation matches the producer token. Byte-identical to the
standalone path by construction (shared QuantQ8KSBlock body).

New files:
- src/vt/rocm/rocm_act_quant.h: shared Q8_K quant-block body
- src/vt/rocm/rocm_norm_quant_bridge.h: producer-consumer token contract

Also fixes T4a routing counter placement (moved outside anonymous namespace
for external linkage) and restores VT_GEMV_MMVQ_FOLD_MAX env var reading
that was lost during cherry-pick conflict resolution.

The default path (VT_NORM_QUANT_FUSED unset) is byte-unchanged. Validated by
test_rocm_quant_dot (12/12 cases, 797 assertions). Token-identical to upstream
baseline on Qwen3.5-4B Q4_K, 32-token greedy decode, seed 0.

Depends on mudler#2782 (F1) and mudler#2790 (T4a).

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: AGENT:GLM-5-2 [OMP]
ghazni101 added a commit to ghazni101/vllm.cpp that referenced this pull request Sep 6, 2026
Adds the VT_GEMV_MMVQ=1 opt-in K-quant decode GEMV arm for MatmulBTQuant,
bit-exact vs the CPU oracle. The arm folds activation quant into the MMVQ
GEMV prologue (deleting the standalone QuantizeQ8KK launch) and widens the
gate to engine dtypes (bf16/f16 activations, bf16/f32 outputs).

Sub-levers:
- lever-B1: VT_GEMV_MMVQ_FOLD_MAX makes the fold crossover tunable at runtime
- lever-B2: VT_SKINNY_BF16=1 f32-out decode-skinny arm for GDN BA projections
- repair: m-gates the whole dispatch and makes the GEMV bit-equal to baseline
- repair-2: host-side dispatch-route counters + F1/F2 routing-witness gates
- lever-B2 test: red-first f32-out decode-skinny gate, true-unset routing window

Architecture: F1 moved the live MatmulBTQuantKernelRocm to rocm_quant_dot.hip
(anonymous namespace, internal linkage). T4a's MMVQ arm lives in
rocm_grouped_gemm.hip's version (external linkage, renamed to *Gdn). This PR
adds delegation: rocm_quant_dot.hip forwards Q4_K/Q5_K/Q6_K calls to the Gdn
version, preserving F1's IQ-type providers while activating T4a's MMVQ arm.

The default path (VT_GEMV_MMVQ unset) is byte-unchanged from F1. The arm is
opt-in and validated by test_rocm_quant_dot (6/6 cases, 719 assertions) and
test_rocm_skinny_f32 (2/2 cases, 51 assertions). Token-identical to upstream
baseline on Qwen3.5-4B Q4_K, 32-token greedy decode, seed 0.

Rebased onto the external-contributor landing branch (staging tip
b9f2ef4), which already carries F1 (mudler#2782) and its grouped-Q8_0 repair
(mudler#2927). This version carries NONE of the removals the previous base commit
51f5222 made: the ten-row kCases table, kMaxNmseErr/nmse_ref_max and the
three F1 provider cases are restored beside this arm's kKQuantCases (mudler#2938);
Dp4a keeps the __ockl_sdot4 hardware dot (mudler#2939); the documented
VT_ROCM_Q8K_BLOCK selector (SelectQ8KQuantArm/LaunchQ8KQuantizer), the mudler#2472
cooperative gfx1100 default (QuantizeQ8KCooperativeK) and the
VT_ROCM_Q6K_SMALL_PRIVATE A/B arm are restored with their witness helpers;
the shared bench-evidence file keeps lever B1's section 14 record, whose
truncation this branch had carried.

Depends on mudler#2782 (F1 keep-quant GEMM infra).

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: AGENT:GLM-5-2 [OMP]
Assisted-by: AGENT:OMEN-ALPHA [OMP]
ghazni101 added a commit to ghazni101/vllm.cpp that referenced this pull request Sep 6, 2026
…Norm epilogue

Lever-C adds an opt-in fused norm-quant epilogue (VT_NORM_QUANT_FUSED=1):
RmsNormRowKernel emits the row's Q8_K blocks alongside its normal output,
and MatmulBTQuant's K-quant branch skips the standalone QuantizeQ8KK when
the consuming activation matches the producer token. Byte-identical to the
standalone path by construction (shared QuantQ8KSBlock body).

New files:
- src/vt/rocm/rocm_act_quant.h: shared Q8_K quant-block body
- src/vt/rocm/rocm_norm_quant_bridge.h: producer-consumer token contract

Also fixes T4a routing counter placement (moved outside anonymous namespace
for external linkage) and restores VT_GEMV_MMVQ_FOLD_MAX env var reading
that was lost during cherry-pick conflict resolution.

The default path (VT_NORM_QUANT_FUSED unset) is byte-unchanged. Validated by
test_rocm_quant_dot (12/12 cases, 797 assertions). Token-identical to upstream
baseline on Qwen3.5-4B Q4_K, 32-token greedy decode, seed 0.

Depends on mudler#2782 (F1) and mudler#2790 (T4a).

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: AGENT:GLM-5-2 [OMP]
ghazni101 added a commit to ghazni101/vllm.cpp that referenced this pull request Sep 6, 2026
Adds the VT_GEMV_MMVQ=1 opt-in K-quant decode GEMV arm for MatmulBTQuant,
bit-exact vs the CPU oracle. The arm folds activation quant into the MMVQ
GEMV prologue (deleting the standalone QuantizeQ8KK launch) and widens the
gate to engine dtypes (bf16/f16 activations, bf16/f32 outputs).

Sub-levers:
- lever-B1: VT_GEMV_MMVQ_FOLD_MAX makes the fold crossover tunable at runtime
- lever-B2: VT_SKINNY_BF16=1 f32-out decode-skinny arm for GDN BA projections
- repair: m-gates the whole dispatch and makes the GEMV bit-equal to baseline
- repair-2: host-side dispatch-route counters + F1/F2 routing-witness gates
- lever-B2 test: red-first f32-out decode-skinny gate, true-unset routing window

Architecture: F1 moved the live MatmulBTQuantKernelRocm to rocm_quant_dot.hip
(anonymous namespace, internal linkage). T4a's MMVQ arm lives in
rocm_grouped_gemm.hip's version (external linkage, renamed to *Gdn). This PR
adds delegation: rocm_quant_dot.hip forwards Q4_K/Q5_K/Q6_K calls to the Gdn
version, preserving F1's IQ-type providers while activating T4a's MMVQ arm.

The default path (VT_GEMV_MMVQ unset) is byte-unchanged from F1. The arm is
opt-in and validated by test_rocm_quant_dot (6/6 cases, 719 assertions) and
test_rocm_skinny_f32 (2/2 cases, 51 assertions). Token-identical to upstream
baseline on Qwen3.5-4B Q4_K, 32-token greedy decode, seed 0.

Rebased onto the external-contributor landing branch (staging tip
b9f2ef4), which already carries F1 (mudler#2782) and its grouped-Q8_0 repair
(mudler#2927). This version carries NONE of the removals the previous base commit
51f5222 made: the ten-row kCases table, kMaxNmseErr/nmse_ref_max and the
three F1 provider cases are restored beside this arm's kKQuantCases (mudler#2938);
Dp4a keeps the __ockl_sdot4 hardware dot (mudler#2939); the documented
VT_ROCM_Q8K_BLOCK selector (SelectQ8KQuantArm/LaunchQ8KQuantizer), the mudler#2472
cooperative gfx1100 default (QuantizeQ8KCooperativeK) and the
VT_ROCM_Q6K_SMALL_PRIVATE A/B arm are restored with their witness helpers;
the shared bench-evidence file keeps lever B1's section 14 record, whose
truncation this branch had carried.

Depends on mudler#2782 (F1 keep-quant GEMM infra).

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: AGENT:GLM-5-2 [OMP]
Assisted-by: AGENT:OMEN-ALPHA [OMP]
ghazni101 added a commit to ghazni101/vllm.cpp that referenced this pull request Sep 6, 2026
…Norm epilogue

Lever-C adds an opt-in fused norm-quant epilogue (VT_NORM_QUANT_FUSED=1):
RmsNormRowKernel emits the row's Q8_K blocks alongside its normal output,
and MatmulBTQuant's K-quant branch skips the standalone QuantizeQ8KK when
the consuming activation matches the producer token. Byte-identical to the
standalone path by construction (shared QuantQ8KSBlock body).

New files:
- src/vt/rocm/rocm_act_quant.h: shared Q8_K quant-block body
- src/vt/rocm/rocm_norm_quant_bridge.h: producer-consumer token contract

Also fixes T4a routing counter placement (moved outside anonymous namespace
for external linkage) and restores VT_GEMV_MMVQ_FOLD_MAX env var reading
that was lost during cherry-pick conflict resolution.

The default path (VT_NORM_QUANT_FUSED unset) is byte-unchanged. Validated by
test_rocm_quant_dot (12/12 cases, 797 assertions). Token-identical to upstream
baseline on Qwen3.5-4B Q4_K, 32-token greedy decode, seed 0.

Depends on mudler#2782 (F1) and mudler#2790 (T4a).

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: AGENT:GLM-5-2 [OMP]
The grouped arm delegates Q4_K/Q5_K/Q6_K to MatmulBTQuantGroupedKernelRocmGdn
but not Q8_0, and Q8_0 has no arm in rocm_quant_dot.hip either, so a grouped
Q8_0 expert GEMM throws on a path main serves. Add Q8_0 to the delegation list
and a test case that fails when it is dropped.

Addressing localai-org-maint-bot review on mudler#2782 (issue mudler#2927).

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: AGENT:GLM-5-2 [OMP]
@ghazni101

Copy link
Copy Markdown
Contributor Author

Rebased onto upstream/main (6f5e9dc) and applied the #2927 repair: added DType::kQ8_0 to the grouped delegation list in MatmulBTQuantGroupedKernelRocm so grouped Q8_0 expert GEMMs route to MatmulBTQuantGroupedKernelRocmGdn instead of throwing. Added a q8_0 case to the kCases test table so the grouped arm has coverage that fails when the delegation is dropped.

The base is now origin/main, not stage/ext-prs-2026-09-04. Ping for re-review.

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: AGENT:GLM-5-2 [OMP]

@VikashLoomba

Copy link
Copy Markdown
Contributor

The current 876736c329bd573457576a63833b9a97a0749681 has a P1 linkage defect in the #2781 foundation flow. This is an immutable-source finding, not a claimed HIP build result.

rocm_grouped_gemm.hip:1323,1456 renames the only external definitions to MatmulBTQuantKernelRocmGdn and MatmulBTQuantGroupedKernelRocmGdn. The old-name replacements at rocm_quant_dot.hip:928,992 sit inside the anonymous namespace opened at line 53 and closed at line 1074. They cannot satisfy the external references retained by rocm_ops.hip:259–263.

The landed #3001 fused provider also calls the old external grouped symbol twice at rocm_moe_gate_up_swiglu.hip:160–161. Removing only the registrar leaves that consumer unresolved. Please restore compatible external entry points and reconcile registration ownership, then run a fresh HIP build/link and the provider tests. A complete comparison of all 6,033 source-tree blobs against the immutable base found no other replacement external definition. I independently verified the four affected files against their Git blob IDs.

The grouped Q8_0 delegation omission is repaired in this head and should no longer be reported as missing. The current test source implies three cases and 145,303 assertions if every device loop runs; that is a derived expected count, not an execution result.

The maintainer’s GLM hardware result also corrects the old blanket reachability objection. That opt-in production path reached the grouped provider and refused a dtype. The actual refused dtype remains unidentified, and the printed list includes Q4_0 and MXFP4, which this patch does not add. Please qualify the claimed fix with the exact dtype and consumer. #3019 and #2942 retain the separate admission work.

The gfx1100 WMMA requirement remains separate. This patch adds no RDNA3 WMMA tile; the inherited matrix path admits gfx1200/gfx1201. #2109 closed through #2991 on 6 September, and that landed spec explicitly leaves RDNA3 to separate work. No device or performance acceptance is claimed by this audit.

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.

feat(KERNEL-QUANT-CIQ-GEMM-ROCM): land the W1 keep-quant providers on kROCM

4 participants