Skip to content

fix(cargo-oxide): pin release-like codegen in Cargo profiles - #1510

Open
ssoj13 wants to merge 1 commit into
NVIDIA:mainfrom
ssoj13:nvidia/fix/release-profile-pins
Open

ssoj13 wants to merge 1 commit into
NVIDIA:mainfrom
ssoj13:nvidia/fix/release-profile-pins

Conversation

@ssoj13

@ssoj13 ssoj13 commented Oct 13, 2026

Copy link
Copy Markdown

Release-like cargo oxide commands previously pinned ordinary Cargo profile settings through rustflags. Their flags differed from cargo oxide test -- --release, invalidating dependency fingerprints and causing the following build to recompile the graph.

Fixes #1508.

Move opt-level, debug assertions, overflow checks and debug information into Cargo profile environment settings. Preserve the previous last-word override by appending a -C pin when incoming rustflags already set that option. Document how package/build overrides and explicit Cargo config interact with these pins.

Port of ansidium/cuda-rust-windows#12, independently rebased onto NVIDIA main bc46b1ffb.

Current verification, pinned nightly-2026-10-11 on Linux/WSL2:

  • cargo test --locked -p cargo-oxide: 246 passing tests.
  • Regression tests check identical build/test encoded flags, release/dev/custom profile settings, incoming rustc flag spellings, and precedence.
  • Clippy/all targets with -D warnings, formatting and SPDX checks pass.

The original change was authored by Alex Khal with Claude Code. This transplant and current verification were prepared with Codex; original attribution and DCO are preserved.

…rustflags

Release-like routes (`build`, `run`, `debug`, interop, passthrough `build`)
appended `-Copt-level=3 -Cdebug-assertions=off` (plus overflow-checks /
debuginfo variants) to CARGO_ENCODED_RUSTFLAGS, while `test` leaves the
profile alone. The values equal the release defaults, but different rustflags
change every crate's fingerprint: `cargo oxide test -- --release` followed by
`cargo oxide build` recompiled the whole dependency graph (~680 crates for one
application) and CI caches held two copies of everything.

`CodegenProfilePolicy::pinned_options` is now the single list of pins. They
are set as `CARGO_PROFILE_{RELEASE,DEV,<--profile>}_*`; Cargo fingerprints
resolved profile values, so build and test share every artifact. A pinned
`-C` flag is still appended after incoming rustflags that set the same option
(including `-O`, `-g` and `_` spellings), so the pin keeps winning. Every
release-like policy now pins `overflow-checks = off` explicitly: a passthrough
build without `--release` runs the dev profile, whose overflow-checks default
is on. `cargo oxide debug`'s manual CARGO_PROFILE_RELEASE_DEBUG moved into the
same list. `[profile.*.package.*]` overrides and `--config profile.*` outrank
the environment; the README says so.

Signed-off-by: Alex Khal <joss13@gmail.com>
Signed-off-by: ssoj13 <96214515+ssoj13@users.noreply.github.com>
@ssoj13
ssoj13 requested a review from nihalpasham as a code owner October 13, 2026 19:29
@copy-pr-bot

copy-pr-bot Bot commented Oct 13, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@nihalpasham nihalpasham added the cuda-oxide SIMT programming model: rustc backend, cargo oxide, cuda-device, cuda-host, book label Oct 15, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cuda-oxide SIMT programming model: rustc backend, cargo oxide, cuda-device, cuda-host, book

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: release-like rustflags invalidate build and test artifact reuse

2 participants