From e80ea669ba32295b80c15cc98bd2bf0ead1433ba Mon Sep 17 00:00:00 2001 From: sychen Date: Thu, 26 Dec 2024 16:30:14 +0800 Subject: [PATCH] Fix MacOS compile --- native-engine/blaze/src/rt.rs | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/native-engine/blaze/src/rt.rs b/native-engine/blaze/src/rt.rs index 33d05a7a..1e80fc48 100644 --- a/native-engine/blaze/src/rt.rs +++ b/native-engine/blaze/src/rt.rs @@ -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