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

Add if-identical mode for download-ci-llvm #113761

Closed
wants to merge 3 commits into from

Conversation

Kobzol
Copy link
Contributor

@Kobzol Kobzol commented Jul 16, 2023

This PR tries to modify the download-ci-llvm logic so that it can support more use-cases, primarily downloading of LLVM from CI in dist CI builders. Currently, LLVM can be downloaded from CI only if you do not set any LLVM flags on config.toml (apart from assertions) - because it is not possible to find out the options that were used to compile LLVM from the dist archive stored on S3.

This means that dist builders have to build LLVM on every merge, even though the LLVM source code (nor its compilation options/parameters) have changed. It usually does not take too long to build LLVM thanks to sccache (usually about 10 - 20 minutes), but it's still a nontrivial cost when multiplied by the number of dist builders.

This PR proposes a new workflow:

  1. When a dist builder builds LLVM and uploads it to CI, it also uploads a separate archive that contains a JSON representation of the LLVM config (opts) used for compiling LLVM. An alternative to a separate archive is to just store this information directly within rust-dev, but then we would have to download this rather large archive when if-identical is used. I'm not sure if it would be that big of a deal, this mode is designed for CI, and most of the time it should be a "cache hit", when the LLVM options will be the same, and we will thus want to download LLVM anyway.
  2. A new if-identical mode for download-ci-llvm is added. When used, it will try to download the LLVM opts from CI, and compare them to the local options. If they are identical, it will download LLVM from CI. This means that a dist builder can use this option to download a previous LLVM build without rebuilding it from scratch if nothing related to LLVM has changed.

The logic of if-identical is now a bit weird in that it always unconditionally tries to download the configuration from CI, which means that it does this e.g. even if I just run python3 x.py fmt, which is definitely not something that we should do. I'm not sure how to resolve this though - maybe the logic of this mode should be "lazy", similarly as to how the value of llvm_link_shared is resolved lazily, based on data downloaded from CI?

I'm opening this PR mostly for discussion, it's not clear to me if this is the right direction. One counter-argument to this could be that we should actually run the dist LLVM builds on every commit, just to check more often that it still works. If this is the case, I would still like to do something like this at least for try builds, which are latency-bounds, possibly with some ad-hoc way and without using download-ci-llvm.

Related issue: #112011
Zulip discussion: https://rust-lang.zulipchat.com/#narrow/stream/326414-t-infra.2Fbootstrap/topic/Downloading.20LLVM.20from.20CI.20in.20dist.20builders

r? jyn514

Kobzol added 3 commits July 16, 2023 15:51
To make it easier to compare two LLVM configurations.
It downloads llvm-opts from CI and checks if it is equal to the LLVM compiled on CI.
@rustbot rustbot added 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 Jul 16, 2023
@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-llvm-14 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
##[group]Run git config --global core.autocrlf false
git config --global core.autocrlf false
shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
env:
  PR_CI_JOB: 1
  CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
  HEAD_SHA: de8e02c32e4c339ab7c7c42868444f09133dbecc
  SCCACHE_BUCKET: rust-lang-ci-sccache2
  TOOLSTATE_REPO: https://github.com/rust-lang-nursery/rust-toolstate
---
  lfs: false
  submodules: false
  set-safe-directory: true
env:
  PR_CI_JOB: 1
  CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
  HEAD_SHA: de8e02c32e4c339ab7c7c42868444f09133dbecc
  SCCACHE_BUCKET: rust-lang-ci-sccache2
  TOOLSTATE_REPO: https://github.com/rust-lang-nursery/rust-toolstate
---
##[group]Run src/ci/scripts/setup-environment.sh
src/ci/scripts/setup-environment.sh
shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
env:
  PR_CI_JOB: 1
  CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
  HEAD_SHA: de8e02c32e4c339ab7c7c42868444f09133dbecc
  SCCACHE_BUCKET: rust-lang-ci-sccache2
  TOOLSTATE_REPO: https://github.com/rust-lang-nursery/rust-toolstate
