From cfa607080f5735e383f3e9331a85652cde2f680a Mon Sep 17 00:00:00 2001 From: Mashiro <57566630+HAOCHENYE@users.noreply.github.com> Date: Fri, 1 Sep 2023 18:12:58 +0800 Subject: [PATCH] [Fix] Fix compile error (#4357) --- op_builder/utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/op_builder/utils.py b/op_builder/utils.py index cb528eea6..9412c725b 100644 --- a/op_builder/utils.py +++ b/op_builder/utils.py @@ -197,11 +197,12 @@ def get_cuda_cc_flag() -> List[str]: import torch cc_flag = [] + max_arch = ''.join(str(i) for i in torch.cuda.get_device_capability()) for arch in torch.cuda.get_arch_list(): res = re.search(r'sm_(\d+)', arch) if res: arch_cap = res[1] - if int(arch_cap) >= 60: + if int(arch_cap) >= 60 and int(arch_cap) <= int(max_arch): cc_flag.extend(['-gencode', f'arch=compute_{arch_cap},code={arch}']) return cc_flag