Skip to content

Commit

Permalink
bun|python: use target_feature to use correct precompiled runtimes
Browse files Browse the repository at this point in the history
  • Loading branch information
jdx committed Jan 24, 2024
1 parent c6b1a22 commit 958dff3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/plugins/core/bun.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,11 @@ fn os() -> &'static str {

fn arch() -> &'static str {
if cfg!(target_arch = "x86_64") || cfg!(target_arch = "amd64") {
"x64"
if cfg!(target_feature = "avx2") {
"x64"
} else {
"x64-baseline"
}
} else if cfg!(target_arch = "aarch64") || cfg!(target_arch = "arm64") {
"aarch64"
} else {
Expand Down
10 changes: 9 additions & 1 deletion src/plugins/core/python.rs
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,15 @@ fn python_arch(settings: &Settings) -> String {
return arch.clone();
}
if cfg!(target_arch = "x86_64") {
"x86_64_v3".into()
if cfg!(target_feature = "avx512f") {
"x86_64_v4".into()
} else if cfg!(target_feature = "avx2") {
"x86_64_v3".into()
} else if cfg!(target_feature = "sse4.1") {
"x86_64_v2".into()
} else {
"x86_64_v1".into()
}
} else {
built_info::CFG_TARGET_ARCH.to_string()
}
Expand Down

0 comments on commit 958dff3

Please sign in to comment.