diff --git a/rust-version b/rust-version index 47552aee0..a7367c5c8 100644 --- a/rust-version +++ b/rust-version @@ -1 +1 @@ -4fa824bb78318a3cba8c7339d5754b4909922547 +4068bafedd8ba724e332a5221c06a6fa531a30d2 diff --git a/src/autodiff/debugging.md b/src/autodiff/debugging.md index 97893535c..7c7af8589 100644 --- a/src/autodiff/debugging.md +++ b/src/autodiff/debugging.md @@ -25,7 +25,7 @@ The actual numbers will depend on your code. ## 2) Check your llvm-ir reproducer -To confirm that your previous step worked, we will use llvm's `opt` tool. find your path to the opt binary, with a path similar to `/rust/build//build/bin/opt`. also find `llvmenzyme-19.` path, similar to `/rust/build/target-triple/enzyme/build/enzyme/llvmenzyme-19`. Please keep in mind that llvm frequently updates it's llvm backend, so the version number might be higher (20, 21, ...). Once you have both, run the following command: +To confirm that your previous step worked, we will use llvm's `opt` tool. Find your path to the opt binary, with a path similar to `/rust/build//ci-llvm/bin/opt`. If you build LLVM from source, you'll likely need to replace `ci-llvm` with `build`. Also find `llvmenzyme-21.` path, similar to `/rust/build/target-triple/enzyme/build/enzyme/llvmenzyme-21`. Please keep in mind that llvm frequently updates it's llvm backend, so the version number might be higher (20, 21, ...). Once you have both, run the following command: ```sh out.ll -load-pass-plugin=/path/to/build//stage1/lib/libEnzyme-21.so -passes="enzyme" -enzyme-strict-aliasing=0 -s diff --git a/src/autodiff/installation.md b/src/autodiff/installation.md index ddbb3a054..c9b6c85ab 100644 --- a/src/autodiff/installation.md +++ b/src/autodiff/installation.md @@ -8,7 +8,7 @@ First you need to clone and configure the Rust repository: ```bash git clone git@github.com:rust-lang/rust cd rust -./configure --enable-llvm-link-shared --enable-llvm-plugins --enable-llvm-enzyme --release-channel=nightly --enable-llvm-assertions --enable-clang --enable-lld --enable-option-checking --enable-ninja --disable-docs +./configure --release-channel=nightly --enable-llvm-enzyme --enable-llvm-assertions --enable-option-checking --disable-docs --set llvm.download-ci-llvm=true ``` Afterwards you can build rustc using: @@ -47,7 +47,7 @@ Then build rustc in a slightly altered way: ```bash git clone https://github.com/rust-lang/rust cd rust -./configure --enable-llvm-link-shared --enable-llvm-plugins --enable-llvm-enzyme --release-channel=nightly --enable-llvm-assertions --enable-clang --enable-lld --enable-option-checking --enable-ninja --disable-docs +./configure --release-channel=nightly --enable-llvm-enzyme --enable-llvm-assertions --enable-option-checking --disable-docs --set llvm.download-ci-llvm=true ./x dist ``` We then copy the tarball to our host. The dockerid is the newest entry under `docker ps -a`. @@ -84,5 +84,5 @@ cd build cmake .. -G Ninja -DLLVM_DIR=/llvm-project/build/lib/cmake/llvm/ -DLLVM_EXTERNAL_LIT=/llvm-project/llvm/utils/lit/lit.py -DCMAKE_BUILD_TYPE=Release -DCMAKE_EXPORT_COMPILE_COMMANDS=YES -DBUILD_SHARED_LIBS=ON ninja ``` -This will build Enzyme, and you can find it in `Enzyme/enzyme/build/lib/Enzyme.so`. (Endings might differ based on your OS). +This will build Enzyme, and you can find it in `Enzyme/enzyme/build/lib/Enzyme.so`. (Endings might differ based on your OS). diff --git a/src/borrow_check/moves_and_initialization/move_paths.md b/src/borrow_check/moves_and_initialization/move_paths.md index 95518fbc0..9ed4e67f6 100644 --- a/src/borrow_check/moves_and_initialization/move_paths.md +++ b/src/borrow_check/moves_and_initialization/move_paths.md @@ -67,8 +67,6 @@ We don't actually create a move-path for **every** [`Place`] that gets used. In particular, if it is illegal to move from a [`Place`], then there is no need for a [`MovePathIndex`]. Some examples: -- You cannot move from a static variable, so we do not create a [`MovePathIndex`] - for static variables. - You cannot move an individual element of an array, so if we have e.g. `foo: [String; 3]`, there would be no move-path for `foo[1]`. - You cannot move from inside of a borrowed reference, so if we have e.g. `foo: &String`, @@ -82,6 +80,18 @@ initialized (which lowers overhead). [`move_path_for`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir_dataflow/move_paths/builder/struct.MoveDataBuilder.html#method.move_path_for +## Projections + +Instead of using [`PlaceElem`], projections in move paths are stored as [`MoveSubPath`]s. +Projections that can't be moved out of and projections that can be skipped are not represented. + +Subslice projections of arrays (produced by slice patterns) are special; they're turned into +multiple [`ConstantIndex`] subpaths, one for each element in the subslice. + +[`PlaceElem`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/mir/type.PlaceElem.html +[`MoveSubPath`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir_dataflow/move_paths/enum.MoveSubPath.html +[`ConstantIndex`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir_dataflow/move_paths/enum.MoveSubPath.html#variant.ConstantIndex + ## Looking up a move-path If you have a [`Place`] and you would like to convert it to a [`MovePathIndex`], you