diff --git a/Cargo.lock b/Cargo.lock index bca2ebf..5455c72 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -496,7 +496,6 @@ version = "0.2.0" dependencies = [ "anyhow", "bytemuck", - "cc", "clap", "divan", "dunce", diff --git a/Cargo.toml b/Cargo.toml index 35ceae1..c8128ee 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -52,6 +52,3 @@ harness = false [profile.rwd] debug = true inherits = "release" - -[build-dependencies] -cc = "1.1.36" diff --git a/flake.nix b/flake.nix index f87f1a2..1cf54bb 100644 --- a/flake.nix +++ b/flake.nix @@ -77,9 +77,12 @@ stableToolchainWithLLvmTools = pkgs.rust-bin.stable.latest.default.override { extensions = ["rust-src" "llvm-tools"]; }; - stableToolchainWithRustAnalyzer = pkgs.rust-bin.stable.latest.default.override { - extensions = ["rust-src" "rust-analyzer"]; - }; + stableToolchainWithRustAnalyzer = pkgs.rust-bin.stable.latest.default.override ({ + extensions = ["rust-src" "rust-analyzer"]; + } + // (lib.optionalAttrs pkgs.stdenv.isDarwin { + targets = ["aarch64-apple-darwin" "x86_64-apple-darwin"]; + })); craneLib = (crane.mkLib pkgs).overrideToolchain stableToolchain; craneLibLLvmTools = (crane.mkLib pkgs).overrideToolchain stableToolchainWithLLvmTools; diff --git a/mnn-sys/Cargo.toml b/mnn-sys/Cargo.toml index e2dcc79..1aa1b51 100644 --- a/mnn-sys/Cargo.toml +++ b/mnn-sys/Cargo.toml @@ -27,11 +27,17 @@ coreml = ["metal"] opencl = [] openmp = [] opengl = [] + mnn-threadpool = [] + crt_static = [] mini-build = [] sparse-compute = [] arm82 = [] bf16 = [] +cpu-weight-dequant-gemm = [] +avx512 = [] +neon = [] +low-memory = [] default = ["mnn-threadpool", "sparse-compute", "opencl"] diff --git a/mnn-sys/build.rs b/mnn-sys/build.rs index 074779b..460554e 100644 --- a/mnn-sys/build.rs +++ b/mnn-sys/build.rs @@ -172,7 +172,7 @@ fn _main() -> Result<()> { } else if *TARGET_OS == "linux" { #[cfg(feature = "opencl")] { - if !pkg_config::probe_library("OpenCL").is_ok() { + if pkg_config::probe_library("OpenCL").is_err() { println!("cargo:rustc-link-lib=static=OpenCL"); }; } @@ -822,7 +822,6 @@ fn x86_64<'a>( .cpp(true) .std("c++11") .includes(includes) - // .cargo_warnings(false) .files(mnn_sse_src) .define("MNN_USE_SSE", None) .tap_mut(|build| { diff --git a/mnn-sys/mnn_c/interpreter_c.cpp b/mnn-sys/mnn_c/interpreter_c.cpp index 2fe130f..0e8da2e 100644 --- a/mnn-sys/mnn_c/interpreter_c.cpp +++ b/mnn-sys/mnn_c/interpreter_c.cpp @@ -353,7 +353,7 @@ const char *OperatorInfo_name(const void *op) { const char *OperatorInfo_type(const void *op) { return reinterpret_cast(op)->type().c_str(); } -const float OperatorInfo_flops(const void *op) { +float OperatorInfo_flops(const void *op) { return reinterpret_cast(op)->flops(); } } // extern "C" diff --git a/mnn-sys/mnn_c/interpreter_c.h b/mnn-sys/mnn_c/interpreter_c.h index 40c053b..bcd82af 100644 --- a/mnn-sys/mnn_c/interpreter_c.h +++ b/mnn-sys/mnn_c/interpreter_c.h @@ -196,7 +196,7 @@ const char *Interpreter_uuid(const Interpreter *interpreter); const char *OperatorInfo_name(const void *op); const char *OperatorInfo_type(const void *op); -const float OperatorInfo_flops(const void *op); +float OperatorInfo_flops(const void *op); #ifdef __cplusplus } diff --git a/mnn-sys/mnn_c/mnndefine.h b/mnn-sys/mnn_c/mnndefine.h deleted file mode 100644 index e69de29..0000000 diff --git a/src/lib.rs b/src/lib.rs index dd3cf31..e96abef 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -84,7 +84,7 @@ pub use ffi::MapType; pub mod prelude { pub use crate::error::*; pub(crate) use crate::profile::profile; + pub use core::ffi::*; pub use core::marker::PhantomData; pub use error_stack::{Report, ResultExt}; - pub use core::ffi::*; }