Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion benchmarks/kernels/benchmark_moe.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

from vllm.model_executor.layers.fused_moe.fused_moe import *
from vllm.platforms import current_platform
from vllm.transformers_utils.config import get_config
from vllm.triton_utils import triton
from vllm.utils import FlexibleArgumentParser

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@
# Import vLLM functions
from vllm import _custom_ops as ops
from vllm.model_executor.layers.quantization.utils.fp8_utils import (
per_token_group_quant_fp8,
w8a8_block_fp8_matmul,
)
per_token_group_quant_fp8, w8a8_block_fp8_matmul)
from vllm.triton_utils import triton


Expand Down
60 changes: 31 additions & 29 deletions vllm/triton_utils/importing.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,32 +16,34 @@
logger.info("Triton not installed or not compatible; certain GPU-related"
" functions will not be available.")

class TritonPlaceholder(types.ModuleType):

def __init__(self):
super().__init__("triton")
self.jit = self._dummy_decorator("jit")
self.autotune = self._dummy_decorator("autotune")
self.heuristics = self._dummy_decorator("heuristics")
self.language = TritonLanguagePlaceholder()
logger.warning_once(
"Triton is not installed. Using dummy decorators. "
"Install it via `pip install triton` to enable kernel"
"compilation.")

def _dummy_decorator(self, name):

def decorator(func=None, **kwargs):
if func is None:
return lambda f: f
return func

return decorator

class TritonLanguagePlaceholder(types.ModuleType):

def __init__(self):
super().__init__("triton.language")
self.constexpr = None
self.dtype = None
self.int64 = None

class TritonPlaceholder(types.ModuleType):

def __init__(self):
super().__init__("triton")
self.jit = self._dummy_decorator("jit")
self.autotune = self._dummy_decorator("autotune")
self.heuristics = self._dummy_decorator("heuristics")
self.language = TritonLanguagePlaceholder()
logger.warning_once(
"Triton is not installed. Using dummy decorators. "
"Install it via `pip install triton` to enable kernel"
" compilation.")

def _dummy_decorator(self, name):

def decorator(*args, **kwargs):
if args and callable(args[0]):
return args[0]
return lambda f: f

return decorator


class TritonLanguagePlaceholder(types.ModuleType):

def __init__(self):
super().__init__("triton.language")
self.constexpr = None
self.dtype = None
self.int64 = None
Loading