---
##[group]Run src/ci/scripts/should-skip-this.sh
src/ci/scripts/should-skip-this.sh
shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
env:
  PR_CI_JOB: 1
  CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
  HEAD_SHA: de8e02c32e4c339ab7c7c42868444f09133dbecc
  SCCACHE_BUCKET: rust-lang-ci-sccache2
  TOOLSTATE_REPO: https://github.com/rust-lang-nursery/rust-toolstate
---
##[group]Run src/ci/scripts/verify-channel.sh
src/ci/scripts/verify-channel.sh
shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
env:
  PR_CI_JOB: 1
  CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
  HEAD_SHA: de8e02c32e4c339ab7c7c42868444f09133dbecc
  SCCACHE_BUCKET: rust-lang-ci-sccache2
  TOOLSTATE_REPO: https://github.com/rust-lang-nursery/rust-toolstate
  TOOLSTATE_REPO: https://github.com/rust-lang-nursery/rust-toolstate
  CACHE_DOMAIN: ci-caches.rust-lang.org
  IMAGE: x86_64-gnu-llvm-14
##[endgroup]
##[group]Run src/ci/scripts/collect-cpu-stats.sh
src/ci/scripts/collect-cpu-stats.sh
shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
env:
  PR_CI_JOB: 1
  CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
  HEAD_SHA: de8e02c32e4c339ab7c7c42868444f09133dbecc
  SCCACHE_BUCKET: rust-lang-ci-sccache2
  TOOLSTATE_REPO: https://github.com/rust-lang-nursery/rust-toolstate
---
##[group]Run src/ci/scripts/install-sccache.sh
src/ci/scripts/install-sccache.sh
shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
env:
  PR_CI_JOB: 1
  CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
  HEAD_SHA: de8e02c32e4c339ab7c7c42868444f09133dbecc
  SCCACHE_BUCKET: rust-lang-ci-sccache2
  TOOLSTATE_REPO: https://github.com/rust-lang-nursery/rust-toolstate
  TOOLSTATE_REPO: https://github.com/rust-lang-nursery/rust-toolstate
  CACHE_DOMAIN: ci-caches.rust-lang.org
  IMAGE: x86_64-gnu-llvm-14
##[endgroup]
##[group]Run src/ci/scripts/select-xcode.sh
src/ci/scripts/select-xcode.sh
shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
env:
  PR_CI_JOB: 1
  CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
  HEAD_SHA: de8e02c32e4c339ab7c7c42868444f09133dbecc
  SCCACHE_BUCKET: rust-lang-ci-sccache2
  TOOLSTATE_REPO: https://github.com/rust-lang-nursery/rust-toolstate
  TOOLSTATE_REPO: https://github.com/rust-lang-nursery/rust-toolstate
  CACHE_DOMAIN: ci-caches.rust-lang.org
  IMAGE: x86_64-gnu-llvm-14
##[endgroup]
##[group]Run src/ci/scripts/install-clang.sh
src/ci/scripts/install-clang.sh
shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
env:
  PR_CI_JOB: 1
  CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
  HEAD_SHA: de8e02c32e4c339ab7c7c42868444f09133dbecc
  SCCACHE_BUCKET: rust-lang-ci-sccache2
  TOOLSTATE_REPO: https://github.com/rust-lang-nursery/rust-toolstate
  TOOLSTATE_REPO: https://github.com/rust-lang-nursery/rust-toolstate
  CACHE_DOMAIN: ci-caches.rust-lang.org
  IMAGE: x86_64-gnu-llvm-14
##[endgroup]
##[group]Run src/ci/scripts/install-wix.sh
src/ci/scripts/install-wix.sh
shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
env:
  PR_CI_JOB: 1
  CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
  HEAD_SHA: de8e02c32e4c339ab7c7c42868444f09133dbecc
  SCCACHE_BUCKET: rust-lang-ci-sccache2
  TOOLSTATE_REPO: https://github.com/rust-lang-nursery/rust-toolstate
  TOOLSTATE_REPO: https://github.com/rust-lang-nursery/rust-toolstate
  CACHE_DOMAIN: ci-caches.rust-lang.org
  IMAGE: x86_64-gnu-llvm-14
