-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Fix enzyme build errors #137713
Merged
Merged
Fix enzyme build errors #137713
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Failed to set assignee to
|
oli-obk
reviewed
Feb 27, 2025
oli-obk
approved these changes
Feb 27, 2025
This comment has been minimized.
This comment has been minimized.
e2d7d42
to
c85f038
Compare
@bors r+ rollup |
🌲 The tree is currently closed for pull requests below priority 100. This pull request will be tested once the tree is reopened. |
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Feb 28, 2025
Rollup of 9 pull requests Successful merges: - rust-lang#136424 (fix: overflowing bin hex) - rust-lang#136824 (solver cycles are coinductive once they have one coinductive step) - rust-lang#137220 (Support `rust.channel = "auto-detect"`) - rust-lang#137712 (Clean up TypeckResults::extract_binding_mode) - rust-lang#137713 (Fix enzyme build errors) - rust-lang#137748 (Fix method name in `TyCtxt::hir_crate()` documentation) - rust-lang#137778 (update enzyme to handle range metadata) - rust-lang#137780 (Fix typo in query expansion documentation) - rust-lang#137788 (Bump `rustc_{codegen_ssa,llvm}` `cc` to 1.2.16 to fix `x86` Windows jobs on newest Windows SDK) r? `@ghost` `@rustbot` modify labels: rollup
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Feb 28, 2025
Rollup merge of rust-lang#137713 - vayunbiyani:fix-enzyme-build-errors, r=oli-obk Fix enzyme build errors After [this PR](rust-lang#136428) was merged, I switched to master and attempted building `./x.py build --stage 1 library` with the config mentioned in the enzyme rustbook but it resulted in some errors tho the config.example.toml build succeeded The errors were re: ### 1. Use of ref in match patterns The errors were related to match ergonomics in Rust 2024, where ref is no longer needed when matching on references. Examples: ``` error: binding modifiers may only be written when the default binding mode is `move` --> compiler/rustc_builtin_macros/src/autodiff.rs:136:31 | 136 | Annotatable::Item(ref iitem) => { | ^^^ binding modifier not allowed under `ref` default binding mode | = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> note: matching on a reference type with a non-reference pattern changes the default binding mode --> compiler/rustc_builtin_macros/src/autodiff.rs:136:13 | 136 | Annotatable::Item(ref iitem) => { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this matches on type `&_` help: remove the unnecessary binding modifier | 136 - Annotatable::Item(ref iitem) => { 136 + Annotatable::Item(iitem) => { | error: binding modifiers may only be written when the default binding mode is `move` --> compiler/rustc_builtin_macros/src/autodiff.rs:146:36 | 146 | Annotatable::AssocItem(ref assoc_item, _) => { | ^^^ binding modifier not allowed under `ref` default binding mode | = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> note: matching on a reference type with a non-reference pattern changes the default binding mode --> compiler/rustc_builtin_macros/src/autodiff.rs:146:13 | 146 | Annotatable::AssocItem(ref assoc_item, _) => { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this matches on type `&_` help: remove the unnecessary binding modifier | 146 - Annotatable::AssocItem(ref assoc_item, _) => { 146 + Annotatable::AssocItem(assoc_item, _) => { | error: binding modifiers may only be written when the default binding mode is `move` --> compiler/rustc_builtin_macros/src/autodiff.rs:174:31 | 174 | ... Annotatable::Item(ref iitem) => (iitem.vis.clone(), iitem.ide... | ^^^ binding modifier not allowed under `ref` default binding mode | = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> note: matching on a reference type with a non-reference pattern changes the default binding mode --> compiler/rustc_builtin_macros/src/autodiff.rs:174:13 | 174 | ... Annotatable::Item(ref iitem) => (iitem.vis.clone(), iitem.ident.c... | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this matches on type `&_` help: remove the unnecessary binding modifier | 174 - Annotatable::Item(ref iitem) => (iitem.vis.clone(), iitem.ident.clone()), 174 + Annotatable::Item(iitem) => (iitem.vis.clone(), iitem.ident.clone()), | error: binding modifiers may only be written when the default binding mode is `move` --> compiler/rustc_builtin_macros/src/autodiff.rs:175:36 | 175 | Annotatable::AssocItem(ref assoc_item, _) => { | ^^^ binding modifier not allowed under `ref` default binding mode | = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> note: matching on a reference type with a non-reference pattern changes the default binding mode --> compiler/rustc_builtin_macros/src/autodiff.rs:175:13 | 175 | Annotatable::AssocItem(ref assoc_item, _) => { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this matches on type `&_` help: remove the unnecessary binding modifier | 175 - Annotatable::AssocItem(ref assoc_item, _) => { 175 + Annotatable::AssocItem(assoc_item, _) => { | error: could not compile `rustc_builtin_macros` (lib) due to 4 previous errors warning: build failed, waiting for other jobs to finish... Build completed unsuccessfully in 0:19:39 ``` ### 2. the use of external C blocks without unsafe in compiler/rustc_codegen_llvm/src/llvm/enzyme_ffi.rs (I don't have the error message handy) The first commit fixes the errors above --- ## Additional Improvement: `@ZuseZ4` suggested we consolidate the variants under `#[cfg(llvm_enzyme)]` and `#[cfg(not(llvm_enzyme))]` by conditionally checking for `cfg!(llvm_enzyme)` instead. This way, the autodiff code is compiled but not executed avoiding such regressions r? `@ZuseZ4` cc: `@oli-obk`
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
After this PR was merged, I switched to master and attempted building
./x.py build --stage 1 library
with the config mentioned in the enzyme rustbook but it resulted in some errors tho the config.example.toml build succeededThe errors were re:
1. Use of ref in match patterns
The errors were related to match ergonomics in Rust 2024, where ref is no longer needed when matching on references. Examples:
2. the use of external C blocks without unsafe in compiler/rustc_codegen_llvm/src/llvm/enzyme_ffi.rs (I don't have the error message handy)
The first commit fixes the errors above
Additional Improvement:
@ZuseZ4 suggested we consolidate the variants under
#[cfg(llvm_enzyme)]
and#[cfg(not(llvm_enzyme))]
by conditionally checking forcfg!(llvm_enzyme)
instead. This way, the autodiff code is compiled but not executed avoiding such regressionsr? @ZuseZ4
cc: @oli-obk