Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion fla/ops/utils/backends/triton_ascend/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

from __future__ import annotations

import torch

from fla.ops.backends import BaseBackend


Expand All @@ -23,7 +25,16 @@ def is_available(cls) -> bool:
from fla.utils import IS_NPU
return IS_NPU

def solve_tril_verifier(self, *args, **kwargs):
def solve_tril_verifier(self, A: torch.Tensor, *args, **kwargs) -> tuple[bool, str | None]:
from fla.utils import IS_NPU
if not IS_NPU:
return False, "not running on NPU"
if A.device.type != 'npu':
return False, f"input device is not NPU, got {A.device.type}"
if A.dtype not in (torch.float16, torch.bfloat16, torch.float32):
return False, f"unsupported dtype for NPU solve_tril: {A.dtype}"
if A.shape[-1] not in (16, 32, 64):
return False, f"solve_tril requires BT in (16, 32, 64), got {A.shape[-1]}"
return True, None

def solve_tril(self, *args, **kwargs):
Expand Down
Loading
Loading