Default NvvmArch::Compute75 silently produces InvalidPtx on pre-Turing GPUs (Pascal/Maxwell/Volta)
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 48/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- rust
- 领域
- backend, documentation
调研方向
从 crates/nvvm/src/lib.rs 和入门指南开始,确认文档中记录的 Compute75 默认值,以及示例如何配置其架构。然后检查 cust::Module::from_ptx 和 PTX 加载器的入口点,以评估诊断选项。当一项达成一致的指南或诊断改进能够处理 Turing 之前的 GPU,并包含对所得行为的覆盖或文档时,即视为完成。
由索引模型根据 Issue 内容生成。
描述
What happened
Following the getting-started guide on a GTX 1070 (Pascal, sm_61) with CUDA 12.9, cargo run builds successfully but fails at runtime with:
Error: InvalidPtx
No indication of why the PTX is invalid.
Root cause
cuda_builder::CudaBuilder defaults to NvvmArch::Compute75 (crates/nvvm/src/lib.rs):
/// This default value of 7.5 corresponds to Turing and later devices. We default to this
/// because it is the minimum supported by CUDA 13.0 while being in the middle of the range
/// supported by CUDA 12.x.
#[default]
Compute75,
This is a deliberate, documented choice — but it means the getting-started example silently generates PTX targeting sm_75, which the CUDA driver refuses to load on any GPU below Turing (Pascal, Maxwell, Volta — all still fully supported for building/running on CUDA 12.x, just not compiling for them by default). The failure surfaces as a generic cust::error::CudaError::InvalidPtx with nothing pointing at the arch mismatch, which is a confusing first-run experience for anyone following the guide on older hardware.
Suggestions (either would help; happy to send a PR for whichever is preferred)
- Guide fix: add a line to the getting-started example / Windows setup section noting that
.arch(NvvmArch::ComputeXX)should be set explicitly to match the target GPU's actual compute capability, with a pointer to Compute Capability Gating and tonvidia-smi --query-gpu=compute_cap --format=csvfor finding it. - Better diagnostics: have
cust::Module::from_ptx(or the PTX loader) detect aCUDA_ERROR_INVALID_PTX/CUDA_ERROR_NO_BINARY_FOR_GPUoutcome and, when possible, compare the PTX's.target smXXline against the current device's actual compute capability, surfacing a clearer error like "PTX built for sm_75 but device is sm_61 — rebuild with.arch(NvvmArch::Compute61)".
Either fix would have saved a fair amount of debugging time here since the error gives no hint that architecture — not toolchain or driver version — is the issue.
Environment
- GPU: GTX 1070 (Pascal,
sm_61) - Driver: 582.28
- CUDA Toolkit: 12.9.2
- Rust nightly: pinned per
rust-toolchain.tomlat the commit in question - OS: Windows 11
- 主要语言
- Rust
- 星标
- 5.4k
- 派生
- 251
- 平均合并
- 3 天 11 小时
- 30 天内合并 PR
- 3
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
Rust-GPU/rust-cuda 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 72/100
-
A `#[address_space(shared)]` static is stored with a generic `st.u32` instead of `st.shared`, corrupting memory — two identically-declared siblings lower differently可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 5/5 一周以上 新手友好度 30/100
-
Array parameters lose alignment metadata and ICE on >16 byte alignments可能已有人在做 @Snehal-Reddy 于 170 天前认领。 未关闭
难度 4/5 3-5 天 新手友好度 45/100
-
难度 4/5 3-5 天 新手友好度 35/100
-
难度 5/5 一周以上 新手友好度 38/100
查看 Rust-GPU/rust-cuda 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 64/100
维护者通常 3 天内回复
-
Zellij doesn't validate hex colors correctly and crashes可能已有人在做 @ymcx 今天认领。 未关闭suspected bug
难度 2/5 1-3 小时 新手友好度 76/100
zellij-org/zellij#5732 ·
维护者通常 1 天内回复
-
bug rust
难度 2/5 1-3 小时 新手友好度 78/100
jonathanong/no-mistakes#2267 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 69/100
rust-embedded/cortex-m#702 · 1 条评论 ·
-
Make major, minor, and makedev safe on solarish targets可能已有人在做 @xtqqczze 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复