Auto merge of #86267 - ZuseZ4:master, r=nagisa
Allow loading of llvm plugins on nightly
Based on a discussion in #82734 / with `@wsmoses.`
Mainly moves [this](0149bc4e7e
) behind a -Z flag, so it can only be used on nightly,
as requested by `@nagisa` in https://github.com/rust-lang/rust/issues/82734#issuecomment-835863940
This change allows loading of llvm plugins like Enzyme.
Right now it also requires a shared library LLVM build of rustc for symbol resolution.
```rust
// test.rs
extern { fn __enzyme_autodiff(_: usize, ...) -> f64; }
fn square(x : f64) -> f64 {
return x * x;
}
fn main() {
unsafe {
println!("Hello, world {} {}!", square(3.0), __enzyme_autodiff(square as usize, 3.0));
}
}
```
```
./rustc test.rs -Z llvm-plugins="./LLVMEnzyme-12.so" -C passes="enzyme"
./test
Hello, world 9 6!
```
I will try to figure out how to simplify the usage and get this into stable in a later iteration,
but having this on nightly will already help testing further steps.
This commit is contained in:
commit
a1411de9de
3 changed files with 17 additions and 0 deletions
|
@ -1129,6 +1129,8 @@ options! {
|
|||
"link native libraries in the linker invocation (default: yes)"),
|
||||
link_only: bool = (false, parse_bool, [TRACKED],
|
||||
"link the `.rlink` file generated by `-Z no-link` (default: no)"),
|
||||
llvm_plugins: Vec<String> = (Vec::new(), parse_list, [TRACKED],
|
||||
"a list LLVM plugins to enable (space separated)"),
|
||||
llvm_time_trace: bool = (false, parse_bool, [UNTRACKED],
|
||||
"generate JSON tracing data file from LLVM data (default: no)"),
|
||||
ls: bool = (false, parse_bool, [UNTRACKED],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue