自动获取cuda支持的architecture
你在什么场景下需要该功能?
目前版本下,使用cugencode为cuda编译添加需要支持的结构后,xmake会根据两个固定的列表检查这个结构是否支持,如果不支持会发出warning
随着CUDA和nvcc版本的更新,这个列表需要手动维护;且xmake默认结构代码sm_XX/compute_XX中的XX只能为纯数字,目前版本的nvcc还对90以上的结构支持sm_XXa/sm_XXf等带后缀的写法,xmake无法支持
描述可能的解决方案
不再使用静态列表,而在运行时通过nvcc --list-gpu-code --list-gpu-arch获取CUDA支持的architecture,并对90以后的结构支持a后缀,100以后的结构支持f后缀
描述你认为的候选方案
No response
其他信息
No response
用 native 呢,我记得这个就是自动探测的
https://github.com/xmake-io/xmake/blob/efe96186ac2678b006a00b86e75b2c6346398ab4/xmake/templates/cuda/console/project/xmake.lua#L8
用 native 呢,我记得这个就是自动探测的
xmake/xmake/templates/cuda/console/project/xmake.lua
Line 8 in efe9618
add_cugencodes("native")
这里说的是自动更新支持列表,而不是自动gencode 比如要在RTX3000(sm86)的设备上为RTX5000(sm120)的设备编译cuda代码,就只能手动设置cugencode("sm_120"),此时由于上面的支持列表中没有120,就会报一个warning
这个你直接提个 pr 过来改进下吧,我这也没环境调这个
Bot detected the issue body's language is not English, translate it automatically.
Title: Automatically obtain the architecture supported by cuda
In what scenario do you need this function?
Under the current version, after using cugencode to add a structure that needs to be supported for cuda compilation, xmake will check whether the structure is supported based on two fixed lists. If it is not supported, a warning will be issued.
As CUDA and nvcc versions are updated, this list needs to be maintained manually; and the XX in xmake's default structure code sm_XX/compute_XX can only be pure numbers. The current version of nvcc also supports sm_XXa/sm_XXf and other suffixed writing methods for structures above 90, which xmake cannot support.
Describe possible solutions
No longer use a static list, but obtain the architecture supported by CUDA through nvcc --list-gpu-code --list-gpu-arch at runtime, and support the a suffix for structures after 90, and the f suffix for structures after 100
Describe your alternatives
No response
Other information
No response
Bot detected the issue body's language is not English, translate it automatically.
When using native, I remember this is automatically detected.
https://github.com/xmake-io/xmake/blob/efe96186ac2678b006a00b86e75b2c6346398ab4/xmake/templates/cuda/console/project/xmake.lua#L8
Bot detected the issue body's language is not English, translate it automatically.
Use native. I remember this is automatically detected.
xmake/xmake/templates/cuda/console/project/xmake.lua
Line 8 in efe9618
add_cugencodes("native")
What we are talking about here is automatic update support list, not automatic gencode For example, if you want to compile cuda code for RTX5000 (sm120) device on RTX3000 (sm86) device, you can only manually set cugencode("sm_120"). At this time, since 120 is not in the above support list, a warning will be reported.
Bot detected the issue body's language is not English, translate it automatically.
Please submit a PR to improve this. I don’t have the environment to adjust this.