[Perf] Kimi K3 nvfp4 Align in_proj weights by 128 to avoid elementwise copy (#55242)

Signed-off-by: wzhao18 <wzhao18.sz@gmail.com>
Co-authored-by: OpenAI Codex <codex@openai.com>
This commit is contained in:
Wei Zhao
2026-09-05 10:46:47 +08:00
committed by GitHub
co-authored by OpenAI Codex
parent 385ba6b5b0
commit 16328c7a77
6 changed files with 53 additions and 21 deletions
+6 -2
View File
@@ -650,7 +650,9 @@ def test_modelopt_linear_exposes_humming_layer_attrs(dist_init, monkeypatch):
from vllm.config.quantization import QuantSpec
from vllm.model_executor.layers.quantization import modelopt as mo
monkeypatch.setattr(mo, "select_linear_kernel", lambda spec, layer, rt: Mock())
monkeypatch.setattr(
mo, "select_linear_kernel", lambda spec, layer, rt, **kwargs: Mock()
)
monkeypatch.setattr(mo, "expose_input_quant_key", lambda layer, kernel: None)
def build(layer):
@@ -829,7 +831,8 @@ def test_modelopt_fp8_pb_wo_hides_output_padding(monkeypatch):
)
kernel = Mock()
monkeypatch.setattr(mo, "select_linear_kernel", lambda spec, layer, rt: kernel)
init_fp8_linear_kernel = Mock(return_value=kernel)
monkeypatch.setattr(mo, "init_fp8_linear_kernel", init_fp8_linear_kernel)
monkeypatch.setattr(mo, "expose_input_quant_key", lambda layer, k: None)
method = ModelOptLinearMethod.__new__(ModelOptLinearMethod)
@@ -860,6 +863,7 @@ def test_modelopt_fp8_pb_wo_hides_output_padding(monkeypatch):
# loaded at logical size; scale is cdiv(2624, 128) = 21 block rows
assert layer.weight.shape == (2624, 128)
assert layer.weight_scale.shape == (21, 1, 1, 1)
assert init_fp8_linear_kernel.call_args.kwargs["weight_shape"] == (2688, 128)
layer.weight.data.fill_(1)
method.process_weights_after_loading(layer)