From c429919def0e3e187dd5dcead483c50f14e3d596 Mon Sep 17 00:00:00 2001 From: Wenxuan Tan Date: Sun, 1 Jun 2025 17:28:31 -0500 Subject: [PATCH] misc: cache is_hopper_arch (#6799) --- sgl-kernel/python/sgl_kernel/utils.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sgl-kernel/python/sgl_kernel/utils.py b/sgl-kernel/python/sgl_kernel/utils.py index 63f146241..2960d3419 100644 --- a/sgl-kernel/python/sgl_kernel/utils.py +++ b/sgl-kernel/python/sgl_kernel/utils.py @@ -13,6 +13,7 @@ # limitations under the License. # ============================================================================== +import functools from typing import Dict, Tuple import torch @@ -41,6 +42,7 @@ def _to_tensor_scalar_tuple(x): return (None, x) +@functools.lru_cache(maxsize=1) def is_hopper_arch() -> bool: # Hopper arch's compute capability == 9.0 device = torch.cuda.current_device()