##[endgroup]
##[group]Run src/ci/scripts/disable-git-crlf-conversion.sh
src/ci/scripts/disable-git-crlf-conversion.sh
shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
env:
  PR_CI_JOB: 1
  CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
  HEAD_SHA: de8e02c32e4c339ab7c7c42868444f09133dbecc
  SCCACHE_BUCKET: rust-lang-ci-sccache2
  TOOLSTATE_REPO: https://github.com/rust-lang-nursery/rust-toolstate
---
##[group]Run src/ci/scripts/install-msys2.sh
src/ci/scripts/install-msys2.sh
shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
env:
  PR_CI_JOB: 1
  CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
  HEAD_SHA: de8e02c32e4c339ab7c7c42868444f09133dbecc
  SCCACHE_BUCKET: rust-lang-ci-sccache2
  TOOLSTATE_REPO: https://github.com/rust-lang-nursery/rust-toolstate
  TOOLSTATE_REPO: https://github.com/rust-lang-nursery/rust-toolstate
  CACHE_DOMAIN: ci-caches.rust-lang.org
  IMAGE: x86_64-gnu-llvm-14
##[endgroup]
##[group]Run src/ci/scripts/install-mingw.sh
src/ci/scripts/install-mingw.sh
shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
env:
  PR_CI_JOB: 1
  CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
  HEAD_SHA: de8e02c32e4c339ab7c7c42868444f09133dbecc
  SCCACHE_BUCKET: rust-lang-ci-sccache2
  TOOLSTATE_REPO: https://github.com/rust-lang-nursery/rust-toolstate
  TOOLSTATE_REPO: https://github.com/rust-lang-nursery/rust-toolstate
  CACHE_DOMAIN: ci-caches.rust-lang.org
  IMAGE: x86_64-gnu-llvm-14
##[endgroup]
##[group]Run src/ci/scripts/install-ninja.sh
src/ci/scripts/install-ninja.sh
shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
env:
  PR_CI_JOB: 1
  CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
  HEAD_SHA: de8e02c32e4c339ab7c7c42868444f09133dbecc
  SCCACHE_BUCKET: rust-lang-ci-sccache2
  TOOLSTATE_REPO: https://github.com/rust-lang-nursery/rust-toolstate
  TOOLSTATE_REPO: https://github.com/rust-lang-nursery/rust-toolstate
  CACHE_DOMAIN: ci-caches.rust-lang.org
  IMAGE: x86_64-gnu-llvm-14
##[endgroup]
##[group]Run src/ci/scripts/enable-docker-ipv6.sh
src/ci/scripts/enable-docker-ipv6.sh
shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
env:
  PR_CI_JOB: 1
  CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
  HEAD_SHA: de8e02c32e4c339ab7c7c42868444f09133dbecc
  SCCACHE_BUCKET: rust-lang-ci-sccache2
  TOOLSTATE_REPO: https://github.com/rust-lang-nursery/rust-toolstate
---
##[group]Run src/ci/scripts/disable-git-crlf-conversion.sh
src/ci/scripts/disable-git-crlf-conversion.sh
shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
env:
  PR_CI_JOB: 1
  CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
  HEAD_SHA: de8e02c32e4c339ab7c7c42868444f09133dbecc
  SCCACHE_BUCKET: rust-lang-ci-sccache2
  TOOLSTATE_REPO: https://github.com/rust-lang-nursery/rust-toolstate
  TOOLSTATE_REPO: https://github.com/rust-lang-nursery/rust-toolstate
  CACHE_DOMAIN: ci-caches.rust-lang.org
  IMAGE: x86_64-gnu-llvm-14
