feat: add AVX2 support detection for x64 Linux systems (#167)

This commit is contained in:
GoForceX
2026-03-01 01:08:40 +08:00
committed by GitHub
parent 0ff83bfc51
commit 4c32875876
3 changed files with 49 additions and 37 deletions
Generated Vendored
+2 -2
View File
File diff suppressed because one or more lines are too long
Generated Vendored
+35 -35
View File
File diff suppressed because one or more lines are too long
+12
View File
@@ -98,6 +98,18 @@ export function getAvx2(
return true;
}
// Check AVX2 support on x64 Linux
if (os === "linux" && arch === "x64" && avx2 === undefined) {
try {
const cpuInfo = readFileSync("/proc/cpuinfo", "utf8");
const hasAvx2 = cpuInfo.includes("avx2");
return hasAvx2;
} catch (error) {
warning(`Failed to detect AVX2 support.`);
return false;
}
}
return avx2 ?? true;
}