This is an automated email from the ASF dual-hosted git repository. jroesch pushed a commit to branch ci-docker-staging in repository https://gitbox.apache.org/repos/asf/tvm.git
commit 6b8c29582c1b0a86d92803748bfcbf3658f06f94 Author: Jared Roesch <[email protected]> AuthorDate: Fri Mar 26 15:13:32 2021 -0700 Clean up build --- rust/tvm-sys/build.rs | 14 +++++++------- tests/scripts/task_rust.sh | 14 ++++++-------- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/rust/tvm-sys/build.rs b/rust/tvm-sys/build.rs index 5a62f22..d80bd95 100644 --- a/rust/tvm-sys/build.rs +++ b/rust/tvm-sys/build.rs @@ -38,6 +38,7 @@ fn find_using_tvm_path<P: AsRef<Path>>(tvm_path: P) -> Result<TVMInstall> { }) } +#[allow(unused)] fn if_unset<K: AsRef<std::ffi::OsStr>, V: AsRef<std::ffi::OsStr>>(k: K, v: V) -> Result<()> { match std::env::var(k.as_ref()) { Ok(other) if other != "" => { @@ -53,14 +54,8 @@ fn if_unset<K: AsRef<std::ffi::OsStr>, V: AsRef<std::ffi::OsStr>>(k: K, v: V) -> Ok(()) } -fn set_env_vars() -> Result<()> { - if_unset("LIBCLANG_PATH", "/opt/homebrew/opt/llvm/lib")?; - if_unset("LLVM_CONFIG_PATH", "/opt/homebrew/opt/llvm/bin/llvm-config") -} - /// Find a TVM installation using TVM build by either first installing or detecting. fn find_using_tvm_build() -> Result<TVMInstall> { - set_env_vars()?; let mut build_config = BuildConfig::default(); build_config.repository = Some("https://github.com/apache/tvm".to_string()); build_config.branch = Some(option_env!("TVM_BRANCH").unwrap_or("main").into()); @@ -82,11 +77,16 @@ fn main() -> Result<()> { _ => find_using_tvm_build(), }?; + // If the TVM_HOME environment variable changed, the LLVM_CONFIG_PATH environment variable + // changed, the build directory or headers have changed we need to rebuild the Rust bindings. println!("cargo:rerun-if-env-changed=TVM_HOME"); + println!("cargo:rerun-if-env-changed=LLVM_CONFIG_PATH"); + println!("cargo:rerun-if-changed={}", build_path.display()); + println!("cargo:rerun-if-changed={}/include", source_path.display()); if cfg!(feature = "static-linking") { println!("cargo:rustc-link-lib=static=tvm"); - // TODO move this to tvm-build as library_path? + // TODO(@jroesch): move this to tvm-build as library_path? println!( "cargo:rustc-link-search=native={}/build", build_path.display() diff --git a/tests/scripts/task_rust.sh b/tests/scripts/task_rust.sh index c40585b..9ddd1f2 100755 --- a/tests/scripts/task_rust.sh +++ b/tests/scripts/task_rust.sh @@ -45,18 +45,16 @@ cargo fmt -- --check cd $RUST_DIR/tvm-sys # First we test w/o the bindings feature on. cargo build -cargo test --tests +cargo test --features static-linking --tests # Second we test w/ the bindings feature on. -cargo build --features bindings -cargo test --features bindings --tests +cargo build --features dynamic-linking +cargo test --features dynamic-linking --tests # Next we test the runtime API. cd $RUST_DIR/tvm-rt - # Build and run the tests. -cargo build -cargo test --tests +cargo test # Next we test the graph executor crate. cd $RUST_DIR/tvm-graph-rt @@ -89,11 +87,10 @@ cd - # and compiler bindings. cd $RUST_DIR/tvm -cargo test --tests -- --test-threads=1 +cargo test # run basic tests on cpu cd tests/basics -cargo build --features cpu cargo run --features cpu # uncomment when have more CI resources # cargo build --features gpu @@ -101,6 +98,7 @@ cargo run --features cpu # fi cd - +# TODO(@jroesch): I believe this is no longer true, refactor in follow up PR. # run callback tests separately: https://discuss.tvm.ai/t/are-global-functions-need-to-be-accessed-in-separate-processes/1075 cd tests/callback cargo build