##[endgroup]
##[group]Run src/ci/scripts/verify-line-endings.sh
src/ci/scripts/verify-line-endings.sh
shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
env:
  PR_CI_JOB: 1
  CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
  HEAD_SHA: de8e02c32e4c339ab7c7c42868444f09133dbecc
  SCCACHE_BUCKET: rust-lang-ci-sccache2
  TOOLSTATE_REPO: https://github.com/rust-lang-nursery/rust-toolstate
  TOOLSTATE_REPO: https://github.com/rust-lang-nursery/rust-toolstate
  CACHE_DOMAIN: ci-caches.rust-lang.org
  IMAGE: x86_64-gnu-llvm-14
##[endgroup]
##[group]Run src/ci/scripts/verify-backported-commits.sh
src/ci/scripts/verify-backported-commits.sh
shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
env:
  PR_CI_JOB: 1
  CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
  HEAD_SHA: de8e02c32e4c339ab7c7c42868444f09133dbecc
  SCCACHE_BUCKET: rust-lang-ci-sccache2
  TOOLSTATE_REPO: https://github.com/rust-lang-nursery/rust-toolstate
---
##[group]Run src/ci/scripts/verify-stable-version-number.sh
src/ci/scripts/verify-stable-version-number.sh
shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
env:
  PR_CI_JOB: 1
  CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
  HEAD_SHA: de8e02c32e4c339ab7c7c42868444f09133dbecc
  SCCACHE_BUCKET: rust-lang-ci-sccache2
  TOOLSTATE_REPO: https://github.com/rust-lang-nursery/rust-toolstate
---
##[group]Run src/ci/scripts/run-build-from-ci.sh
src/ci/scripts/run-build-from-ci.sh
shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
env:
  PR_CI_JOB: 1
  CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
  HEAD_SHA: de8e02c32e4c339ab7c7c42868444f09133dbecc
  SCCACHE_BUCKET: rust-lang-ci-sccache2
  TOOLSTATE_REPO: https://github.com/rust-lang-nursery/rust-toolstate
---
   Compiling diff v0.1.12
   Compiling yansi v0.5.1
   Compiling pretty_assertions v1.3.0
   Compiling bootstrap v0.0.0 (/checkout/src/bootstrap)
error[E0609]: no field `llvm_build_config` on type `config::Config`
##[error]   --> config/tests.rs:146:16
146 |         config.llvm_build_config,
    |                ^^^^^^^^^^^^^^^^^ unknown field
    |
    |
    = note: available fields are: `changelog_seen`, `ccache`, `ninja_in_file`, `verbose`, `submodules` ... and 113 others
For more information about this error, try `rustc --explain E0609`.
error: could not compile `bootstrap` (lib test) due to previous error
Build completed unsuccessfully in 0:24:36
##[group]Clock drift check

Comment on lines 104 to 105
#[derive(Default, Clone)]
pub struct LLVMConfig {
Copy link
Member

Choose a reason for hiding this comment

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

this is essentially the same as config::Llvm struct, right? can we reuse that instead of adding a new struct?

(btw ty for putting this in a separate commit, it made things a lot easier to review ❤️)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The goal of this struct is to have a "ground truth" representation of all the options that can affect the build of LLVM, so that we can compare the CI version and the local version in an easy way - by just comparing the value of a struct, without manually comparing a subset of its keys.

However, there are some options under the [llvm] key in config.toml which should not be compared - notably download-ci-llvm. We definitely do not want to include this key when comparing the CI and local configs. So this is not 1:1 with the LLVM struct.

Note: I only removed from_ci from this struct in a later commit, to uphold what I wrote above, which is probably confusing.

Comment on lines +2324 to +2330
/* run only if llvm-config isn't used */
if let Some(config) = builder.config.target_config.get(&target) {
if let Some(ref _s) = config.llvm_config {
builder.info(&format!("Skipping RustDevConfig ({}): external LLVM", target));
return None;
}
}
Copy link
Member

Choose a reason for hiding this comment

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

can you make this a default instead of a skip, so that we can give a hard error if someone runs x dist rust-dev-config when external llvm is set? see #113640 for an example.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Like this?

fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
        let config = run.builder.config.target_config.get(&<how to get target?>).map(|c| c.llvm_config);
        run.alias("rust-dev-config").default_condition(config.is_none())
    }

I'm not sure how to get the target, because run.builder contains a list of targets.

/* run only if llvm-config isn't used */
if let Some(config) = builder.config.target_config.get(&target) {
if let Some(ref _s) = config.llvm_config {
builder.info(&format!("Skipping RustDevConfig ({}): external LLVM", target));
Copy link
Member

Choose a reason for hiding this comment

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

this is true but confusing when llvm_from_ci is set. maybe we can improve it a bit?

Suggested change
builder.info(&format!("Skipping RustDevConfig ({}): external LLVM", target));
let reason = if builder.config.llvm_from_ci { "downloaded LLVM from CI instead of building it" } else { "external llvm" };
builder.info(&format!("Skipping RustDevConfig ({target}): {reason}");

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea. However, I realized that this shouldn't fail when llvm_from_ci is true? Because this has to succeed when download-ci-llvm is if-identical. We should probably make llvm_from_ci an enum to distinguish these situations?

let config = t!(serde_json::to_string_pretty(&builder.build.config.llvm));
t!(std::fs::write(tarball.image_dir().join("llvm-opts.json"), config));

Some(tarball.generate())
Copy link
Member

Choose a reason for hiding this comment

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

this panics when running x dist rust-dev-config before the llvm submodule is checked out. could you add builder.update_submodule somewhere around

for file in self.overlay.legal_and_readme() {
self.builder.install(&self.builder.src.join(file), &self.overlay_dir, 0o644);
}
please?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should I really update LLVM submodule in a function that creates a tarball? Shouldn't this be in RustDevConfig? It sounds quite LLVM specific to do this in the Tarball struct.

Copy link
Member

Choose a reason for hiding this comment

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

hmm, i suppose doing it in this Step is fine. i was imaging you'd check overlay_kind in Tarball so each calling Step doesn't have to worry about it but in practice they're probably all doing the right thing.

src/bootstrap/dist.rs Show resolved Hide resolved
src/bootstrap/config.rs Show resolved Hide resolved
src/bootstrap/config.rs Show resolved Hide resolved
src/bootstrap/config.rs Show resolved Hide resolved
Comment on lines +678 to +704
pub(crate) fn download_ci_llvm_opts(&self, llvm_sha: &str) {
let cache_prefix = format!("llvm-opts-{llvm_sha}");
let cache_dst = self.out.join("cache");
let rustc_cache = cache_dst.join(cache_prefix);
t!(fs::create_dir_all(&rustc_cache));
let base = if self.llvm.assertions {
&self.stage0_metadata.config.artifacts_with_llvm_assertions_server
} else {
&self.stage0_metadata.config.artifacts_server
};
let version = self.artifact_version_part(llvm_sha);
let filename = format!("rust-dev-config-{}-{}.tar.xz", version, self.build.triple);
let tarball = rustc_cache.join(&filename);
if !tarball.exists() {
let help_on_error = "error: failed to download llvm config from ci

help: old builds get deleted after a certain time
help: if trying to compile an old commit of rustc, disable `download-ci-llvm` in config.toml:

[llvm]
download-ci-llvm = false
";
self.download_file(&format!("{base}/{llvm_sha}/{filename}"), &tarball, help_on_error);
}

let llvm_root = self.ci_llvm_root_opts();
self.unpack(&tarball, &llvm_root, "rust-dev-config");
Copy link
Member

Choose a reason for hiding this comment

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

i have a vague "this is duplicating a lot of code" feeling but nothing concrete - if you find some easy way to reduce the boilerplate here that would be nice, but no worries if it's tricky

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I still wonder if it wouldn't be simpler to just always download the LLVM archive (when using the if-identical mode) and embed the LLVM config directly inside of it. I think that the "hitrate" of this cache should be high enough (src/llvm-project doesn't change often, nor do build flags in dist builders), so downloading the archive everytime should be fine.

Comment on lines +228 to +230
// The LLVM config has changed its format or is corrupted in some way
eprintln!("Cannot deserialize LLVM config from llvm-opts.json");
return None;
Copy link
Member

Choose a reason for hiding this comment

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

hmm, when would this happen? continuing the build when we can't parse the format seems unfortunate, i worry it'll silence a real bug.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For example, if the struct is modified in a backwards incompatible way (e.g. new option added/removed), then it may fail to parse. This situation necessarily means that the config has changed somehow, and therefore we shouldn't reuse the LLVM from CI.

In theory, we could lose all caching if there was some bug and it was never deserialized properly, but the alternative is basically failing the build if the format changes, which we probably shouldn't do?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Or we could devise some versioning scheme for the config (Protobuf? 😆 ), but that seems like overkill.

@jyn514
Copy link
Member

jyn514 commented Jul 16, 2023

@bors try

@bors
Copy link
Contributor

bors commented Jul 16, 2023

⌛ Trying commit de8e02c with merge d67dca47d47cdaa9066289e11501efdd553e56c0...

@jyn514
Copy link
Member

jyn514 commented Jul 16, 2023

The logic of if-identical is now a bit weird in that it always unconditionally tries to download the configuration from CI, which means that it does this e.g. even if I just run python3 x.py fmt, which is definitely not something that we should do. I'm not sure how to resolve this though - maybe the logic of this mode should be "lazy", similarly as to how the value of llvm_link_shared is resolved lazily, based on data downloaded from CI?

the way download-rustc handles this is by making download_rustc_commit private, and forcing callers to use the fn download_rustc() wrapper which downloads the tarball lazily. maybe you can do something similar here?

@jyn514 jyn514 added A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue. labels Jul 16, 2023
@bors
Copy link
Contributor

bors commented Jul 16, 2023

☀️ Try build successful - checks-actions
Build commit: d67dca47d47cdaa9066289e11501efdd553e56c0 (d67dca47d47cdaa9066289e11501efdd553e56c0)

1 similar comment
@bors
Copy link
Contributor

bors commented Jul 16, 2023

☀️ Try build successful - checks-actions
Build commit: d67dca47d47cdaa9066289e11501efdd553e56c0 (d67dca47d47cdaa9066289e11501efdd553e56c0)

@bjorn3
Copy link
Member

bjorn3 commented Jul 16, 2023

Would it make sense to disable download-ci-llvm outside of the dev and nightly channels as safety guard for reproducibility if something ever goes wrong with this logic causing incorrect reuse of a precompiled LLVM. No artifacts in the dev and nightly channels are part of the bootstrap chain and stable and beta builds are much less common.

@jyn514
Copy link
Member

jyn514 commented Jul 16, 2023

to start i would actually like to only enable this in try builds, since that's the main use case. we can expand it to dist builders after we're reasonably sure it works - no objection to only doing it on the nightly channel dist builders when that happens.

@jyn514
Copy link
Member

jyn514 commented Jul 19, 2023

i won't have time to look at this for a while.

r? infra-ci

@rustbot rustbot assigned pietroalbini and unassigned jyn514 Jul 19, 2023
@Dylan-DPC Dylan-DPC added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 21, 2023
@Dylan-DPC
Copy link
Member

@Kobzol any updates on this? thanks

@Kobzol
Copy link
Contributor Author

Kobzol commented Nov 4, 2023

Hi, I'm no longer sure if this is a good idea, since we would not exercise the LLVM dist code paths. In any case, I don't have time to work on this currently, so I'll close it for now, and revisit it later if I come back to it.

@Kobzol Kobzol closed this Nov 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants