Open 190n opened 3 weeks ago
For context, in terms of microarchitecture levels:
v1
, supporting SSE and SSE2v2
, such as SSE4.2 (specifically we target nehalem
)v3
, such as AVX2 (specifically we target haswell
)v3
for consumers and v4
for some servers (it's complicated...) while the latest AMD CPUs support v4
. I believe the last CPUs to not support v3
are the Jasper Lake family from 2021. v4
will likely not be broadly available for a long time.
Bun does not support x86_64 CPUs without SSE4.2 (older than Intel Nehalem or AMD Bulldozer) at this time, even in our x64-baseline builds. On unsupported CPUs, currently Bun crashes with "illegal instruction" at some unpredictable point depending on what you call. We should instead perform CPU feature detection as early as possible at startup, and call a function that prints an error message and exits if desired features are missing. This function should be in a separate object file so that we can compile it using minimal x86_64 features (so we don't use an illegal instruction while trying to print this error).
In non-baseline builds, we should check for AVX2 and crash with an error telling them to use the baseline build.