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
3 changes: 0 additions & 3 deletions requirements/cpu.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ torchvision; platform_machine != "ppc64le" and platform_machine != "s390x"
torchvision==0.22.0; platform_machine == "ppc64le"
datasets # for benchmark scripts

# cpu cannot use triton 3.3.0
triton==3.2.0; platform_machine == "x86_64"

# Intel Extension for PyTorch, only for x86_64 CPUs
intel-openmp==2024.2.1; platform_machine == "x86_64"
intel_extension_for_pytorch==2.7.0; platform_machine == "x86_64"
Expand Down
2 changes: 2 additions & 0 deletions vllm/triton_utils/importing.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,11 @@ class TritonPlaceholder(types.ModuleType):

def __init__(self):
super().__init__("triton")
self.__version__ = "3.3.0"
self.jit = self._dummy_decorator("jit")
self.autotune = self._dummy_decorator("autotune")
self.heuristics = self._dummy_decorator("heuristics")
self.Config = self._dummy_decorator("Config")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The current implementation of the dummy triton.Config using _dummy_decorator results in triton.Config(...) returning a lambda function (lambda f: f). While this prevents an AttributeError when triton.Config is called, it can lead to issues if the code attempts to access attributes on the instance returned by triton.Config(...) (e.g., my_config.num_warps).

For a more robust placeholder that better mimics the behavior of triton.Config (which is a class that creates config objects), consider returning an object that can hold attributes. types.SimpleNamespace is a good candidate for this.

This change would make the TritonPlaceholder more generally useful and less likely to cause unexpected errors when Triton is not installed.

Suggested change
self.Config = self._dummy_decorator("Config")
self.Config = lambda defines_arg=None, **kwargs: types.SimpleNamespace(defines=defines_arg if defines_arg is not None else {}, **kwargs)

self.language = TritonLanguagePlaceholder()
logger.warning_once(
"Triton is not installed. Using dummy decorators. "
Expand Down