Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding rust ADBench version #1797

Open
wants to merge 57 commits into
base: main
Choose a base branch
from
Open

adding rust ADBench version #1797

wants to merge 57 commits into from

Conversation

ZuseZ4
Copy link
Member

@ZuseZ4 ZuseZ4 commented Mar 19, 2024

Usage for Rust side

export ENZYME_LOOSE_TYPES=1

cargo +enzyme run --release
Comipling a lib.so to use from C:
cargo +enzyme rustc --release --lib --crate-type=cdylib

@ZuseZ4 ZuseZ4 requested a review from wsmoses March 19, 2024 04:13
@ZuseZ4
Copy link
Member Author

ZuseZ4 commented Mar 19, 2024

Usage instruction: cargo +enzyme build
fails with

  todo - hook in rust allocation fns
  UNREACHABLE executed at /h/344/drehwald/prog/rust/src/tools/enzyme/enzyme/Enzyme/GradientUtils.cpp:9107!

llvm_unreachable("todo - hook in rust allocation fns");

@ZuseZ4
Copy link
Member Author

ZuseZ4 commented Mar 19, 2024

printing the module before AD (with a few helping infos at the end)
err.ll.txt

@ZuseZ4 ZuseZ4 changed the title adding gmm adding rust ADBench version Apr 3, 2024
@@ -127,6 +127,19 @@ extern "C" {
double* reproj_err,
double* w_err
);

void rust2_ba_objective(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

weak symbol variant of this.

-> running these doesn't require rust.

%-opt.ll: %-raw.ll
opt $^ -o $@ -S
#opt $^ -O2 -o $@ -S
$(dir)/benchmarks/ReverseMode/ba/target/release/libbars.a: src/lib.rs Cargo.toml
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if this can be optional?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What would you like this variable to use when determining if Rust is enabled? We could run cargo +enzyme version (checking whether a toolchain named enzyme is configured) and/or we could have an environment variable to be set (by CMake or otherwise).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants