Skip to content

Commit b26ecb5

Browse files
qwang98Schaeff
andauthored
fix: Expose CUDA primitives (#2179)
When building autoprecompile chips in GPU in `powdr-labs/powdr`, we need access to `histogram.cuh` in `openvm/circuit-primitives` to modify counts of periphery chips. This requires exporting include dir in `openvm/circuit-primitives` for downstream crates (`powdr-openvm`). We believe this (and potentially other crates) to be general client extension usage. The way we export `openvm/circuit-primitives` to `powdr-labs/powdr-openvm` is EXACTLY the same as how `stark-backend/cuda-common` is exported to `openvm`: - https://github.com/openvm-org/stark-backend/blob/main/crates/cuda-common/build.rs#L18-L19 - https://github.com/openvm-org/stark-backend/blob/main/crates/cuda-common/Cargo.toml#L7 --------- Co-authored-by: Schaeff <[email protected]>
1 parent a76a9d0 commit b26ecb5

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

crates/circuits/primitives/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ edition.workspace = true
77
homepage.workspace = true
88
repository.workspace = true
99
license.workspace = true
10+
links = "circuit-primitives-cuda"
1011

1112
[dependencies]
1213
openvm-stark-backend = { workspace = true }

crates/circuits/primitives/build.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
#[cfg(feature = "cuda")]
2+
use std::{env, path::PathBuf};
3+
14
#[cfg(feature = "cuda")]
25
use openvm_cuda_builder::{cuda_available, CudaBuilder};
36

@@ -17,5 +20,11 @@ fn main() {
1720

1821
builder.emit_link_directives();
1922
builder.build();
23+
24+
// Export include dir for downstream crates:
25+
let include_path = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap())
26+
.join("cuda")
27+
.join("include");
28+
println!("cargo:include={}", include_path.display()); // -> DEP_CIRCUIT_PRIMITIVES_CUDA_INCLUDE
2029
}
2130
}

0 commit comments

Comments
 (0)