summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorqiuyi <[email protected]>2026-01-05 15:31:27 +0800
committerqiuyi <[email protected]>2026-01-05 15:31:27 +0800
commit346e2cf549cbd030cadc2d735bb4053da25f751d (patch)
treeb108d541d30b6f4f72f745a18cf818f852ce9796
parentc8ecdbe7283ec7478ee4f855b5e878aaa16c3fa6 (diff)
support 'a' and 'f' suffix for arch > sm_90/compute_90
-rw-r--r--xmake/rules/cuda/gencodes/xmake.lua16
1 files changed, 15 insertions, 1 deletions
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