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

improvements towards building enzyme in CI #136428

Merged
merged 5 commits into from
Feb 22, 2025

Conversation

ZuseZ4
Copy link
Contributor

@ZuseZ4 ZuseZ4 commented Feb 2, 2025

  1. This PR fixes a significant compile-time regression, by only running the expensive autodiff pipeline, if the users pass the newly introduced Enable value to the -Zautodiff= flag. It updates the test(s) accordingly. It gives a nice error if users forget that.
  2. It fixes macos support by explicitly linking against the Enzyme build folder. This doesn't cover CI macos yet.
  3. It fixes the issue that setting ENZYME_RUNPASS was ignored by enzyme and in fact did not schedule enzyme's opt pass.
  4. It also re-enables support for various other values for the autodiff flag, which were ignored since the refactor.
  5. I merged some improvements to Enzyme core, which means we do not longer depend on LLVM being build with the Plugin Interface enabled.
  6. Unrelated to other fixes, this changes rustc_autodiff to EncodeCrossCrate::Yes. It is not enough on it's own to enable usage of Enzyme in libraries, but it is for sure a piece of the fixes needed to get this to work.

try-job: x86_64-gnu

r? @oli-obk

Tracking:

@rustbot
Copy link
Collaborator

rustbot commented Feb 2, 2025

r? @Mark-Simulacrum

rustbot has assigned @Mark-Simulacrum.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@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 Feb 2, 2025
@rustbot
Copy link
Collaborator

rustbot commented Feb 2, 2025

This PR modifies config.example.toml.

If appropriate, please update CONFIG_CHANGE_HISTORY in src/bootstrap/src/utils/change_tracker.rs.

@ZuseZ4
Copy link
Contributor Author

ZuseZ4 commented Feb 2, 2025

ok rustbot, thanks for your opinion. I will however wtick with r? @oli-obk

@rustbot rustbot assigned oli-obk and unassigned Mark-Simulacrum Feb 2, 2025
@lqd
Copy link
Member

lqd commented Feb 2, 2025

CI doesn't use config.example.toml. As you can see in the file, this is all commented out values explaining the defaults of these attributes. It is a base people use to create a new config file if you don't have one.

@ZuseZ4
Copy link
Contributor Author

ZuseZ4 commented Feb 2, 2025

Yes I know how they work, I just assumed that one of the ci runners would use a configure command which doesn't explicitly sets enzyme, and then the change would have worked. So I guess I have to look into one of the build scritps instead :/

@Kobzol
Copy link
Contributor

Kobzol commented Feb 2, 2025

You have to select a CI job where you want the tests to run and then configure it to enable these config.toml options, using e.g. --set (

--set rust.thin-lto-import-instr-limit=10
).

@rustbot rustbot added A-testsuite Area: The testsuite used to check the correctness of rustc T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue. labels Feb 2, 2025
@ZuseZ4
Copy link
Contributor Author

ZuseZ4 commented Feb 2, 2025

Thanks. I want one of the builders which compiles the src/llvm-project llvm, and does not reuse an existing one. It looks like this is one of them, correct?

@workingjubilee
Copy link
Member

@bors try

bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 3, 2025
test building enzyme in CI

We will later need to make it more granular before merging, but let's start by figuring out how many things we break right now in the first place.

For now I modified `src/ci/docker/host-x86_64/dist-x86_64-linux/Dockerfile`, so let's try that dist job first.

try-job: dist-x86_64-linux

r? `@oli-obk`

Tracking:

- rust-lang#124509
@bors
Copy link
Contributor

bors commented Feb 3, 2025

⌛ Trying commit f15f626 with merge cd73423...

@bors
Copy link
Contributor

bors commented Feb 3, 2025

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

@tgross35
Copy link
Contributor

tgross35 commented Feb 3, 2025

@rust-timer queue

@rust-timer

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Feb 3, 2025
@tgross35
Copy link
Contributor

tgross35 commented Feb 3, 2025

Whoops

@rust-timer build cd73423

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (cd73423): comparison URL.

Overall result: ❌✅ regressions and improvements - please read the text below

Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf.

Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @rustbot label: +perf-regression-triaged along with sufficient written justification. If you cannot justify the regressions please fix the regressions and do another perf run. If the next run shows neutral or positive results, the label will be automatically removed.

@bors rollup=never
@rustbot label: -S-waiting-on-perf +perf-regression

Instruction count

This is the most reliable metric that we have; it was used to determine the overall result at the top of this comment. However, even this metric can sometimes exhibit noise.

mean range count
Regressions ❌
(primary)
1.6% [0.3%, 3.2%] 230
Regressions ❌
(secondary)
1.3% [0.2%, 2.6%] 197
Improvements ✅
(primary)
-2.8% [-9.3%, -0.4%] 40
Improvements ✅
(secondary)
-5.2% [-15.6%, -0.7%] 7
All ❌✅ (primary) 0.9% [-9.3%, 3.2%] 270

Max RSS (memory usage)

