From 79e09021b20862160cbfae76a6dc13456902dece Mon Sep 17 00:00:00 2001 From: Nick Riasanovsky Date: Thu, 27 Feb 2025 19:55:32 -0500 Subject: [PATCH] Apply final nits --- third_party/amd/backend/compiler.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/third_party/amd/backend/compiler.py b/third_party/amd/backend/compiler.py index 5033214cee26..c98eaef03397 100644 --- a/third_party/amd/backend/compiler.py +++ b/third_party/amd/backend/compiler.py @@ -10,7 +10,6 @@ import subprocess import functools from pathlib import Path -import torch def min_dot_size(target: GPUTarget): @@ -141,6 +140,8 @@ def use_buffer_ops(): @staticmethod def is_within_2gb(arg): + import torch + MAX_INT_32 = 2**31 - 1 if hasattr(arg, "ptr_range"): return arg.ptr_range() <= MAX_INT_32 @@ -160,7 +161,7 @@ def get_arg_specialization(arg, ty, **kwargs): ret = BaseBackend.get_arg_specialization(arg, ty, **kwargs) # Only attempt to do buffer ops specialization if buffer ops are enabled. # Otherwise the is_within_2gb check is unnecessary overhead. - if (HIPBackend.use_buffer_ops() and ty == "tensor" and HIPBackend.is_within_2gb(arg)): + if HIPBackend.use_buffer_ops() and ty == "tensor" and HIPBackend.is_within_2gb(arg): ret += "S" return ret