EnzymeAD / rust

A rust fork to work towards Enzyme integration
https://www.rust-lang.org
Other
67 stars 9 forks source link

eprintln! thread error #139

Closed jpmedinagl closed 2 months ago

jpmedinagl commented 2 months ago

When trying to autodiff a function that has the eprintln! macro, there is an error:

error: <unknown>:0:0: in function preprocess_eprintfunc void (): Enzyme: No create nofree of unknown value
@__cxa_thread_atexit_impl = extern_weak global i8
 at context:   call void @_ZN3std2io5stdio7_eprint17h1ff923295f510774E(ptr noalias nocapture noundef nonnull align 8 dereferenceable(48) %1) #110

I tried creating a minimal reproducible with ENZYME_OPT=1 and llvm-extract for the enzyme explorer (out.txt) but the explorer gives a slightly different error

error: <unknown>:0:0: in function preprocess__ZN3std2io5stdio31print_to_buffer_if_capture_used17hf768171844a00e61E i1 (ptr): Enzyme: cannot compute with global variable that doesn't have marked shadow global
@_ZN3std2io5stdio14OUTPUT_CAPTURE7__getit5__KEY17h15828b3e0884a413E.llvm.11955502528429326793 = external hidden thread_local global <{ [8 x i8], [8 x i8], [1 x i8], [7 x i8] }>, align 8

Not sure if its the same error.

Below is the rust file and cargo. Generated the error with cargo +enzyme build --release --bin file

#![feature(autodiff)]

#[no_mangle]
#[autodiff(diff, Reverse)]
fn eprintfunc() {
    eprintln!("eprintln error");
}

fn main() {
    diff();
}
[package]
name = "lib"
version = "0.1.0"
edition = "2021"

[profile.release]
lto = "fat"

[[bin]]
name = "file"
path = "file.rs"
wsmoses commented 2 months ago

This should probably just be marked as inactive

On Thu, Jul 25, 2024 at 3:00 PM JP @.***> wrote:

When trying to autodiff a function that has the eprintln! macro, there is an error:

@__cxa_thread_atexit_impl = extern_weak global i8 at context: call void @_ZN3std2io5stdio7_eprint17h1ff923295f510774E(ptr noalias nocapture noundef nonnull align 8 dereferenceable(48) %1) #110```

I tried creating a minimal reproducible with ENZYME_OPT=1 and llvm-extract for the enzyme explorer (out.txt) but the explorer gives a slightly different error


@_ZN3std2io5stdio14OUTPUT_CAPTURE7__getit5__KEY17h15828b3e0884a413E.llvm.11955502528429326793 = external hidden thread_local global <{ [8 x i8], [8 x i8], [1 x i8], [7 x i8] }>, align 8```

Not sure if its the same error.

Below is the rust file and cargo. Generated the error with `cargo +enzyme build --release --bin file`

```#![feature(autodiff)]

#[no_mangle]
#[autodiff(diff, Reverse)]
fn eprintfunc() {
    eprintln!("eprintln error");
}

fn main() {
    diff();
}```

```[package]
name = "lib"
version = "0.1.0"
edition = "2021"

[profile.release]
lto = "fat"

[[bin]]
name = "file"
path = "file.rs"```

—
Reply to this email directly, view it on GitHub
<https://github.com/EnzymeAD/rust/issues/139>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAJTUXDDLUP2E6KBC3BPWK3ZOFDMNAVCNFSM6AAAAABLPEHEM2VHI2DSMVQWIX3LMV43ASLTON2WKOZSGQZTANZZGQ4TQNQ>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
ZuseZ4 commented 2 months ago

https://github.com/EnzymeAD/Enzyme/blob/cdd8187ef4bea1e0d3daf61d8a19767cf8a95373/enzyme/Enzyme/ActivityAnalysis.cpp#L108

try if you can add it to one of these functions

ZuseZ4 commented 2 months ago

closed by https://github.com/EnzymeAD/Enzyme/pull/2022