Skip to content

Commit

Permalink
Update build definitions for XNNPACK
Browse files Browse the repository at this point in the history
  • Loading branch information
ebraraktas committed Feb 1, 2022
1 parent baf7f7e commit 705a91d
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,19 +203,17 @@ fn build_tensorflow_with_bazel(tf_src_path: &str, config: &str) -> PathBuf {
let mut bazel = std::process::Command::new("bazel");
bazel.arg("build").arg("-c").arg("opt");

// Configure XNNPACK flags
// In r2.6, it is enabled for some OS such as Windows by default.
// To enable it by feature flag, we disable it by default on all platforms.
#[cfg(not(feature = "xnnpack"))]
bazel.arg("--define").arg("tflite_with_xnnpack=false");
#[cfg(any(feature = "xnnpack_qu8", feature = "xnnpack_qs8"))]
{
bazel.arg("--define").arg("tflite_with_xnnpack=true");
}

bazel.arg("--define").arg("tflite_with_xnnpack=true");
#[cfg(feature = "xnnpack_qs8")]
{
bazel.arg("--define").arg("xnn_enable_qs8=true");
}
bazel.arg("--define").arg("xnn_enable_qs8=true");
#[cfg(feature = "xnnpack_qu8")]
{
bazel.arg("--define").arg("xnn_enable_qu8=true");
}
bazel.arg("--define").arg("xnn_enable_qu8=true");

bazel
.arg(format!("--config={}", config))
Expand Down

0 comments on commit 705a91d

Please sign in to comment.