Skip to content

Fix multi-cgu+debug builds using autodiff by delaying autodiff till lto#152496

Merged
rust-bors[bot] merged 1 commit intorust-lang:mainfrom
ZuseZ4:fix-autodiff-dbg-build
Feb 13, 2026
Merged

Fix multi-cgu+debug builds using autodiff by delaying autodiff till lto#152496
rust-bors[bot] merged 1 commit intorust-lang:mainfrom
ZuseZ4:fix-autodiff-dbg-build

Conversation

@ZuseZ4
Copy link
Member

@ZuseZ4 ZuseZ4 commented Feb 11, 2026

fixes: #152470

r? @bjorn3

@rustbot rustbot added A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. 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 Feb 11, 2026
@ZuseZ4 ZuseZ4 added the F-autodiff `#![feature(autodiff)]` label Feb 11, 2026
@rust-log-analyzer

This comment has been minimized.

@ZuseZ4 ZuseZ4 force-pushed the fix-autodiff-dbg-build branch from 6daf565 to f3db21d Compare February 11, 2026 18:56
@rust-log-analyzer

This comment has been minimized.

@ZuseZ4 ZuseZ4 force-pushed the fix-autodiff-dbg-build branch from f3db21d to c89a89b Compare February 11, 2026 19:09
// In the case of debug builds with multiple codegen units, we might not
// have all function definitions available during the early compiler
// invocations. We therefore wait for the final lto step to run Enzyme.
if (EnzymePtr && IsLTO) {
Copy link
Member Author

Choose a reason for hiding this comment

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

I could have checked for fat-lto only, since that's what we require atm. But it seems to work atm. and every once in a while I experiment with lowering our requirements from fat to thin lto, so I think it's fine.

@bjorn3
Copy link
Member

bjorn3 commented Feb 12, 2026

I had expected we already did this given that fat LTO is mandatory.

@bors r+

@rust-bors
Copy link
Contributor

rust-bors bot commented Feb 12, 2026

📌 Commit c89a89b has been approved by bjorn3

It is now in the queue for this repository.

@rust-bors rust-bors bot 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 Feb 12, 2026
@ZuseZ4
Copy link
Member Author

ZuseZ4 commented Feb 12, 2026

We used to, but the change from static/dynamic linking of Enzyme to dlopen broke it. I had forgotten to add the run-make autododiff tests to our docs, and we don't run them in CI by default, so we just didn't notice.

JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Feb 12, 2026
…jorn3

Fix multi-cgu+debug builds using autodiff by delaying autodiff till lto

fixes: rust-lang#152470

r? @bjorn3
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Feb 12, 2026
…jorn3

Fix multi-cgu+debug builds using autodiff by delaying autodiff till lto

fixes: rust-lang#152470

r? @bjorn3
rust-bors bot pushed a commit that referenced this pull request Feb 12, 2026
…uwer

Rollup of 11 pull requests

Successful merges:

 - #146901 (Support AVRTiny devices in AVR inline assembly)
 - #150988 (Improve code suggestion for incorrect macro_rules! usage)
 - #152422 (Change query proc macro to be more rust-analyzer friendly)
 - #152496 (Fix multi-cgu+debug builds using autodiff by delaying autodiff till lto)
 - #152520 (Don't use `DepContext` in `rustc_middle::traits::cache`)
 - #152528 (Support serializing CodegenContext)
 - #152082 (Move tests)
 - #152444 (`-Znext-solver` Prevent committing unfulfilled unsized coercion)
 - #152486 (remove redundant backchain attribute in codegen)
 - #152529 (sparc64: enable abi compatibility test)
 - #152548 (reject inline const patterns pre-expansion)
Zalathar added a commit to Zalathar/rust that referenced this pull request Feb 13, 2026
…jorn3

Fix multi-cgu+debug builds using autodiff by delaying autodiff till lto

fixes: rust-lang#152470

r? @bjorn3
rust-bors bot pushed a commit that referenced this pull request Feb 13, 2026
Rollup of 18 pull requests

Successful merges:

 - #150551 (Compute localized outlives constraints lazily)
 - #150752 (Update libc to v0.2.181)
 - #150988 (Improve code suggestion for incorrect macro_rules! usage)
 - #152422 (Change query proc macro to be more rust-analyzer friendly)
 - #152496 (Fix multi-cgu+debug builds using autodiff by delaying autodiff till lto)
 - #152514 (Collect active query jobs into struct `QueryJobMap`)
 - #152520 (Don't use `DepContext` in `rustc_middle::traits::cache`)
 - #152528 (Support serializing CodegenContext)
 - #152082 (Move tests)
 - #152232 (Add must_use for FileTimes)
 - #152329 (Simplify parallel! macro)
 - #152444 (`-Znext-solver` Prevent committing unfulfilled unsized coercion)
 - #152486 (remove redundant backchain attribute in codegen)
 - #152519 (Fix feature gating for new `try bikeshed` expressions)
 - #152529 (sparc64: enable abi compatibility test)
 - #152548 (reject inline const patterns pre-expansion)
 - #152550 (Port #[prelude_import] to the attribute parser)
 - #152552 (Add 2048-bit HvxVectorPair support to Hexagon SIMD ABI checks)
rust-bors bot pushed a commit that referenced this pull request Feb 13, 2026
Rollup of 17 pull requests

Successful merges:

 - #150551 (Compute localized outlives constraints lazily)
 - #150988 (Improve code suggestion for incorrect macro_rules! usage)
 - #152422 (Change query proc macro to be more rust-analyzer friendly)
 - #152496 (Fix multi-cgu+debug builds using autodiff by delaying autodiff till lto)
 - #152514 (Collect active query jobs into struct `QueryJobMap`)
 - #152520 (Don't use `DepContext` in `rustc_middle::traits::cache`)
 - #152528 (Support serializing CodegenContext)
 - #152082 (Move tests)
 - #152232 (Add must_use for FileTimes)
 - #152329 (Simplify parallel! macro)
 - #152444 (`-Znext-solver` Prevent committing unfulfilled unsized coercion)
 - #152486 (remove redundant backchain attribute in codegen)
 - #152519 (Fix feature gating for new `try bikeshed` expressions)
 - #152529 (sparc64: enable abi compatibility test)
 - #152548 (reject inline const patterns pre-expansion)
 - #152550 (Port #[prelude_import] to the attribute parser)
 - #152552 (Add 2048-bit HvxVectorPair support to Hexagon SIMD ABI checks)

Failed merges:

 - #152515 (Extract `DepKindVTable` constructors to their own module)
@rust-bors rust-bors bot merged commit 15e349d into rust-lang:main Feb 13, 2026
11 checks passed
@rustbot rustbot added this to the 1.95.0 milestone Feb 13, 2026
rust-timer added a commit that referenced this pull request Feb 13, 2026
Rollup merge of #152496 - ZuseZ4:fix-autodiff-dbg-build, r=bjorn3

Fix multi-cgu+debug builds using autodiff by delaying autodiff till lto

fixes: #152470

r? @bjorn3
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. F-autodiff `#![feature(autodiff)]` 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.

[autodiff] compiler error when differentiating functions (like powi)

4 participants