Skip to content

为cuda arch添加后缀支持#7187

Merged
waruqi merged 3 commits intoxmake-io:devfrom
veritas-Qiu:dev
Jan 6, 2026
Merged

为cuda arch添加后缀支持#7187
waruqi merged 3 commits intoxmake-io:devfrom
veritas-Qiu:dev

Conversation

@veritas-Qiu
Copy link

@veritas-Qiu veritas-Qiu commented Jan 5, 2026

#6910 的work around方案,手动更新数字列表而不是自动获取,但增加后缀支持
关于后缀支持,可以参考NVCC doc
注意:改动前,xmake支持非标准连接符号(如sm-90 sm@90等),改动后,将只支持下划线和无连接符号(sm_90和sm90)

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @veritas-Qiu, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

此拉取请求通过修改 xmake.lua 中的 CUDA 架构解析逻辑,为 #6910 提供了一个工作方案。它特别增加了对架构后缀(如 'a' 和 'f')的支持,这些后缀用于表示 CUDA 计算能力的特定功能集或修订版,从而与 NVCC 文档保持一致。这一更改使得在构建过程中能够更精确地定位 CUDA 架构。

Highlights

  • CUDA 架构后缀支持: 为 cuda arch 字符串添加了对 'a' 和 'f' 后缀的支持,以匹配 NVCC 文档中定义的特定架构变体。
  • 后缀验证逻辑: 引入了新的验证规则:后缀 'a' 仅适用于架构版本 90 及以上,而后缀 'f' 仅适用于架构版本 100 及以上,以确保架构定义的正确性。
  • 架构解析改进: 更新了 CUDA 架构解析逻辑,现在能够正确提取数字版本和可选后缀,并将其作为完整的架构标识符返回。

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

本次 PR 为 CUDA 架构版本号添加了后缀支持(例如 'a' 和 'f'),使其能够处理像 sm_90a 这样的架构。代码通过正则表达式解析版本号和后缀,并添加了对后缀有效性的检查。这是一个很好的改进。

然而,我发现了一个严重问题:新的实现在 parse_arch 函数中返回字符串(当存在后缀时),而之前它总是返回数字。这会导致在 nf_cugencode 函数中调用 math.min 时崩溃,因为它无法处理字符串。我在代码中留下了详细的审查意见。请务必修复此问题以避免运行时错误。

@veritas-Qiu veritas-Qiu marked this pull request as draft January 5, 2026 08:04
@veritas-Qiu veritas-Qiu marked this pull request as ready for review January 5, 2026 08:19
@waruqi waruqi added this to the v3.0.7 milestone Jan 6, 2026
@waruqi waruqi merged commit 6eff9dd into xmake-io:dev Jan 6, 2026
35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants