NVIDIA 官方 Rust 编译器直接生成 GPU 代码
推荐指数 81.0 NO. 014 · 2026.05.12
发布2026/05/11Score257Comments70
为什么值得看
cuda-oxide 是 NVIDIA 官方实验性 Rust-to-CUDA 编译器,可直接将标准 Rust 代码编译为 PTX 指令,无需 DSL 或外部绑定。对用 Rust 做高性能计算的团队来说,这意味着终于能用安全且符合语言习惯的代码直接写 GPU 内核,省去 C++ 互操作的心智负担。
编辑判断
Rust GPU 生态之前主要靠 rust-gpu 这类社区项目,但它针对的是 Vulkan/SPIR-V,CUDA 支持一直缺位。做 AI 基础设施的团队写 CUDA 内核基本还是 C++,再用 cxx 或手写 FFI 桥接 Rust,内存安全和编译时检查在边界处全部失效。
cuda-oxide 的关键差异是 NVIDIA 官方背书,且直接编译到 PTX 而非绕经 LLVM IR,理论上能更好对接 NVCC 的优化管线。不过它目前还是实验性项目,async GPU 编程的章节暗示 NVIDIA 在推和 tokio 类似的执行模型,这可能影响未来 Rust 异步运行时与 GPU 调度融合的方向。
如果你在用 Rust 做推理引擎、科学计算或图形处理,现在可以开始跟踪这个项目,但生产环境建议等至少一个稳定版本发布后再迁移。
社区反馈
意见分歧 89 条评论
核心争论:官方 Rust-to-CUDA 能否替代 cudarc,以及闭源生态与开源理念的冲突
This is amazing.. ive been working with custom CUDA kernels and https://crates.io/crates/cudarc for a long time, and this honestly looks like it could be a near drop-in replacement. im especially curious how build times would compare? Most Rust CUDA crates obv rely on calling CMa
Do other people agree cuda-oxide looks like a near dorp in replacement for cudarc? That would be amazing, but probably not imo complementarily so. I am curious what distinguished cuda-oxide. Beyond it being totally under nv control.
perhaps not drop-in, but all my workflows with cudarc have always been "i make cuda kernel, i use cudarc for ffi to said kernels, i call via rust" - which for this case is pretty analogous briefly looking at the repo, looks like the main workflow is using rustc-codegen-cuda to convert rust -> MIR ->