about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src/llvm/enzyme_ffi.rs
AgeCommit message (Collapse)AuthorLines
2025-09-19autodiff: typetree recursive depth query from enzyme with fallbackKaran Janthe-1/+0
Signed-off-by: Karan Janthe <karanjanthe@gmail.com>
2025-09-19autodiff: recurion added for typetreeKaran Janthe-0/+1
2025-09-19autodiff: fixed test to be more precise for type tree checkingKaran Janthe-0/+23
2025-09-19autodiff: f128 support added for typetreeKaran Janthe-1/+1
2025-09-19added typetree support for memcpyKaran Janthe-0/+1
2025-09-19Add TypeTree metadata attachment for autodiffKaran Janthe-1/+181
- Add F128 support to TypeTree Kind enum - Implement TypeTree FFI bindings and conversion functions - Add typetree.rs module for metadata attachment to LLVM functions - Integrate TypeTree generation with autodiff intrinsic pipeline - Support scalar types: f32, f64, integers, f16, f128 - Attach enzyme_type attributes as LLVM string metadata for Enzyme Signed-off-by: Karan Janthe <karanjanthe@gmail.com>
2025-09-15Make llvm_enzyme a regular cargo featurebjorn3-4/+4
This makes it clearer that it is set by the build system rather than by the rustc that compiles the current rustc. It also avoids bootstrap needing to pass --check-cfg llvm_enzyme to rustc.
2025-07-18add various wrappers for gpu code generationManuel Drehwald-1/+9
2025-07-07Remove unused allow attrsYotam Ofek-1/+0
2025-07-03setup CI and tidy to use typos for spellchecking and fix few typosklensy-1/+1
2025-06-25added PrintTAFn flag for autodiffKaran Janthe-0/+17
Signed-off-by: Karan Janthe <karanjanthe@gmail.com>
2025-04-28remove noinline attribute and add alwaysinline after AD passbit-aloo-2/+6
2025-04-25add llvm wrappers and corresponding methods in attributebit-aloo-0/+9
2025-04-05Rollup merge of #137880 - EnzymeAD:autodiff-batching, r=oli-obkStuart Cook-1/+3
Autodiff batching Enzyme supports batching, which is especially known from the ML side when training neural networks. There we would normally have a training loop, where in each iteration we would pass in some data (e.g. an image), and a target vector. Based on how close we are with our prediction we compute our loss, and then use backpropagation to compute the gradients and update our weights. That's quite inefficient, so what you normally do is passing in a batch of 8/16/.. images and targets, and compute the gradients for those all at once, allowing better optimizations. Enzyme supports batching in two ways, the first one (which I implemented here) just accepts a Batch size, and then each Dual/Duplicated argument has not one, but N shadow arguments. So instead of ```rs for i in 0..100 { df(x[i], y[i], 1234); } ``` You can now do ```rs for i in 0..100.step_by(4) { df(x[i+0],x[i+1],x[i+2],x[i+3], y[i+0], y[i+1], y[i+2], y[i+3], 1234); } ``` which will give the same results, but allows better compiler optimizations. See the testcase for details. There is a second variant, where we can mark certain arguments and instead of having to pass in N shadow arguments, Enzyme assumes that the argument is N times longer. I.e. instead of accepting 4 slices with 12 floats each, we would accept one slice with 48 floats. I'll implement this over the next days. I will also add more tests for both modes. For any one preferring some more interactive explanation, here's a video of Tim's llvm dev talk, where he presents his work. https://www.youtube.com/watch?v=edvaLAL5RqU I'll also add some other docs to the dev guide and user docs in another PR. r? ghost Tracking: - https://github.com/rust-lang/rust/issues/124509 - https://github.com/rust-lang/rust/issues/135283
2025-04-04add autodiff batching backendManuel Drehwald-1/+3
2025-03-25Reduce visibility of most items in `rustc_codegen_llvm`Daniel Paoliello-22/+22
2025-03-07Rollup merge of #137549 - oli-obk:llvm-ffi, r=davidtwcoMatthias Krüger-1/+2
Clean up various LLVM FFI things in codegen_llvm cc ```@ZuseZ4``` I touched some autodiff parts The major change of this PR is [bfd88ce](https://github.com/rust-lang/rust/pull/137549/commits/bfd88cead0dd79717f123ad7e9a26ecad88653cb) which makes `CodegenCx` generic just like `GenericBuilder` The other commits mostly took advantage of the new feature of making extern functions safe, but also just used some wrappers that were already there and shrunk unsafe blocks. best reviewed commit-by-commit
2025-02-25Fix enzyme build errorsVayun Biyani-2/+2
2025-02-24Mark more LLVM FFI as safeOli Scherer-1/+2
2025-02-22Auto merge of #137420 - matthiaskrgr:rollup-rr0q37f, r=matthiaskrgrbors-2/+2
Rollup of 9 pull requests Successful merges: - #136910 (Implement feature `isolate_most_least_significant_one` for integer types) - #137183 (Prune dead regionck code) - #137333 (Use `edition = "2024"` in the compiler (redux)) - #137356 (Ferris 🦀 Identifier naming conventions) - #137362 (Add build step log for `run-make-support`) - #137377 (Always allow reusing cratenum in CrateLoader::load) - #137388 (Fix(lib/fs/tests): Disable rename POSIX semantics FS tests under Windows 7) - #137410 (Use StableHasher + Hash64 for dep_tracking_hash) - #137413 (jubilee cleared out the review queue) r? `@ghost` `@rustbot` modify labels: rollup
2025-02-21update autodiff flagsManuel Drehwald-0/+94
2025-02-22Fix overcapturing, unsafe extern blocks, and new unsafe opsMichael Goulet-2/+2
2025-02-13cg_llvm: Reduce visibility of all functions in the llvm moduleDaniel Paoliello-13/+14
2025-01-31Add link attribute for Enzyme's FFIBen Kimock-2/+7
2025-01-29upstream rustc_codegen_ssa/rustc_middle changes for enzyme/autodiffManuel Drehwald-1/+3
2025-01-01upstream rustc_codegen_llvm changes for enzyme/autodiffManuel Drehwald-0/+29