Skip to content

Commit

Permalink
Fix MacOS compile (#724)
Browse files Browse the repository at this point in the history
  • Loading branch information
cxzl25 authored Dec 26, 2024
1 parent 9f4d3c5 commit 3ad1e9f
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions native-engine/blaze/src/rt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,23 @@ impl NativeExecutionRuntime {
let default_parallelism = std::thread::available_parallelism()
.map(|v| v.get())
.unwrap_or(1);
let has_htt = CpuId::new()
.get_feature_info()
.map(|info| info.has_htt())
.unwrap_or(false);
let mut num_worker_threads = if has_htt {

fn cpu_has_htt() -> bool {
#[cfg(any(
all(target_arch = "x86", not(target_env = "sgx"), target_feature = "sse"),
all(target_arch = "x86_64", not(target_env = "sgx"))
))]
{
let has_htt = CpuId::new()
.get_feature_info()
.map(|info| info.has_htt())
.unwrap_or(false);
return has_htt;
}
false
}

let mut num_worker_threads = if cpu_has_htt() {
default_parallelism / 2
} else {
default_parallelism
Expand Down

0 comments on commit 3ad1e9f

Please sign in to comment.