mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-06 12:20:52 +01:00
Use has_triton_package in _inductor.runtime.hints (#147442)
Fixes #ISSUE_NUMBER Use existing method for triton check Pull Request resolved: https://github.com/pytorch/pytorch/pull/147442 Approved by: https://github.com/Skylion007
This commit is contained in:
parent
533b884870
commit
86ae672b6a
|
|
@ -7,6 +7,8 @@ import typing
|
||||||
from enum import auto, Enum
|
from enum import auto, Enum
|
||||||
from typing import Optional, Union
|
from typing import Optional, Union
|
||||||
|
|
||||||
|
from torch.utils._triton import has_triton_package
|
||||||
|
|
||||||
|
|
||||||
# The following maximums only apply to runtime autotuning, when using FixedTritonConfig one may see larger values
|
# The following maximums only apply to runtime autotuning, when using FixedTritonConfig one may see larger values
|
||||||
# NOTE: if these fail asserts submit a PR to increase them
|
# NOTE: if these fail asserts submit a PR to increase them
|
||||||
|
|
@ -32,17 +34,9 @@ class TileHint(Enum):
|
||||||
DEFAULT = 1
|
DEFAULT = 1
|
||||||
|
|
||||||
|
|
||||||
def _is_triton_available() -> bool:
|
|
||||||
try:
|
|
||||||
import triton # noqa: F401
|
|
||||||
|
|
||||||
return True
|
|
||||||
except ImportError:
|
|
||||||
return False
|
|
||||||
|
|
||||||
|
|
||||||
# Define `AttrsDescriptorWrapper` function with clear conditional handling
|
# Define `AttrsDescriptorWrapper` function with clear conditional handling
|
||||||
if _is_triton_available():
|
if has_triton_package():
|
||||||
|
import triton
|
||||||
import triton.backends.compiler
|
import triton.backends.compiler
|
||||||
import triton.compiler.compiler
|
import triton.compiler.compiler
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user