[ROCm][ViT] Detect Triton-AMD kernels at their new aiter location (#40289)
Signed-off-by: Adrian Kurt <info@zzit.ch> Signed-off-by: Adrian <info@zipfuzapfu.ch> Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
+15
-3
@@ -413,9 +413,21 @@ def flash_attn_triton_available() -> bool:
|
|||||||
try:
|
try:
|
||||||
from importlib.util import find_spec
|
from importlib.util import find_spec
|
||||||
|
|
||||||
if find_spec("flash_attn") is None:
|
# Locate the Triton-AMD kernels. Older ROCm/flash-attention (pre
|
||||||
return False
|
# 2026-03) shipped them as the flash_attn.flash_attn_triton_amd
|
||||||
if find_spec("flash_attn.flash_attn_triton_amd") is None:
|
# subpackage. The main_perf migration commit 3f94643 moved them
|
||||||
|
# into aiter at aiter.ops.triton._triton_kernels.flash_attn_triton_amd,
|
||||||
|
# so accept either location.
|
||||||
|
def _has_spec(name: str) -> bool:
|
||||||
|
try:
|
||||||
|
return find_spec(name) is not None
|
||||||
|
except (ImportError, ValueError):
|
||||||
|
return False
|
||||||
|
|
||||||
|
if not (
|
||||||
|
_has_spec("flash_attn.flash_attn_triton_amd")
|
||||||
|
or _has_spec("aiter.ops.triton._triton_kernels.flash_attn_triton_amd")
|
||||||
|
):
|
||||||
return False
|
return False
|
||||||
if os.environ.get("FLASH_ATTENTION_TRITON_AMD_ENABLE") != "TRUE":
|
if os.environ.get("FLASH_ATTENTION_TRITON_AMD_ENABLE") != "TRUE":
|
||||||
logger.info_once(
|
logger.info_once(
|
||||||
|
|||||||
Reference in New Issue
Block a user