Skip to content

Commit 0904c2e

Browse files
committed
Guard triton.set_allocator with hasattr for non-NVIDIA backends
1 parent f736935 commit 0904c2e

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

‎src/flag_blas/runtime/backend/_iluvatar/__init__.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from flag_gems.runtime.backend.backend_utils import VendorInfoBase
1+
from flag_blas.runtime.backend.backend_utils import VendorInfoBase
22

33
vendor_info = VendorInfoBase(
44
vendor_name="iluvatar", device_name="cuda", device_query_cmd="ixsmi"

‎src/flag_blas/runtime/backend/_nvidia/__init__.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ def _alloc_fn(size, alignment, stream):
1313
return torch.empty(size, device="cuda", dtype=torch.int8)
1414

1515

16-
triton.set_allocator(_alloc_fn)
16+
if hasattr(triton, "set_allocator"):
17+
triton.set_allocator(_alloc_fn)
1718

1819

1920
__all__ = ["*"]

0 commit comments

Comments
 (0)