Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use cargo artifact dependencies #3

Open
Gui-Yom opened this issue Oct 12, 2024 · 0 comments
Open

Use cargo artifact dependencies #3

Gui-Yom opened this issue Oct 12, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@Gui-Yom
Copy link
Owner

Gui-Yom commented Oct 12, 2024

Cargo has an unstable feature that allow a crate to have a dependency on binary targets of another crate, allowing the dependency to be built for another target. https://doc.rust-lang.org/cargo/reference/unstable.html#artifact-dependencies

The point is to allow publishing of this repo's crates to crates.io and permit installation using cargo install.

I just tried using that new feature (see branch https://github.com/Gui-Yom/turbo-metrics/tree/bindeps) to replace the current hack with nvptx-builder. I think the feature if great but it is too damn early as it makes a lot of workflows break (like cargo publish and cargo install).

  • No need for the brittle nvptx-builder anymore
  • Requires nightly for the whole workspace (instead of just the kernels) and a -Z bindeps
  • My IDE seems to support it (RustRover)
  • crates.io supports the manifest extension, allowing crates to be published.
  • The verify step in cargo publish breaks the environment variables that are supposed to be set for finding artifacts (https://github.com/rust-lang/cargo/blob/master/src/cargo/core/compiler/artifact.rs). I think that's because the verify step changes the name of dependencies by appending the crate hash, causing the CARGO_CDYLIB_FILE_{} to not be set.
  • Using cargo install <from crates.io> does not work because the dependencies of artifact dependencies (in this case nvptx-std are not built with the right target. cargo install from the workspace dir does work though.

The bindeps feature seems promising but right now it does not fix more problems than simply using nvptx-builder. I should revisit this in a moment.

@Gui-Yom Gui-Yom added the enhancement New feature or request label Oct 12, 2024
@Gui-Yom Gui-Yom self-assigned this Oct 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant