Skip to content

Commit dc71569

Browse files
authored
Merge pull request #3 from bytesnake/fix/llvm-headers
Add LLVM header requirements to README
2 parents 5d45523 + 43f54eb commit dc71569

File tree

3 files changed

+28
-14
lines changed

3 files changed

+28
-14
lines changed

.packaging/rust/README.md

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,26 @@
1-
# Goal
1+
# Enzyme build helper
2+
3+
## Goal
4+
25
This repository will build enzyme/llvm/clang/rustc in the right configuration such that you can use it in combination with [oxide-enzyme](https://github.com/rust-ml/oxide-enzyme).
36

4-
# Requirements
5-
git
6-
ninja
7-
cmake
8-
Rust (rustup)
9-
~10GB free storage in $HOME/.config
7+
## Requirements
8+
9+
- git
10+
- ninja
11+
- cmake
12+
- Rust (rustup)
13+
- ~10GB free storage in $HOME/.cache
14+
15+
## Usage
16+
17+
Build LLVM, the Rust toolchain and Enzyme with
1018

11-
# Usage
12-
$ git clone https://github.com/ZuseZ4/enzyme_build
13-
$ cd enzyme_build
14-
$ cargo run --release
19+
```bash
20+
$ git clone https://github.com/ZuseZ4/enzyme_build
21+
$ cd enzyme_build
22+
$ cargo run --release
23+
```
1524

1625
Depending on your CPU this might take a few hours.
1726
The build process will run enzyme tests, so your last output should look similar to these lines:
@@ -20,8 +29,8 @@ Testing Time: 0.63s
2029
Passed : 240
2130
Expectedly Failed: 5
2231

23-
# Extras
24-
- Q: Can I use some other location to store everyting?
32+
## Extras
33+
- Q: Can I use some other location to store everything?
2534
- A: We will add an option for that later. If it's urgent please open an issue or ping me (Manuel Drehwald) on the rust-ml Zulip.
2635
 
2736
- Q: It fails some (all) tests or the build breaks even earlier. Help?

.packaging/rust/src/generate_api.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ pub fn generate_bindings() -> Result<(), String> {
1212

1313
let bindings = bindgen::Builder::default()
1414
.header_contents("CApi.hpp", &content) // read it as .hpp so bindgen can ignore the class successfully
15+
.clang_args(&[
16+
format!("-I{}", utils::get_llvm_header_path().display())
17+
])
1518
//.blacklist_item("CustomFunctionForward")
1619
//.blacklist_item("DiffeGradientUtils")
1720
.allowlist_type("CConcreteType")

.packaging/rust/src/utils.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,9 @@ pub fn get_rustc_binary_path() -> PathBuf {
7777
pub fn get_llvm_build_path() -> PathBuf {
7878
get_rustc_platform_path().join("llvm").join("build")
7979
}
80-
80+
pub fn get_llvm_header_path() -> PathBuf {
81+
get_rustc_platform_path().join("llvm").join("include")
82+
}
8183
pub fn get_remote_enzyme_tarball_path() -> String {
8284
format!(
8385
"https://github.com/wsmoses/Enzyme/archive/refs/tags/v{}.tar.gz",

0 commit comments

Comments
 (0)