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

ci: ensure nightly and rustup are available #81

Merged
merged 5 commits into from
Mar 29, 2024

Conversation

jedbrown
Copy link

No description provided.

@jedbrown
Copy link
Author

@wsmoses This passed, but isn't caching (yet) or testing (yet).

What to cache?

Perhaps the right choice is to cache all of build, though it's going to be bigger than the end products of compilation. I don't think rebuilding Rust stage1 (without caching) is prohibitive so long as LLVM is available. These are the sizes for just the LLVM portion. I'll test whether we can delete build/host/llvm/build without that triggering a clean build of LLVM.

$ dust build/host/llvm
 48M   ┌── include                                   │█                                                               │   2%
 45M   │ ┌── c-index-test                            │█░░░                                                            │   1%
 97M   │ ├── llvm-exegesis                           │███░                                                            │   3%
190M   ├─┴ bin                                       │████                                                            │   6%
 47M   │ ┌── libclang.so.17.0.6-rust-1.77.0-nightly  │█░░░░░░░░░░░░░░░░░                                              │   2%
 49M   │ ├── libclangSema.a                          │██░░░░░░░░░░░░░░░░                                              │   2%
 89M   │ ├── libclang-cpp.so.17-rust-1.77.0-nightly  │██░░░░░░░░░░░░░░░░                                              │   3%
141M   │ ├── libLLVM-17-rust-1.77.0-nightly.so       │███░░░░░░░░░░░░░░░                                              │   5%
865M   ├─┴ lib                                       │██████████████████                                              │  28%
 44M   │   ┌── clang-ast-dump                        │█▒▒▒▒░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░                       │   1%
 45M   │   ├── c-index-test                          │█▒▒▒▒░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░                       │   1%
 97M   │   ├── llvm-exegesis                         │███▒▒░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░                       │   3%
236M   │ ┌─┴ bin                                     │█████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░                       │   8%
 38M   │ │     ┌── StaticAnalyzer                    │█▓▓▓▓▓▒░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░                       │   1%
 48M   │ │     │   ┌── obj.clangSema.dir             │█▓▓▓▓▓▒░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░                       │   2%
 48M   │ │     │ ┌─┴ CMakeFiles                      │█▓▓▓▓▓▒░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░                       │   2%
 49M   │ │     ├─┴ Sema                              │██▓▓▓▓▒░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░                       │   2%
246M   │ │   ┌─┴ lib                                 │██████▒░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░                       │   8%
267M   │ │ ┌─┴ clang                                 │██████▒░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░                       │   9%
302M   │ ├─┴ tools                                   │███████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░                       │  10%
 44M   │ │ ┌── CodeGen                               │█▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒░░░░░░░░░░░░                       │   1%
 47M   │ │ ├── libclang.so.17.0.6-rust-1.77.0-nightly│█▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒░░░░░░░░░░░░                       │   2%
 49M   │ │ ├── libclangSema.a                        │██▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒░░░░░░░░░░░░                       │   2%
 50M   │ │ ├── Transforms                            │██▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒░░░░░░░░░░░░                       │   2%
 89M   │ │ ├── libclang-cpp.so.17-rust-1.77.0-nightly│██▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒░░░░░░░░░░░░                       │   3%
141M   │ │ ├── libLLVM-17-rust-1.77.0-nightly.so     │███▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒░░░░░░░░░░░░                       │   5%
 59M   │ │ │ ┌── RISCV                               │██▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒░░░░░░░░░░░░                       │   2%
 62M   │ │ │ ├── X86                                 │██▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒░░░░░░░░░░░░                       │   2%
 63M   │ │ │ ├── AArch64                             │██▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒░░░░░░░░░░░░                       │   2%
319M   │ │ ├─┴ Target                                │███████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒░░░░░░░░░░░░                       │  10%
1.4G   │ ├─┴ lib                                     │█████████████████████████████░░░░░░░░░░░░                       │  45%
1.9G   ├─┴ build                                     │█████████████████████████████████████████                       │  64%
3.0G ┌─┴ llvm                                        │███████████████████████████████████████████████████████████████ │ 100%

When/how to rebuild Enzyme?

We currently have an (empty) marker file build/host/enzyme/enzyme-finished-building that controls whether Enzyme is rebuilt. Shall we change it to hold the Enzyme commit hash as returned by

$ git -C src/tools/enzyme rev-parse HEAD
7e3e90f4287068a41d3fb5a99127ee2857353b04

Note that this need not be the same as the currently-committed submodule (if the tree is dirty, which should not be the case in CI)

$ git ls-tree --object-only HEAD src/tools/enzyme
7e3e90f4287068a41d3fb5a99127ee2857353b04

I don't think caching Enzyme is important -- it doesn't take long to build and it'll be changing relatively frequently.

Actually running tests

Our current cargo +enzyme test --examples does nothing because it's running in the rustc repo. Rust has x test for testing the compiler and we could have some Enzyme tests there. We've also been writing tests in EnzymeAD/rustbook and we could check out that repo to run the tests that are there. Shall we also put ADBench tests in that repository?

@ZuseZ4
Copy link
Member

ZuseZ4 commented Mar 28, 2024

@wsmoses I can't add @jedbrown to the rust org of Enzyme, can you do that please?

@wsmoses
Copy link
Member

wsmoses commented Mar 28, 2024

@wsmoses I can't add @jedbrown to the rust org of Enzyme, can you do that please?

Done

@ZuseZ4
Copy link
Member

ZuseZ4 commented Mar 28, 2024

I agree that for CI it's probably no issue to rebuild Enzyme, I was never bugged by that in Enzyme core.
Also not caching Rust is good because it has less conflict potential if I change Rust, which happens frequently.
I never changed the LLVM submodule, at most I added more C++ and Rust wrappers for LLVM functionality.
The build times for Rust are also usually in the range of 1-2 minutes (on 48 cores), so it should be well doable even in CI.

@jedbrown
Copy link
Author

🎉 We're at 22 seconds to restore the cached LLVM build (saves about 2 hours). That should automatically rebuild when src/llvm-project is updated (historically, one or two updates per month on rust-lang/rust@master). Building Enzyme and Rust stage1 from source takes 36 minutes. Perhaps acceptable, and I think we can improve it with caching, tuned depending on what changes faster.

@jedbrown
Copy link
Author

This is using rustbook@main now, and will cache Enzyme (as soon as we get a passing pipeline after fixing the regression). I think it's ready to merge so that any fixes or subsequent development have these tests.

@ZuseZ4 ZuseZ4 merged commit 518390f into EnzymeAD:master Mar 29, 2024
8 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants