Skip to content

Fix typetree generation for differentiated functions#158333

Draft
ZuseZ4 wants to merge 2 commits into
rust-lang:mainfrom
ZuseZ4:typetrees-for-enzyme3
Draft

Fix typetree generation for differentiated functions#158333
ZuseZ4 wants to merge 2 commits into
rust-lang:mainfrom
ZuseZ4:typetrees-for-enzyme3

Conversation

@ZuseZ4

@ZuseZ4 ZuseZ4 commented Jun 23, 2026

Copy link
Copy Markdown
Member

Further improvements after #158278
This fixes a test failure on main (encountered while working on the PR above) in tests/codegen-llvm/autodiff/autodiffv2.rs.

Further improvements are split out into #158440

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

rustbot commented Jun 23, 2026

Copy link
Copy Markdown
Collaborator

r? @mu001999

rustbot has assigned @mu001999.
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

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler, types
  • compiler, types expanded to 73 candidates
  • Random selection from 20 candidates

@ZuseZ4

ZuseZ4 commented Jun 23, 2026

Copy link
Copy Markdown
Member Author

r? oli-obk

@rustbot rustbot assigned oli-obk and unassigned mu001999 Jun 23, 2026
@rustbot

rustbot commented Jun 25, 2026

Copy link
Copy Markdown
Collaborator

⚠️ Warning ⚠️

@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

The job tidy failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
Diff in /checkout/compiler/rustc_codegen_ssa/src/traits/builder.rs:2:
 use std::ops::Deref;
 
 use rustc_abi::{Align, Scalar, Size, WrappingRange};
-use rustc_ast::expand::typetree::{TypeTree, FncTree};
+use rustc_ast::expand::typetree::{FncTree, TypeTree};
 use rustc_hir::attrs::AttributeKind;
 use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrs;
 use rustc_middle::mir;
Diff in /checkout/compiler/rustc_codegen_ssa/src/traits/builder.rs:525:
             with_no_trimmed_paths!({
                 eprintln!("memcpy ty = {:?}", layout.ty);
             });
-            let fnc_tree = FncTree {
-                args: vec![tt.clone(), tt],
-                ret: TypeTree::new(),
-            };
+            let fnc_tree = FncTree { args: vec![tt.clone(), tt], ret: TypeTree::new() };
             let bytes = self.const_usize(layout.size.bytes());
             self.memcpy(dst.llval, dst.align, src.llval, src.align, bytes, flags, Some(fnc_tree));
         }
Diff in /checkout/compiler/rustc_codegen_llvm/src/typetree.rs:183:
         let ret_attr = llvm::CreateAttrStringValueFromCStr(llcx, &c_attr_name, &c_str);
 
         if unsafe { llvm::LLVMRustIsIntrinsicCall(fn_def) } {
-            attributes::apply_to_callsite(
-                fn_def,
-                llvm::AttributePlace::ReturnValue,
-                &[ret_attr],
-            );
+            attributes::apply_to_callsite(fn_def, llvm::AttributePlace::ReturnValue, &[ret_attr]);
         } else {
             attributes::apply_to_llfn(fn_def, llvm::AttributePlace::ReturnValue, &[ret_attr]);
         }
fmt: checked 6938 files
Bootstrap failed while executing `test src/tools/tidy tidyselftest --extra-checks=py,cpp,js,spellcheck`
Build completed unsuccessfully in 0:00:51
  local time: Thu Jun 25 00:11:47 UTC 2026

@ZuseZ4

ZuseZ4 commented Jun 25, 2026

Copy link
Copy Markdown
Member Author

Doesn't look like Github CI will merge the previous PR anytime soon, so I'll add a few more features here in the meantime.

@ZuseZ4 ZuseZ4 marked this pull request as draft June 25, 2026 00:15
@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 25, 2026
@rust-bors

This comment has been minimized.

@ZuseZ4 ZuseZ4 force-pushed the typetrees-for-enzyme3 branch 2 times, most recently from 3227538 to 64d9d50 Compare June 26, 2026 10:59
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-author Status: This is awaiting some action (such as code changes or more information) from the author. 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.

5 participants