Skip to content

Conversation

Hayden602
Copy link
Contributor

@Hayden602 Hayden602 commented Sep 5, 2025

…t" is automatically set.

closes: #142796

@rustbot
Copy link
Collaborator

rustbot commented Sep 5, 2025

r? @BoxyUwU

rustbot has assigned @BoxyUwU.
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-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Sep 5, 2025
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@Hayden602
Copy link
Contributor Author

r? @ZuseZ4 hi, please take a look at this PR,


/// Calculates the flavor of LTO to use for this compilation.
pub fn lto(&self) -> config::Lto {
// if autodiff is enabled, use fat lto
Copy link
Member

@ZuseZ4 ZuseZ4 Sep 17, 2025

Choose a reason for hiding this comment

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

Can you change this to explain why we do it? Something along the lines of

// Autodiff currently requires fat-lto to have access to the llvm-ir of all (indirectly) used functions and types. fat-lto is the easiest solution to this requirement, but quite expensive. FIXME(autodiff): Make autodiff also work with embed-bc instead of fat-lto.

When you change it, please update your last commit and force push, don't make a second commit just for doc changes.

Otherwise lgtm. Sorry for taking so long, I was traveling and wanted to test it locally.

Copy link
Member

@ZuseZ4 ZuseZ4 Sep 17, 2025

Choose a reason for hiding this comment

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

Also, while already at it, can you please remove the now unneeded (and already unused) error related to it? There's also a diagnostics in a .ftl file.

compiler/rustc_codegen_ssa/src/errors.rs
42:pub struct AutodiffWithoutLto;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay, I'll take care of this today.

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 have remove code:
#[derive(Diagnostic)]
#[diag(codegen_ssa_autodiff_without_lto)]
pub struct AutodiffWithoutLto;

I found, the AutodiffWithoutLto is declared but has never been used?

@rustbot
Copy link
Collaborator

rustbot commented Sep 18, 2025

Some changes occurred in compiler/rustc_codegen_ssa

cc @WaffleLapkin

@rustbot
Copy link
Collaborator

rustbot commented Sep 18, 2025

This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@rust-log-analyzer

This comment has been minimized.

@ZuseZ4
Copy link
Member

ZuseZ4 commented Sep 18, 2025

Thanks! Yes the error logic was removed during a previous refactoring, which Iirc made a little it harder to check for it. Since the plan was to enable lto automatically I didn't want to block a larger refactor based on it.

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Sep 18, 2025

📌 Commit 6e74905 has been approved by ZuseZ4

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-review Status: Awaiting review from the assignee but also interested parties. labels Sep 18, 2025
jhpratt added a commit to jhpratt/rust that referenced this pull request Sep 19, 2025
Automatically switch to lto-fat when flag RUSTFLAGS="- Zautodiff=Enable" is set

…t" is automatically set.

closes: [rust-lang#142796](rust-lang#142796)
bors added a commit that referenced this pull request Sep 19, 2025
Rollup of 8 pull requests

Successful merges:

 - #146229 (Automatically switch to lto-fat when flag RUSTFLAGS="- Zautodiff=Enable" is set)
 - #146615 (rustc_codegen_llvm: Feature Conversion Tidying)
 - #146638 (`rustc_next_trait_solver`: canonical out of `EvalCtxt`)
 - #146663 (Allow windows resource compiler to be overridden)
 - #146691 (std: Fix WASI implementation of `remove_dir_all`)
 - #146709 (stdarch subtree update)
 - #146731 (test: Use SVG for terminal url test)
 - #146738 (Fix tidy spellchecking on Windows)

r? `@ghost`
`@rustbot` modify labels: rollup
Zalathar added a commit to Zalathar/rust that referenced this pull request Sep 19, 2025
Automatically switch to lto-fat when flag RUSTFLAGS="- Zautodiff=Enable" is set

…t" is automatically set.

closes: [rust-lang#142796](rust-lang#142796)
bors added a commit that referenced this pull request Sep 19, 2025
Rollup of 10 pull requests

Successful merges:

 - #146229 (Automatically switch to lto-fat when flag RUSTFLAGS="- Zautodiff=Enable" is set)
 - #146484 (rustdoc-search: JavaScript optimization based on Firefox Profiler output)
 - #146541 (std: simplify host lookup)
 - #146615 (rustc_codegen_llvm: Feature Conversion Tidying)
 - #146638 (`rustc_next_trait_solver`: canonical out of `EvalCtxt`)
 - #146663 (Allow windows resource compiler to be overridden)
 - #146691 (std: Fix WASI implementation of `remove_dir_all`)
 - #146709 (stdarch subtree update)
 - #146738 (Fix tidy spellchecking on Windows)
 - #146740 (miri subtree update)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit ac9b55e into rust-lang:master Sep 19, 2025
10 checks passed
@rustbot rustbot added this to the 1.92.0 milestone Sep 19, 2025
rust-timer added a commit that referenced this pull request Sep 19, 2025
Rollup merge of #146229 - Hayden602:issue-142796-fix, r=ZuseZ4

Automatically switch to lto-fat when flag RUSTFLAGS="- Zautodiff=Enable" is set

…t" is automatically set.

closes: [#142796](#142796)
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Sep 20, 2025
Rollup of 10 pull requests

Successful merges:

 - rust-lang/rust#146229 (Automatically switch to lto-fat when flag RUSTFLAGS="- Zautodiff=Enable" is set)
 - rust-lang/rust#146484 (rustdoc-search: JavaScript optimization based on Firefox Profiler output)
 - rust-lang/rust#146541 (std: simplify host lookup)
 - rust-lang/rust#146615 (rustc_codegen_llvm: Feature Conversion Tidying)
 - rust-lang/rust#146638 (`rustc_next_trait_solver`: canonical out of `EvalCtxt`)
 - rust-lang/rust#146663 (Allow windows resource compiler to be overridden)
 - rust-lang/rust#146691 (std: Fix WASI implementation of `remove_dir_all`)
 - rust-lang/rust#146709 (stdarch subtree update)
 - rust-lang/rust#146738 (Fix tidy spellchecking on Windows)
 - rust-lang/rust#146740 (miri subtree update)

r? `@ghost`
`@rustbot` modify labels: rollup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RUSTFLAGS="-Zautodiff=Enable" should enable fat-lto
6 participants