Fix static actorder handling for compressed-tensors WNA16 MoE (#41161)
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This commit is contained in:
co-authored by
mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
parent
6f6bd3b8fe
commit
ca5b24695b
@@ -10,6 +10,7 @@ from unittest.mock import Mock
|
||||
import pytest
|
||||
import torch
|
||||
from compressed_tensors.quantization import (
|
||||
ActivationOrdering,
|
||||
QuantizationArgs,
|
||||
QuantizationStrategy,
|
||||
QuantizationType,
|
||||
@@ -683,6 +684,35 @@ def test_compressed_tensors_mxfp8_moe_setup(vllm_runner):
|
||||
assert output
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"actorder,group_size,part,full,expected",
|
||||
[
|
||||
# actorder="group" with real grouping: must load full-K w2 scales and,
|
||||
# when sharded (part != full), report is_k_full=False.
|
||||
(ActivationOrdering.GROUP, 32, 64, 128, (True, 128, False)),
|
||||
# actorder="group" but unsharded (part == full): full scales, k_full.
|
||||
(ActivationOrdering.GROUP, 32, 128, 128, (True, 128, True)),
|
||||
# actorder="group" with channel-wise (group_size == -1): no full load.
|
||||
(ActivationOrdering.GROUP, -1, 64, 128, (False, 64, False)),
|
||||
# "static"/"weight" reorder at quant time -> shard normally + k_full.
|
||||
# Regression: static actorder under TP must keep is_k_full=True so the
|
||||
# Marlin kernel never gets the invalid (group_size=16, is_k_full=0).
|
||||
("static", 32, 64, 128, (False, 64, True)),
|
||||
("weight", 32, 64, 128, (False, 64, True)),
|
||||
(None, 32, 64, 128, (False, 64, True)),
|
||||
],
|
||||
)
|
||||
def test_wna16_marlin_moe_w2_scale_sharding(actorder, group_size, part, full, expected):
|
||||
from vllm.model_executor.layers.quantization.compressed_tensors.compressed_tensors_moe.compressed_tensors_moe_wna16_marlin import ( # noqa: E501
|
||||
CompressedTensorsWNA16MarlinMoEMethod,
|
||||
)
|
||||
|
||||
result = CompressedTensorsWNA16MarlinMoEMethod._w2_scale_sharding(
|
||||
actorder, group_size, part, full
|
||||
)
|
||||
assert result == expected
|
||||
|
||||
|
||||
@pytest.mark.skipif(
|
||||
not current_platform.is_cuda() or not current_platform.has_device_capability(80),
|
||||
reason="MXFP4 requires ampere or newer",
|
||||
|
||||
Reference in New Issue
Block a user