From f05f7c019d0731e08659741793fc8f49ef8eb2f1 Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Fri, 17 Oct 2025 17:07:02 -0700 Subject: [PATCH] Update utils.py --- unsloth/kernels/utils.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/unsloth/kernels/utils.py b/unsloth/kernels/utils.py index 90d3cb51a7..514516bd2d 100644 --- a/unsloth/kernels/utils.py +++ b/unsloth/kernels/utils.py @@ -28,6 +28,7 @@ from ..device_type import ( ALLOW_PREQUANTIZED_MODELS, ) from .fp8 import weight_dequant, fp8_linear +import functools # torch.cuda.amp.custom_fwd is deprecated >= 2.4 import torch @@ -71,10 +72,7 @@ else: pass -def is_hip(): - return triton.runtime.driver.active.get_current_target().backend == "hip" - - +@functools.lru_cache(1) def is_cdna(): return is_hip() and triton.runtime.driver.active.get_current_target().arch in ('gfx940', 'gfx941', 'gfx942')