rust/compiler/rustc_ast/src
Jacob Pratt c19c4b91f5
Rollup merge of #133429 - EnzymeAD:autodiff-middle, r=oli-obk
Autodiff Upstreaming - rustc_codegen_ssa, rustc_middle

This PR should not be merged until the rustc_codegen_llvm part is merged.
I will also alter it a little based on what get's shaved off from the cg_llvm PR,
and address some of the feedback I received in the other PR (including cleanups).

I am putting it already up to
1) Discuss with `@jieyouxu` if there is more work needed to add tests to this and
2) Pray that there is someone reviewing who can tell me why some of my autodiff invocations get lost.

Re 1: My test require fat-lto. I also modify the compilation pipeline. So if there are any other llvm-ir tests in the same compilation unit then I will likely break them. Luckily there are two groups who currently have the same fat-lto requirement for their GPU code which I have for my autodiff code and both groups have some plans to enable support for thin-lto. Once either that work pans out, I'll copy it over for this feature. I will also work on not changing the optimization pipeline for functions not differentiated, but that will require some thoughts and engineering, so I think it would be good to be able to run the autodiff tests isolated from the rest for now. Can you guide me here please?
For context, here are some of my tests in the samples folder: https://github.com/EnzymeAD/rustbook

Re 2: This is a pretty serious issue, since it effectively prevents publishing libraries making use of autodiff: https://github.com/EnzymeAD/rust/issues/173. For some reason my dummy code persists till the end, so the code which calls autodiff, deletes the dummy, and inserts the code to compute the derivative never gets executed. To me it looks like the rustc_autodiff attribute just get's dropped, but I don't know WHY? Any help would be super appreciated, as rustc queries look a bit voodoo to me.

Tracking:

- https://github.com/rust-lang/rust/issues/124509

r? `@jieyouxu`
2025-01-31 00:26:30 -05:00
..
attr rustc_ast: replace some len-checks + indexing with slice patterns etc. 🧹 2025-01-26 16:26:52 +00:00
expand upstream rustc_codegen_ssa/rustc_middle changes for enzyme/autodiff 2025-01-29 21:31:13 -05:00
util rustc_ast: replace some len-checks + indexing with slice patterns etc. 🧹 2025-01-26 16:26:52 +00:00
ast_traits.rs Remove needless returns detected by clippy in the compiler 2024-09-09 13:32:22 +02:00
ast.rs rustc_ast: replace some len-checks + indexing with slice patterns etc. 🧹 2025-01-26 16:26:52 +00:00
entry.rs remove support for the #[start] attribute 2025-01-21 06:59:15 -07:00
format.rs Account for format_args in HiddenUnicodeCodepoints lint 2024-12-31 05:03:22 +00:00
lib.rs Add hir::Attribute 2024-12-15 19:18:46 +01:00
mut_visit.rs Refactor FnKind variant to hold &Fn 2025-01-28 11:22:25 -08:00
node_id.rs Reformat use declarations. 2024-07-29 08:26:52 +10:00
ptr.rs Convert some Into impls into From impls 2024-12-31 01:56:33 +00:00
token.rs simplify similar_tokens from Vec<_> to &[_] 2025-01-23 11:45:42 +01:00
tokenstream.rs Overhaul TokenTreeCursor. 2024-12-18 12:50:22 +11:00
visit.rs Refactor FnKind variant to hold &Fn 2025-01-28 11:22:25 -08:00