[Refactor] Remove multiple dead code (#47329)
Signed-off-by: yewentao256 <zhyanwentao@126.com>
Wentao Ye committed
Jul 6, 2026 at 10:54 UTC
b1c6dba558a5fec95fa1586b0b824755a367a93c
7 files changed
-186
CMakeLists.txt
-1
@@ -400,7 +400,6 @@ if(VLLM_GPU_LANG STREQUAL "CUDA" OR VLLM_GPU_LANG STREQUAL "HIP")
400
"csrc/libtorch_stable/topk.cu"
401
"csrc/libtorch_stable/mamba/selective_scan_fwd.cu"
402
"csrc/libtorch_stable/cache_kernels.cu"
403
- "csrc/libtorch_stable/cache_kernels.cu"
403
"csrc/libtorch_stable/cache_kernels_fused.cu"
404
"csrc/libtorch_stable/custom_all_reduce.cu"
405
"csrc/libtorch_stable/fused_deepseek_v4_qnorm_rope_kv_insert_kernel.cu")
vllm/kernels/helion/config_manager.py
-19
@@ -162,13 +162,6 @@ class ConfigSet:
162
config_key,
163
)
164
165
- def has_config(self, platform: str, config_key: CaseKey) -> bool:
166
- platform = platform.lower()
167
- platform_dict = self._configs.get(platform)
168
- if platform_dict is None:
169
- return False
170
- return config_key in platform_dict
171
-
165
166
class ConfigManager:
167
"""File-level configuration management for Helion kernels (global singleton)."""
@@ -327,15 +320,3 @@ class ConfigManager:
320
321
logger.info("Saved config to: %s", platform_path)
322
return platform_path
330
-
331
- def config_exists(
332
- self,
333
- kernel_name: str,
334
- platform: str,
335
- config_key: CaseKey,
336
- ) -> bool:
337
- platform_data = self._load_platform_file(kernel_name, platform)
338
- if not platform_data:
339
- return False
340
- target = dict(config_key)
341
- return any(entry["key"] == target for entry in platform_data)
vllm/model_executor/layers/fla/ops/layernorm_guard.py
-40
@@ -331,46 +331,6 @@ def rmsnorm_fn(
331
)
332
333
334
-class LayerNormGated(nn.Module):
335
- def __init__(
336
- self,
337
- hidden_size,
338
- eps: float = 1e-5,
339
- group_size: int | None = None,
340
- norm_before_gate: bool = True,
341
- device: torch.device | None = None,
342
- dtype: torch.dtype | None = None,
343
- ):
344
- """If group_size is not None, we do GroupNorm with each group having group_size elements.
345
- group_size=None is equivalent to group_size=hidden_size (i.e. there's only 1 group).
346
- """
347
-
348
- factory_kwargs = {"device": device, "dtype": dtype}
349
- super().__init__()
350
- self.eps = eps
351
- self.weight = nn.Parameter(torch.empty(hidden_size, **factory_kwargs))
352
- self.bias = nn.Parameter(torch.empty(hidden_size, **factory_kwargs))
353
- self.group_size = group_size
354
- self.norm_before_gate = norm_before_gate
355
- self.reset_parameters()
356
-
357
- def reset_parameters(self):
358
- torch.nn.init.ones_(self.weight)
359
- torch.nn.init.zeros_(self.bias)
360
-
361
- def forward(self, x, z=None):
362
- """If z is not None, we do norm(x) * silu(z) if norm_before_gate, else norm(x * silu(z))"""
363
- return layernorm_fn(
364
- x,
365
- self.weight,
366
- self.bias,
367
- z=z,
368
- group_size=self.group_size,
369
- eps=self.eps,
370
- norm_before_gate=self.norm_before_gate,
371
- )
372
-
373
-
334
class RMSNormGated(nn.Module):
335
def __init__(
336
self,
vllm/model_executor/layers/quantization/utils/flashinfer_utils.py
-17
@@ -1,6 +1,5 @@
1
# SPDX-License-Identifier: Apache-2.0
2
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
3
-from enum import Enum
3
from typing import TYPE_CHECKING
4
5
import torch
@@ -15,12 +14,6 @@ if TYPE_CHECKING:
14
logger = init_logger(__name__)
15
16
18
-class FlashinferMoeBackend(Enum):
19
- TENSORRT_LLM = "TensorRT-LLM"
20
- CUTLASS = "CUTLASS"
21
- CUTEDSL = "CUTEDSL"
22
-
23
-
17
def activation_to_flashinfer_int(activation: MoEActivation) -> int:
18
return activation_to_flashinfer_type(activation).value
19
@@ -97,16 +90,6 @@ def rotate_weights_for_fi_trtllm_fp8_per_tensor_moe(
90
)
91
92
100
-def is_flashinfer_supporting_global_sf(backend: FlashinferMoeBackend | None) -> bool:
101
- # TODO(shuw@nvidia): Update when new backends are added.
102
- backends_supporting_global_sf = (
103
- FlashinferMoeBackend.CUTLASS,
104
- FlashinferMoeBackend.TENSORRT_LLM,
105
- FlashinferMoeBackend.CUTEDSL,
106
- )
107
- return backend in backends_supporting_global_sf
108
-
109
-
93
def convert_moe_weights_to_flashinfer_trtllm_block_layout(
94
cache_permute_indices: dict[torch.Size, torch.Tensor],
95
w13_weight: torch.Tensor,
vllm/model_executor/layers/quantization/utils/int8_utils.py
-37
@@ -16,43 +16,6 @@ from vllm.triton_utils import tl, triton
16
logger = logging.getLogger(__name__)
17
18
19
-def apply_w8a8_block_int8_linear(
20
- input: torch.Tensor,
21
- weight: torch.Tensor,
22
- block_size: list[int],
23
- weight_scale: torch.Tensor,
24
- input_scale: torch.Tensor | None = None,
25
- bias: torch.Tensor | None = None,
26
-) -> torch.Tensor:
27
- assert input_scale is None
28
- # View input as 2D matrix for fp8 methods
29
- input_2d = input.view(-1, input.shape[-1])
30
- output_shape = [*input.shape[:-1], weight.shape[0]]
31
-
32
- q_input, x_scale = per_token_group_quant_int8(input_2d, block_size[1])
33
- output = w8a8_block_int8_matmul(
34
- q_input, weight, x_scale, weight_scale, block_size, output_dtype=input.dtype
35
- )
36
-
37
- if bias is not None:
38
- output = output + bias
39
- return output.to(dtype=input.dtype).view(*output_shape)
40
-
41
-
42
-def input_to_int8(
43
- x: torch.Tensor, dtype: torch.dtype = torch.int8
44
-) -> tuple[torch.Tensor, torch.Tensor]:
45
- """This function quantizes input values to int8 values with
46
- tensor-wise quantization."""
47
- iinfo = torch.iinfo(dtype)
48
- min_val, max_val = x.aminmax()
49
- amax = torch.maximum(min_val.abs(), max_val.abs()).clamp(min=1e-12)
50
- int8_min, int8_max = iinfo.min, iinfo.max
51
- scale = int8_max / amax
52
- x_scl_sat = (x * scale).clamp(min=int8_min, max=int8_max)
53
- return x_scl_sat.to(dtype).contiguous(), scale.float().reciprocal()
54
-
55
-
19
def block_dequant(
20
x_q_block: torch.Tensor,
21
x_s: torch.Tensor,
vllm/model_executor/layers/quantization/utils/machete_utils.py
-4
@@ -16,10 +16,6 @@ def query_machete_supported_quant_types(zero_points: bool) -> list[ScalarType]:
16
return [scalar_types.uint4b8, scalar_types.uint8b128]
17
18
19
-def query_machete_supported_act_types(zero_points: bool) -> list[ScalarType]:
20
- return [torch.float16, torch.bfloat16]
21
-
22
-
19
def query_machete_supported_group_sizes(act_type: torch.dtype) -> list[int]:
20
"""
21
Queries the supported group sizes for Machete based on the activation type.
vllm/model_executor/layers/quantization/utils/marlin_utils.py
-68
@@ -738,71 +738,3 @@ def apply_gptq_marlin_linear(
738
739
output = marlin_unpad_output(output, output_size_per_partition, padded_n)
740
return output.reshape(out_shape)
741
-
742
-
743
-def apply_awq_marlin_linear(
744
- input: torch.Tensor,
745
- weight: torch.Tensor,
746
- weight_scale: torch.Tensor,
747
- weight_zp: torch.Tensor,
748
- g_idx: torch.Tensor,
749
- g_idx_sort_indices: torch.Tensor,
750
- workspace: torch.Tensor,
751
- quant_type: ScalarType,
752
- output_size_per_partition: int,
753
- input_size_per_partition: int,
754
- input_global_scale: torch.Tensor | None = None,
755
- bias: torch.Tensor | None = None,
756
- use_fp32_reduce: bool = USE_FP32_REDUCE_DEFAULT,
757
- input_dtype: torch.dtype | None = None,
758
-) -> torch.Tensor:
759
- reshaped_x = input.reshape(-1, input.shape[-1])
760
- out_shape = input.shape[:-1] + (output_size_per_partition,)
761
-
762
- padded_n, padded_k = marlin_repacked_nk(weight, quant_type.size_bits)
763
- reshaped_x = marlin_pad_dim(reshaped_x, input_size_per_partition, padded_k)
764
-
765
- use_atomic_add = should_use_atomic_add_reduce(
766
- m=reshaped_x.size(0),
767
- n=padded_n,
768
- k=padded_k,
769
- device=input.device,
770
- dtype=input.dtype,
771
- )
772
-
773
- a_scales = None
774
- if input_dtype == torch.int8:
775
- assert quant_type == scalar_types.uint4, (
776
- "W8A8-INT8 is not supported by marlin kernel."
777
- )
778
- reshaped_x, a_scales = marlin_quant_input(reshaped_x, input_dtype)
779
- a_scales = a_scales * input_global_scale
780
- elif input_dtype == torch.float8_e4m3fn:
781
- assert quant_type == scalar_types.uint4, (
782
- "INT8 weight + FP8 activation is not supported."
783
- )
784
- reshaped_x, a_scales = marlin_quant_input(reshaped_x, input_dtype)
785
-
786
- output = ops.marlin_gemm(
787
- reshaped_x,
788
- None,
789
- weight,
790
- bias,
791
- weight_scale,
792
- a_scales,
793
- None,
794
- weight_zp,
795
- g_idx,
796
- g_idx_sort_indices,
797
- workspace,
798
- quant_type,
799
- size_m=reshaped_x.shape[0],
800
- size_n=padded_n,
801
- size_k=padded_k,
802
- use_atomic_add=use_atomic_add,
803
- use_fp32_reduce=use_fp32_reduce,
804
- is_zp_float=False,
805
- )
806
-
807
- output = marlin_unpad_output(output, output_size_per_partition, padded_n)
808
- return output.reshape(out_shape)