[Kernel] Register punica ops directly (#10522)
Signed-off-by: Jee Jee Li <pandaleefree@gmail.com>
This commit is contained in:
@@ -9,6 +9,8 @@ import torch
|
||||
import triton
|
||||
import triton.language as tl
|
||||
|
||||
from vllm.utils import direct_register_custom_op
|
||||
|
||||
|
||||
@triton.jit
|
||||
def _sgmv_expand_slice_kernel(
|
||||
@@ -209,9 +211,31 @@ def _sgmv_expand_slice(
|
||||
return
|
||||
|
||||
|
||||
def sgmv_expand_slice_fake(
|
||||
inputs: torch.Tensor,
|
||||
lora_b_weights: torch.Tensor,
|
||||
output_tensor: torch.Tensor,
|
||||
b_seq_start_loc: torch.Tensor,
|
||||
seq_len_tensor: torch.Tensor,
|
||||
lora_indices_tensor: torch.Tensor,
|
||||
batches: int,
|
||||
max_seq_length: int,
|
||||
token_nums: int,
|
||||
slice_offset: int,
|
||||
slice_size: int,
|
||||
add_inputs: bool = False,
|
||||
) -> None:
|
||||
return
|
||||
|
||||
|
||||
try:
|
||||
sgmv_expand_slice = torch.library.custom_op("lora::sgmv_expand_slice",
|
||||
_sgmv_expand_slice,
|
||||
mutates_args=["output_tensor"])
|
||||
direct_register_custom_op(
|
||||
op_name="sgmv_expand_slice",
|
||||
op_func=_sgmv_expand_slice,
|
||||
mutates_args=["output_tensor"],
|
||||
fake_impl=sgmv_expand_slice_fake,
|
||||
)
|
||||
sgmv_expand_slice = torch.ops.vllm.sgmv_expand_slice
|
||||
|
||||
except AttributeError:
|
||||
sgmv_expand_slice = _sgmv_expand_slice
|
||||
|
||||
Reference in New Issue
Block a user