forked from vllm-project/vllm
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Bugfix] Allow vllm to still work if triton is not installed. (vllm-p…
…roject#6786) Signed-off-by: Thomas Parnell <[email protected]>
- Loading branch information
Showing
13 changed files
with
65 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,22 @@ | ||
from vllm.model_executor.layers.fused_moe.fused_moe import ( | ||
fused_experts, fused_moe, fused_topk, get_config_file_name, grouped_topk) | ||
from vllm.model_executor.layers.fused_moe.layer import (FusedMoE, | ||
FusedMoEMethodBase) | ||
from vllm.triton_utils import HAS_TRITON | ||
|
||
__all__ = [ | ||
"fused_moe", | ||
"fused_topk", | ||
"fused_experts", | ||
"get_config_file_name", | ||
"grouped_topk", | ||
"FusedMoE", | ||
"FusedMoEMethodBase", | ||
] | ||
|
||
if HAS_TRITON: | ||
|
||
from vllm.model_executor.layers.fused_moe.fused_moe import ( | ||
fused_experts, fused_moe, fused_topk, get_config_file_name, | ||
grouped_topk) | ||
|
||
__all__ += [ | ||
"fused_moe", | ||
"fused_topk", | ||
"fused_experts", | ||
"get_config_file_name", | ||
"grouped_topk", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,10 @@ | ||
from vllm.triton_utils.custom_cache_manager import ( | ||
maybe_set_triton_cache_manager) | ||
from vllm.triton_utils.importing import HAS_TRITON | ||
|
||
__all__ = [ | ||
"maybe_set_triton_cache_manager", | ||
] | ||
__all__ = ["HAS_TRITON"] | ||
|
||
if HAS_TRITON: | ||
|
||
from vllm.triton_utils.custom_cache_manager import ( | ||
maybe_set_triton_cache_manager) | ||
|
||
__all__ += ["maybe_set_triton_cache_manager"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from importlib.util import find_spec | ||
|
||
from vllm.logger import init_logger | ||
|
||
logger = init_logger(__name__) | ||
|
||
HAS_TRITON = find_spec("triton") is not None | ||
|
||
if not HAS_TRITON: | ||
logger.info("Triton not installed; certain GPU-related functions" | ||
" will be not be available.") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import math | ||
|
||
# This is a hardcoded limit in Triton (max block size). | ||
MAX_TRITON_N_COLS = 131072 | ||
|
||
|
||
def get_num_triton_sampler_splits(n_cols: int) -> int: | ||
"""Get the number of splits to use for Triton sampling. | ||
Triton has a limit on the number of columns it can handle, so we need to | ||
split the tensor and call the kernel multiple times if it's too large. | ||
""" | ||
return math.ceil(n_cols / MAX_TRITON_N_COLS) |