From 346e2cf549cbd030cadc2d735bb4053da25f751d Mon Sep 17 00:00:00 2001 From: qiuyi Date: Mon, 5 Jan 2026 15:31:27 +0800 Subject: support 'a' and 'f' suffix for arch > sm_90/compute_90 --- xmake/rules/cuda/gencodes/xmake.lua | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/xmake/rules/cuda/gencodes/xmake.lua b/xmake/rules/cuda/gencodes/xmake.lua index 0da3deb56..51b03468f 100644 --- a/xmake/rules/cuda/gencodes/xmake.lua +++ b/xmake/rules/cuda/gencodes/xmake.lua @@ -75,10 +75,21 @@ rule("cuda.gencodes") if not value:startswith(prefix) then return nil end - local arch = tonumber(value:sub(#prefix + 1)) or tonumber(value:sub(#prefix + 2)) + local arch_str = value:sub(#prefix + 1) + if arch_str:startswith("_") then + arch_str = arch_str:sub(2) + end + local arch_ver, suffix = arch_str:match("^(%d+)([af]?)$") + local arch = tonumber(arch_ver) if arch == nil then raise("unknown architecture: " .. value) end + if suffix == 'a' and arch < 90 then + raise("unknown architecture: " .. prefix .. "_" .. arch .. suffix) + end + if suffix == 'f' and arch < 100 then + raise("unknown architecture: " .. prefix .. "_" .. arch .. suffix) + end if not know_list:has(arch) then if arch <= table.maxn(know_list:data()) then raise("unknown architecture: " .. prefix .. "_" .. arch) @@ -86,6 +97,9 @@ rule("cuda.gencodes") utils.warning("unknown architecture: " .. prefix .. "_" .. arch) end end + if suffix and #suffix > 0 then + return arch .. suffix + end return arch end -- cgit v1.3.1