From b33e1cb172609343166ee485bf97c0a6f11587cf Mon Sep 17 00:00:00 2001 From: Aarushi Jain <142941703+aarushjain29@users.noreply.github.com> Date: Wed, 30 Sep 2026 12:44:40 -0500 Subject: [PATCH] [ROCm]Transpose compressed-tensors MoE weights on device (#59253) Co-authored-by: Andreas Karatzas --- vllm/model_executor/layers/fused_moe/routed_experts.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/vllm/model_executor/layers/fused_moe/routed_experts.py b/vllm/model_executor/layers/fused_moe/routed_experts.py index 3de0aa8dab..de08d9aa54 100644 --- a/vllm/model_executor/layers/fused_moe/routed_experts.py +++ b/vllm/model_executor/layers/fused_moe/routed_experts.py @@ -691,7 +691,10 @@ class RoutedExperts(PluggableLayer): ) and is_transposed ): - loaded_weight = loaded_weight.t().contiguous() + # Transpose on the parameter's device: a CPU transpose of the + # mmap view reads the file column-wise, which is very slow on + # NFS. The contiguous .to() reads it sequentially. + loaded_weight = loaded_weight.to(param.device).t().contiguous() if shard_id not in ("w1", "w2", "w3"): raise ValueError(f"shard_id must be ['w1','w2','w3'] but got {shard_id}.")