Results (primary -3.5%, secondary -2.0%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
1.1% [0.7%, 2.0%] 5
Improvements ✅
(primary)
-3.5% [-3.7%, -3.4%] 2
Improvements ✅
(secondary)
-3.2% [-6.3%, -1.3%] 13
All ❌✅ (primary) -3.5% [-3.7%, -3.4%] 2

Cycles

Results (primary -1.1%, secondary -3.1%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
1.3% [0.8%, 1.7%] 30
Regressions ❌
(secondary)
1.6% [1.6%, 1.7%] 2
Improvements ✅
(primary)
-3.2% [-8.3%, -1.0%] 34
Improvements ✅
(secondary)
-4.6% [-10.9%, -1.2%] 6
All ❌✅ (primary) -1.1% [-8.3%, 1.7%] 64

Binary size

Results (primary -1.0%, secondary -2.3%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-1.0% [-2.8%, -0.1%] 70
Improvements ✅
(secondary)
-2.3% [-3.5%, -0.7%] 76
All ❌✅ (primary) -1.0% [-2.8%, -0.1%] 70

Bootstrap: 777.802s -> 763.65s (-1.82%)
Artifact size: 328.69 MiB -> 322.91 MiB (-1.76%)

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Feb 3, 2025
@jieyouxu jieyouxu mentioned this pull request Feb 3, 2025
7 tasks
@Kobzol
Copy link
Contributor

Kobzol commented Feb 3, 2025

This builder does build LLVM (like 5 times xD), but it does not really run normal tests, so it's not a good fit.

Now, why the hell does enabling LLVM plugins improve bootstrap time and reduce compiler binary size, wtf.

@ZuseZ4
Copy link
Contributor Author

ZuseZ4 commented Feb 3, 2025

I noticed 3 and was already wondering.
Do you have suggestions for a better build? It should be one which builds src/llvm

@Kobzol
Copy link
Contributor

Kobzol commented Feb 3, 2025

I would say x86_64-gnu.

@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Contributor

bors commented Feb 22, 2025

💔 Test failed - checks-actions

@bors bors added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Feb 22, 2025
@rust-log-analyzer

This comment has been minimized.

@ZuseZ4
Copy link
Contributor Author

ZuseZ4 commented Feb 22, 2025

cc @saethlin
https://github.com/rust-lang/rust/pull/136428/files#diff-37e9c44cff55695f4c7497a9eba475172f70c46dfb3a6741a0adc6ca40071c59
and
https://github.com/rust-lang/rust/pull/136428/files#diff-eac3d5ef63f39b7914ae9015f31b8d87353ea8fbcd5b02a7335dd86c557e7625
Add some new things to link against. It looks like you only care about me linking against LLVM and not Enzyme, so probably they don't need annotations? But I thought I ping you to be sure.

@saethlin
Copy link
Member

saethlin commented Feb 22, 2025

Don't worry about making the compiler build with -Zcross-crate-inline-threshold=always, I'll just fix it after the fact if it breaks :)

@ZuseZ4
Copy link
Contributor Author

ZuseZ4 commented Feb 22, 2025

@oli-obk This is ready to be merged, let me know if you want any changes.

quickly testing a build from scratch, I think due to the LLVM upgrade I had some stale artifacts.

Edit2: I can confirm that my issues where only due to having LLVM19 and LLVM20 in the same build folder, since I rebased the final PR and the artifacts got mixed up by bootstrap. Deleting the build dir and starting a clean build fixed all issues.

So this is indeed ready to merge.

@oli-obk
Copy link
Contributor

oli-obk commented Feb 22, 2025

@bors r+

@bors
Copy link
Contributor

bors commented Feb 22, 2025

📌 Commit 49e9630 has been approved by oli-obk

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. S-blocked Status: Blocked on something else such as an RFC or other implementation work. labels Feb 22, 2025
@bors
Copy link
Contributor

bors commented Feb 22, 2025

⌛ Testing commit 49e9630 with merge 8dac72b...

@bors
Copy link
Contributor

bors commented Feb 22, 2025

☀️ Test successful - checks-actions
Approved by: oli-obk
Pushing 8dac72b to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Feb 22, 2025
@bors bors merged commit 8dac72b into rust-lang:master Feb 22, 2025
7 checks passed
@rustbot rustbot added this to the 1.87.0 milestone Feb 22, 2025
@Kobzol
Copy link
Contributor

Kobzol commented Feb 22, 2025

This PR didn't actually start testing Enzyme on CI, right? So the PR title should be updated.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (8dac72b): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

This benchmark run did not return any relevant results for this metric.

Cycles

This benchmark run did not return any relevant results for this metric.

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 773.139s -> 773.405s (0.03%)
Artifact size: 361.03 MiB -> 361.04 MiB (0.00%)

@rustbot rustbot removed the perf-regression Performance regression. label Feb 22, 2025
@ZuseZ4 ZuseZ4 changed the title test building enzyme in CI improvements towards building enzyme in CI Feb 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-testsuite Area: The testsuite used to check the correctness of rustc merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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.