diff --git a/.github/workflows/enzyme-ci.yml b/.github/workflows/enzyme-ci.yml index c9a3b8245851f..19aa039478b39 100644 --- a/.github/workflows/enzyme-ci.yml +++ b/.github/workflows/enzyme-ci.yml @@ -45,6 +45,20 @@ jobs: with: path: build/build/x86_64-unknown-linux-gnu/enzyme key: ${{ matrix.os }}-enzyme-${{ steps.enzyme-commit.outputs.HEAD }} + - name: Cache bootstrap/stage0 artifacts for incremental builds + uses: actions/cache@v4 + with: + path: | + build/build/bootstrap/ + build/build/x86_64-unknown-linux-gnu/stage0-rustc/ + build/build/x86_64-unknown-linux-gnu/stage0-std/ + build/build/x86_64-unknown-linux-gnu/stage0-tools/ + build/build/x86_64-unknown-linux-gnu/stage1-std/ + # Approximate stable hash. It doesn't matter too much when this goes out of sync as it just caches + # some stage0/stage1 dependencies and stdlibs which *hopefully* are hash-keyed. + key: enzyme-rust-incremental-${{ runner.os }}-${{ hashFiles('src/**/Cargo.lock', 'Cargo.lock') }} + restore-keys: | + enzyme-rust-incremental-${{ runner.os }} - name: Build run: | wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add - diff --git a/src/bootstrap/src/core/build_steps/llvm.rs b/src/bootstrap/src/core/build_steps/llvm.rs index 6736b985ebeba..57f15faca1315 100644 --- a/src/bootstrap/src/core/build_steps/llvm.rs +++ b/src/bootstrap/src/core/build_steps/llvm.rs @@ -1211,7 +1211,12 @@ impl HashStamp { fn is_done(&self) -> bool { match fs::read(&self.path) { - Ok(h) => self.hash.as_deref().unwrap_or(b"") == h.as_slice(), + Ok(h) => { + let unwrapped = self.hash.as_deref().unwrap_or(b""); + let res = unwrapped == h.as_slice(); + eprintln!("Result for {:?}: {res:?} for expected '{unwrapped:?}' and read '{h:?}'", self.path); + res + }, Err(e) if e.kind() == io::ErrorKind::NotFound => false, Err(e) => { panic!("failed to read stamp file `{}`: {}", self.path.display(), e); diff --git a/src/bootstrap/src/lib.rs b/src/bootstrap/src/lib.rs index a733e55c8f9d6..0726fc6ced40f 100644 --- a/src/bootstrap/src/lib.rs +++ b/src/bootstrap/src/lib.rs @@ -1866,6 +1866,9 @@ pub fn generate_smart_stamp_hash(dir: &Path, additional_input: &str) -> String { .map(|o| String::from_utf8(o.stdout).unwrap_or_default()) .unwrap_or_default(); + eprintln!("Computing stamp for {dir:?}"); + eprintln!("Diff output: {diff:?}"); + let status = Command::new("git") .current_dir(dir) .arg("status") @@ -1876,13 +1879,19 @@ pub fn generate_smart_stamp_hash(dir: &Path, additional_input: &str) -> String { .map(|o| String::from_utf8(o.stdout).unwrap_or_default()) .unwrap_or_default(); + eprintln!("Status output: {status:?}"); + eprintln!("Additional input: {additional_input:?}"); let mut hasher = sha2::Sha256::new(); hasher.update(diff); hasher.update(status); hasher.update(additional_input); - hex_encode(hasher.finalize().as_slice()) + let result = hex_encode(hasher.finalize().as_slice()); + + eprintln!("Final hash: {result:?}"); + + result } /// Ensures that the behavior dump directory is properly initialized.