Skip to content

Commit

Permalink
chore: make mac apple silicon build more reliable (#1979)
Browse files Browse the repository at this point in the history
Closes #1977
  • Loading branch information
eddyxu authored Feb 19, 2024
1 parent 04c888f commit f5f563e
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
2 changes: 1 addition & 1 deletion rust/lance-index/benches/hnsw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ use lance_testing::datagen::generate_random_array_with_seed;

fn bench_hnsw(c: &mut Criterion) {
const DIMENSION: usize = 1024;
const TOTAL: usize = 1 * 1024 * 1024;
const TOTAL: usize = 1024 * 1024;
const SEED: [u8; 32] = [42; 32];
const K: usize = 10;

Expand Down
26 changes: 23 additions & 3 deletions rust/lance-linalg/build.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,33 @@
// Copyright 2024 Lance Developers.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

use std::env;

fn main() {
let rust_toolchain = env::var("RUSTUP_TOOLCHAIN").unwrap();
if rust_toolchain.starts_with("nightly") {
// enable the 'nightly' feature flag
println!("cargo:rustc-cfg=feature=\"nightly\"");
}

println!("cargo:rerun-if-changed=src/simd/f16.c");

if cfg!(all(target_os = "macos", target_feature = "neon")) {
if cfg!(all(target_os = "macos", target_arch = "aarch64")) {
cc::Build::new()
.compiler("clang")
.file("src/simd/f16.c")
.flag("-mtune=apple-m1")
.flag("-ffast-math")
.flag("-O3")
.flag("-Wall")
.flag("-Werror")
Expand All @@ -22,7 +43,6 @@ fn main() {
.std("c17")
.file("src/simd/f16.c")
.flag("-march=sapphirerapids")
.flag("-ffast-math")
.flag("-mavx512f")
.flag("-mavx512vl")
.flag("-mavx512bw")
Expand Down

0 comments on commit f5f563e

Please sign in to comment.