Description
I've been looking at rust-gpu last two days and since toolchain upgrades are non-trivial and sometimes take a while to actually happen, I'm wondering if it would be possible to limit toolchain requirement to just the code that is compiled for GPU.
Specifically, SpirvBuilder
calls cargo or rustc internally and could easily specify something like +nightly-whatever
in CLI. This would result in backend matching what SPIR-V backend expects, while allowing the rest of user's workspace using whatever toolchain it uses by default.
Override with +
has the highest priority, so this should work nicely.
Otherwise it requires much more elaborate setup with separate SPIR-V compilation and usage steps, probably separate workspaces, etc.
UPD: Looks like there is already toolchain_overwrite
on the builder, now I'm wondering why its value doesn't default to this workspace's rust-toolchain.toml
🤔
UPD2: This is exactly what I'm talking about, it should just use correct toolchain by default and not check current toolchain/generate an error if there is a single version supported anyway:
Compiling rustc_codegen_spirv v0.9.0 (https://github.com/Rust-GPU/rust-gpu?rev=e6d017d5504c4441a84edcc27f4eca61de6fc8cf#e6d017d5)
error: failed to run custom build command for `rustc_codegen_spirv v0.9.0 (https://github.com/Rust-GPU/rust-gpu?rev=e6d017d5504c4441a84edcc27f4eca61de6fc8cf#e6d017d5)`
Caused by:
process didn't exit successfully: `/home/nazar-pc/.cache/cargo/target/debug/build/rustc_codegen_spirv-3c6c975d26047f08/build-script-build` (exit status: 1)
--- stdout
cargo:rerun-if-env-changed=RUSTGPU_SKIP_TOOLCHAIN_CHECK
--- stderr
error: wrong toolchain detected (found commit hash `c68340350c78eea402c4a85f8d9c1b7d3d607635`, expected `b19329a37cedf2027517ae22c87cf201f93d776e`).
Make sure your `rust-toolchain.toml` file contains the following:
-------------
[toolchain]
channel = "nightly-2024-11-22"
components = ["rust-src", "rustc-dev", "llvm-tools"]
-------------
Exit code 101
UPD3: This is even more problematic. Why does it check toolchain components if I explicitly used `` feature so it doesn't do that? I really don't want to add rustc-dev
to the workspace since I'll not be using it anyway 😕
error: failed to run custom build command for `rustc_codegen_spirv v0.9.0 (https://github.com/Rust-GPU/rust-gpu?rev=e6d017d5504c4441a84edcc27f4eca61de6fc8cf#e6d017d5)`
Caused by:
process didn't exit successfully: `/home/nazar-pc/.cache/cargo/target/debug/build/rustc_codegen_spirv-909afb669bc3840e/build-script-build` (exit status: 1)
--- stdout
cargo:rerun-if-env-changed=RUSTGPU_SKIP_TOOLCHAIN_CHECK
--- stderr
missing `rustc-dev` component from toolchain `nightly-2025-06-19-x86_64-unknown-linux-gnu` (at /home/nazar-pc/.rustup/toolchains/nightly-2025-06-19-x86_64-unknown-linux-gnu)
warning: build failed, waiting for other jobs to finish...
Exit code 101
UPD4: Looks like I hit #104 in the end.