Skip to content

Offload cmake cleanups - #162196

Open
ZuseZ4 wants to merge 2 commits into
rust-lang:mainfrom
ZuseZ4:offload-cmake-cleanups
Open

Offload cmake cleanups#162196
ZuseZ4 wants to merge 2 commits into
rust-lang:mainfrom
ZuseZ4:offload-cmake-cleanups

Conversation

@ZuseZ4

@ZuseZ4 ZuseZ4 commented Sep 2, 2026

Copy link
Copy Markdown
Member

r? kobzol

Split out of #161565, which requires (minor) LLVM changes.
These cleanups are valuable on their own already, and shouldn't be blocked. So let's land it, before it get's stale with all the refactoring going on ^^

Copied the disclaimer: I used an llm to implement the fixes, since I still don't like cmake.
I confirm that on a high-level these are the right fixes as far as I can tell, and I reviewed/refactored it.

@rustbot

rustbot commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

rustc-dev-guide is developed in its own repository. If possible, consider making this change to rust-lang/rustc-dev-guide instead.

cc @BoxyUwU, @tshepang

This PR changes how LLVM is built. Consider updating src/bootstrap/download-ci-llvm-stamp.

@rustbot rustbot added A-rustc-dev-guide Area: rustc-dev-guide S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Sep 2, 2026
@rustbot

rustbot commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

kobzol is not on the review rotation at the moment.
They may take a while to respond.

@rust-log-analyzer

This comment has been minimized.

Originally introduced in the Enzyme build and coppied around since,
but without effect for a few years by now.
@ZuseZ4
ZuseZ4 force-pushed the offload-cmake-cleanups branch from 9d399d1 to 341d294 Compare September 2, 2026 15:36

@Kobzol Kobzol left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand the offload specific parts much, but left some bootstrap general remarks.

View changes since this review

///
/// Deliberately not under `llvm_output_dir`, since running cmake twice in the same folder is
/// known to cause issues, like deleting existing binaries.
pub fn offload_out(&self, target: TargetSelection) -> PathBuf {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I deliberately removed these functions recently, because they are an antipattern 😅 Steps should be ensuring other steps to get the build directory, rather than implicitly depending on paths from a shared function.

@@ -2899,7 +2898,7 @@ impl CommandLineStep for Offload {
tarball.set_overlay(OverlayKind::Offload);
tarball.is_preview(true);

let omp_offload_libdir = builder.out.join(target).join("offload").join("lib");
let omp_offload_libdir = builder.offload_out(target).join("lib");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be using the path from the omp_offload step output.

// binaries. We therefore write our offload artifacts into it's own folder, instead of
// using the llvm build dir.
let out_dir = builder.out.join(self.target.triple).join("offload");
let out_dir = builder.offload_out(self.target);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should hardcode the path here, this is the canonical place where that path is decided.

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

Labels

A-rustc-dev-guide Area: rustc-dev-guide S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants