[Bugfix] Skip Triton autotune inspection without Triton (#56676)
Signed-off-by: Kevin Luu <51931015+khluu@users.noreply.github.com>
This commit is contained in:
@@ -207,6 +207,26 @@ def test_triton_kernel_decorator_returns_launcher(
|
|||||||
launch(first, 1, 7, stale_constexpr=True)
|
launch(first, 1, 7, stale_constexpr=True)
|
||||||
|
|
||||||
|
|
||||||
|
def test_triton_kernel_decorator_without_triton(
|
||||||
|
monkeypatch: pytest.MonkeyPatch,
|
||||||
|
) -> None:
|
||||||
|
monkeypatch.setattr(jit_warmup_triton_helper, "HAS_TRITON", False)
|
||||||
|
monkeypatch.setattr(jit_warmup_triton_helper, "triton", object())
|
||||||
|
kernel = _FakeTritonKernel()
|
||||||
|
|
||||||
|
def warmup_inputs() -> dict[str, Any]:
|
||||||
|
return dict(first="warmup", second=1)
|
||||||
|
|
||||||
|
@triton_kernel_dispatcher_with_warmup(kernel=kernel, warmup_inputs=warmup_inputs)
|
||||||
|
def launch(first: str, second: int) -> LaunchSpec:
|
||||||
|
return (2,), dict(CONST=7)
|
||||||
|
|
||||||
|
launch("runtime", 2)
|
||||||
|
assert kernel.runtime_calls == [
|
||||||
|
((2,), (), {"first": "runtime", "second": 2, "CONST": 7})
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
def test_triton_kernel_decorator_exhausts_large_ranges_before_deduplication(
|
def test_triton_kernel_decorator_exhausts_large_ranges_before_deduplication(
|
||||||
monkeypatch: pytest.MonkeyPatch,
|
monkeypatch: pytest.MonkeyPatch,
|
||||||
) -> None:
|
) -> None:
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ from vllm.model_executor.warmup.jit_warmup import (
|
|||||||
get_function_source_node,
|
get_function_source_node,
|
||||||
)
|
)
|
||||||
from vllm.platforms import current_platform
|
from vllm.platforms import current_platform
|
||||||
from vllm.triton_utils import triton
|
from vllm.triton_utils import HAS_TRITON, triton
|
||||||
|
|
||||||
CompileKeyT = TypeVar("CompileKeyT")
|
CompileKeyT = TypeVar("CompileKeyT")
|
||||||
P = ParamSpec("P")
|
P = ParamSpec("P")
|
||||||
@@ -428,6 +428,8 @@ class _AutomaticTritonJitKernel(VllmTritonJitKernel[TritonCompileKey]):
|
|||||||
|
|
||||||
|
|
||||||
def _is_autotuned(kernel: Any) -> bool:
|
def _is_autotuned(kernel: Any) -> bool:
|
||||||
|
if not HAS_TRITON:
|
||||||
|
return False
|
||||||
Autotuner = triton.runtime.autotuner.Autotuner
|
Autotuner = triton.runtime.autotuner.Autotuner
|
||||||
|
|
||||||
while kernel is not None:
|
while kernel is not None:
|
||||||
|
|||||||
Reference in New Issue
Block a user