Skip to content

Commit

Permalink
support noaligned silu_and_mul (#2506)
Browse files Browse the repository at this point in the history
* support noaligned silu_and_mul

* remove dist utils

* fix pow2

* minicpm3 cudagraph

* update ut
  • Loading branch information
grimoire authored Sep 25, 2024
1 parent f012c86 commit 4bcfc18
Show file tree
Hide file tree
Showing 7 changed files with 78 additions and 366 deletions.
11 changes: 0 additions & 11 deletions lmdeploy/pytorch/backends/cuda/activation.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
from torch import nn

from lmdeploy.pytorch.kernels.cuda.activation import silu_and_mul

from ..activation import SiluAndMulBuilder, SiluAndMulImpl
Expand All @@ -12,17 +10,8 @@ class TritonSiluAndMulImpl(SiluAndMulImpl):
def __init__(self, inplace: bool):
self.inplace = inplace

def _forward_naive(self, x):
"""forward naive."""
gate, up = x.chunk(2, -1)
return nn.functional.silu(gate, self.inplace) * up

def forward(self, x):
"""forward."""

if x.size(-1) % 2048 != 0:
return self._forward_naive(x)

out = None
x_shape = None
if x.dim() != 2:
Expand Down
308 changes: 0 additions & 308 deletions lmdeploy/pytorch/dist_utils.py

This file was deleted.

Loading

0 comments on commit 4bcfc18

Please sign in to comment.