[model][refactor] remove cuda hard code in models and layers (#13658)

This commit is contained in:
Mengqing Cao
2025-02-24 06:10:14 -08:00
committed by GitHub
parent 437b76ff59
commit 23eca9cf68
7 changed files with 29 additions and 14 deletions
@@ -7,6 +7,7 @@ import torch
from vllm.model_executor.layers.fused_moe.fused_moe import (
fused_topk, moe_align_block_size, try_get_optimal_moe_config)
from vllm.platforms import current_platform
from vllm.scalar_type import scalar_types
from vllm.utils import direct_register_custom_op
@@ -238,7 +239,7 @@ def fused_marlin_moe(
max_workspace_size = (max(2 * N, K) // 64) * 16
workspace = torch.zeros(max_workspace_size,
dtype=torch.int,
device="cuda",
device=current_platform.device_type,
requires_grad=False)
if has_no_zp: