summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorqiuyi <[email protected]>2026-01-05 18:04:55 +0800
committerqiuyi <[email protected]>2026-01-05 18:04:55 +0800
commit9e8d38dd751c6bd3701df49ed1b7709331691f64 (patch)
treee66266e6f2f099747954e422c8733b04ca4ed1ac
parent873bcdb3fefcee27023f356d24745815293a946d (diff)
add some comments according to code review
-rw-r--r--xmake/rules/cuda/gencodes/xmake.lua7
1 files changed, 7 insertions, 0 deletions
diff --git a/xmake/rules/cuda/gencodes/xmake.lua b/xmake/rules/cuda/gencodes/xmake.lua
index d27a3cb7c..bf2a52d27 100644
--- a/xmake/rules/cuda/gencodes/xmake.lua
+++ b/xmake/rules/cuda/gencodes/xmake.lua
@@ -71,6 +71,11 @@ rule("cuda.gencodes")
local v_arch = nil
local r_archs = {}
+ -- full legal value list could be found in nvcc docs
+ -- https://docs.nvidia.com/cuda/cuda-compiler-driver-nvcc/index.html#gpu-name-gpuname-arch
+ -- examples: sm_75, compute_75, sm_90a, compute_100, sm_100f, compute_100a, etc.
+ -- For robustness, xmake support a unoffical format: sm75, compute75, etc. New version still support it.
+ -- examples: sm75, compute75, sm90a, compute100, sm100f, compute100a, etc.
local function parse_arch(value, prefix, know_list)
if not value:startswith(prefix) then
return nil
@@ -79,6 +84,8 @@ rule("cuda.gencodes")
if arch_str:startswith("_") then
arch_str = arch_str:sub(2)
end
+
+ -- a legal arch_str should be like: 75, 90a, 100f, etc.
local arch_ver, suffix = arch_str:match("^(%d+)([af]?)$")
local arch = tonumber(arch_ver)
if arch == nil then