Repository navigation
fix(cargo-oxide): build standalone setup from deps - #1708
Merged
nihalpasham merged 3 commits intoNov 9, 2026
Merged
nihalpasham merged 3 commits into
nihalpasham merged 3 commits into
Conversation
Outside the cuda-oxide workspace, Context::codegen_crate is the user's project directory, yet setup built it as the backend source. A `cargo oxide new` project failed with "no library targets found", and a library crate compiled itself and then found no backend artifact. Standalone setup now takes the same path as `update`'s RefreshCache: it rebuilds the backend from the commit the project's cuda-oxide dependency resolves to (in place for a path dependency, from a main clone without one) and installs it into the shared cache. Both commands share that code, and setup refuses a CUDA_OXIDE_BACKEND or `.cargo/cuda-oxide.toml` pin the way update does, since the pin outranks the cache it would rebuild. setup now resolves its context without building the backend, so a cold cache is built once instead of once during resolution and again in setup. Workspace setup still builds the local source and publishes it to the shared cache. Fixes NVIDIA#1688 Signed-off-by: Praveen Perera <[email protected]>
`refresh_cached_backend` decided whether to clear the shared cache from a read-only `cargo metadata --offline --locked`, which fails on a project with no `Cargo.lock` yet. The failure counted as "uses the cache", so the first `setup` or `update` of a fresh project with a path dependency cleared the shared cache, and the in-place build never repopulated it. Decide from the full resolution instead, which also leaves the cache intact when resolution fails. Signed-off-by: Praveen Perera <[email protected]>
A standalone refresh cleared the shared cache before checking that the project's toolchain can build and load the dependency's backend. On a mismatch it then refused and exited, leaving other projects without the cached backend they were using and nothing in its place. `setup` now reaches this path, so settle the refusal while planning the refresh, before anything is cleared. Also note in `update`'s doc comment that a path dependency builds in place and leaves the shared cache alone. Signed-off-by: Praveen Perera <[email protected]>
praveenperera
marked this pull request as ready for review
November 3, 2026 13:45
praveenperera
added a commit
to praveenperera/cuda-rust
that referenced
this pull request
Nov 3, 2026
Replace the fork's earlier standalone-setup fix with the reviewed version from upstream NVIDIA#1708. Standalone `cargo oxide setup` now rebuilds the backend the way `update` refreshes the cache, from the commit the project's cuda-oxide dependency resolves to, and refuses a backend pin as `update` does. Context resolution no longer builds the backend, so a cold cache is built once. Two cache fixes came out of review. The decision to clear the shared cache now uses the full resolution, so a fresh project with a path dependency and no Cargo.lock no longer clears it. A toolchain mismatch is refused while planning the refresh, before the cache is cleared. Signed-off-by: Praveen Perera <[email protected]>
Collaborator
|
/ok to test dc633ac |
Collaborator
|
Thanks, routing standalone At |
nihalpasham
approved these changes
Nov 9, 2026
copy-pr-bot Bot
pushed a commit
that referenced
this pull request
Nov 22, 2026
…fication Resolve `commands/context.rs` with #1708 (`resolve_context_in`) and refresh `examples/safe_*/Cargo.lock` to workspace `0.4.0`. Signed-off-by: nihalpasham <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What This PR Does
Fixes
cargo oxide setupin standalone projects so it builds the project'scuda-oxidedependency once instead of attempting to compile the user's crate as the codegen backend:crates/cargo-oxide/src/commands/)crates/cargo-oxide/src/backend.rs)1. Standalone
cargo oxide setupResolution and RefreshPreviously,
Commands::Setupcalledresolve_context(), which eagerly built the backend once and setctx.codegen_crate = cwdoutside the workspace.setup()then tried to buildctx.codegen_crateasrustc-codegen-cuda, compiling the user's project and failing:refresh_planresolvesCargo.lockand checks toolchain compatibility before clearing~/.cargo/cuda-oxide/, so lockless path dependencies and refused toolchains never wipe a valid shared cache.Verification
cargo test -p cargo-oxide: PASS (287 passed)cargo clippy -p cargo-oxide --all-targets -- -D warnings: PASSRUSTDOCFLAGS="-D warnings" cargo doc -p cargo-oxide --no-deps: PASSCloses #1688