[Refactor] Remove utils dead code (#53941)

Signed-off-by: yewentao256 <zhyanwentao@126.com>
This commit is contained in:
Wentao Ye
2026-09-08 11:22:09 -04:00
committed by GitHub
parent 7c2f1ff495
commit 6b15bea080
15 changed files with 4 additions and 278 deletions
-38
View File
@@ -995,44 +995,6 @@ if has_flashinfer():
return torch.empty(A.shape[0], B.shape[1], dtype=out_dtype, device=A.device)
def flashinfer_mm_mxfp8(
a: torch.Tensor,
b: torch.Tensor,
block_scale_a: torch.Tensor,
block_scale_b: torch.Tensor,
out_dtype: torch.dtype,
backend: str = "cutlass",
) -> torch.Tensor:
"""MXFP8 MM helper - mirrors flashinfer_scaled_fp4_mm API.
Takes non-transposed weights and handles transpose internally.
CRITICAL: mm_mxfp8 CUTLASS kernel requires SWIZZLED 1D scales for optimal
performance and accuracy. Both input and weight scales should be in
swizzled format from FlashInfer's mxfp8_quantize(is_sf_swizzled_layout=True).
"""
# a shape [M, K]
# b shape [K, N]
assert a.ndim == 2 and b.ndim == 2
assert a.shape[1] == b.shape[1] # K dimension must match
if block_scale_b.ndim != 1:
raise ValueError(
"mm_mxfp8 expects 1D swizzled weight scales for CUTLASS; "
f"got shape={tuple(block_scale_b.shape)}"
)
# Output tensor [M, N]
return mm_mxfp8(
a,
b.t(), # Transpose weight: [N, K] -> [K, N]
block_scale_a,
block_scale_b,
out_dtype,
backend=backend,
)
def flashinfer_scaled_fp4_mm(
a: torch.Tensor,
b: torch.Tensor,
-41
View File
@@ -76,27 +76,6 @@ def fuse_moe_impl(
)
# @torch.library.register_fake(
# "vllm::fuse_moe_impl",
# )
def fuse_moe_impl_fake(
x: torch.Tensor,
gate_up_weight: torch.Tensor,
down_weight: torch.Tensor,
gate_up_scale: torch.Tensor,
down_scale: torch.Tensor,
act_and_mul_scale: torch.Tensor,
topk_ids: torch.Tensor,
topk_scale: torch.Tensor,
rank_ep: int,
num_expert_total: int,
use_bf16_mul: bool = True,
shared_output: torch.Tensor = None,
output: torch.Tensor = None,
) -> torch.Tensor:
return torch.empty_like(x)
def hpc_fuse_moe(
x: torch.Tensor,
gate_up_weight: torch.Tensor,
@@ -166,26 +145,6 @@ def fuse_moe_blockwise_impl(
)
# @torch.library.register_fake(
# "vllm::fuse_moe_blockwise_impl",
# )
def fuse_moe_blockwise_impl_fake(
x: torch.Tensor,
x_scale: torch.Tensor,
gate_up_weight: torch.Tensor,
gate_up_weight_scale: torch.Tensor,
down_weight: torch.Tensor,
down_weight_scale: torch.Tensor,
topk_ids: torch.Tensor,
topk_scale: torch.Tensor,
rank_ep: int,
num_expert_total: int,
shared_output: torch.Tensor = None,
output: torch.Tensor = None,
) -> torch.Tensor:
return torch.empty_like(x)
def hpc_fuse_moe_blockwise(
x: torch.Tensor,
x_scale: torch.Tensor,
-5
View File
@@ -43,11 +43,6 @@ def get_max_shared_memory_bytes(gpu: int = 0) -> int:
return int(max_shared_mem)
def get_cpu_memory() -> int:
"""Returns the total CPU memory of the node in bytes."""
return psutil.virtual_memory().total
_UMA_PRESSURE_THRESHOLD = 0.8
_UMA_MIN_RELEASE_BYTES = 512 * MiB_bytes
-9
View File
@@ -497,15 +497,6 @@ def get_kv_cache_quant_algo_string(quant_cfg: dict[str, Any]) -> str | None:
return None
def get_kv_cache_quant_algo_dtype(quant_cfg: dict[str, Any]) -> torch.dtype | None:
"""Get the KV cache quantization algorithm dtype from the quantization config."""
kv_algo_str = get_kv_cache_quant_algo_string(quant_cfg)
if kv_algo_str is not None and kv_algo_str != "auto":
# Only convert if we have a valid dtype string (not "auto" fallback)
return STR_DTYPE_TO_TORCH_DTYPE[kv_algo_str]
return None
def resolve_kv_cache_dtype_string(
kv_cache_dtype: str, model_config: ModelConfig
) -> str: