pytorch/torch/utils/_helion.py
Oguz Ulgen 0e2013a12d Add helion x pt2 test (#155513)
This kinda just worked out of the box, shocking. PT2 traced into helion and emitted it as a user defined triton kernel: P1836496774

In the long run, we do not actually want this, but rather to create a helion HOP so we can do fusions etc.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/155513
Approved by: https://github.com/zou3519, https://github.com/jansel
2025-06-11 07:08:06 +00:00

18 lines
384 B
Python

import functools
from torch.utils._triton import has_triton
@functools.lru_cache(None)
def has_helion_package() -> bool:
try:
import helion # type: ignore[import-untyped, import-not-found] # noqa: F401
except ImportError:
return False
return True
@functools.lru_cache(None)
def has_helion() -> bool:
return has_helion_package() and has_triton()