summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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