Unverified Commit 92f0db57 authored by Roger Wang's avatar Roger Wang Committed by GitHub
Browse files

[Misc] Always use `forward_mulmat` for `Conv3d` on newer versions of torch. (#38487)

parent bea23536
...@@ -10,7 +10,7 @@ import torch.nn as nn ...@@ -10,7 +10,7 @@ import torch.nn as nn
import torch.nn.functional as F import torch.nn.functional as F
from vllm.model_executor.custom_op import CustomOp from vllm.model_executor.custom_op import CustomOp
from vllm.utils.torch_utils import is_torch_equal from vllm.utils.torch_utils import is_torch_equal_or_newer
class ConvLayerBase(CustomOp): class ConvLayerBase(CustomOp):
...@@ -252,11 +252,12 @@ class Conv3dLayer(ConvLayerBase): ...@@ -252,11 +252,12 @@ class Conv3dLayer(ConvLayerBase):
return self._forward_conv(x) return self._forward_conv(x)
def forward_cuda(self, x: torch.Tensor) -> torch.Tensor: def forward_cuda(self, x: torch.Tensor) -> torch.Tensor:
# PyTorch2.9.0 disabled CUDNN's Conv3D, which caused a # PyTorch 2.9.0+ disabled CUDNN's Conv3D, which caused a
# significant performance regression. # significant performance regression.
# See: https://github.com/vllm-project/vllm/issues/27406 # See: https://github.com/vllm-project/vllm/issues/27406
# and https://github.com/pytorch/pytorch/issues/166122 # and https://github.com/pytorch/pytorch/issues/166122
# and https://github.com/huggingface/transformers/pull/45041
# By default, we use CUDNN's convolution ops with optimization. # By default, we use CUDNN's convolution ops with optimization.
if self.enable_linear and (is_torch_equal("2.9.0") or is_torch_equal("2.9.1")): if self.enable_linear and is_torch_equal_or_newer("2.9.0"):
return self._forward_mulmat(x) return self._forward_mulmat(x)
return self._forward_conv(x) return self._forward_conv(x)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment