feat(godbolt): add Compiler Explorer integration for rust-cuda kernels#394
feat(godbolt): add Compiler Explorer integration for rust-cuda kernels#394g-ampo wants to merge 3 commits intoRust-GPU:mainfrom
Conversation
LegNeato
left a comment
There was a problem hiding this comment.
Thanks for working on this! I am not super familiar with compiler explorer, so apologies if my review questions are dumb.
|
Thinking about this some more, instead of shell perhaps it would be better to write this tool in rust (a normal binary that can compile with any version of rust). Then we can add tests and such to our CI to make sure we don't inadvertently break the integration. As it is I am worried that we land something and don't know it breaks until we go to update the version in compiler explorer. Thoughts? |
|
Yes would make sense. The main thing the Rust binary would still do is shell out to cargo build under the hood, so the breakage surface is similar to shell (for the glue parts)... but if it imports cuda_std or hooks into the build logic directly, that gives compile-time detection when APIs change, which shell can't do :) Would be (very) happy to rewrite it in Rust. |
|
Up to you! |
Summary
Add Compiler Explorer integration so users can compile rust-cuda kernels to PTX in the browser.
Closes #177, partially addresses #353.
Building on the discussion between @LegNeato and @Forsworns .This takes the "wrapper script that replicates cuda_builder's rustc invocation" route that @LegNeato suggested (to avoiding the need for cargo on the CE side)
Changes
contrib/godbolt/rust-cuda-wrapper.sh- wrapper that creates a temp Cargo project with the same rustflags ascuda_builder::invoke_rustc(), builds to PTX, extracts output from cargo JSONcontrib/godbolt/install.sh- installs pinned nightly, buildsrustc_codegen_nvvm, lays out a self-contained prefixcontrib/godbolt/rust-cuda.defaults.properties- CE language/compiler configcontrib/godbolt/test-kernel.rs- sample kernels for smoke-testingcontrib/godbolt/README.md- local testing and upstream submission stepsTesting
cargo checkpassescargo clippy --workspacepasses