cpuinfo topic

CategoryCPUInfo

CPU feature detection for SDL.

These functions are largely concerned with reporting if the system has access to various SIMD instruction sets, but also has other important info to share, such as system RAM size and number of logical CPU cores.

CPU instruction set checks, like SDL_HasSSE() and SDL_HasNEON(), are available on all platforms, even if they don't make sense (an ARM processor will never have SSE and an x86 processor will never have NEON, for example, but these functions still exist and will simply return false in these cases).

Functions

sdlGetCpuCacheLineSize() int cpuinfo
Determine the L1 cache line size of the CPU.
sdlGetNumLogicalCpuCores() int cpuinfo
Get the number of logical CPU cores available.
sdlGetSimdAlignment() int cpuinfo
Report the alignment this system needs for SIMD allocations.
sdlGetSystemRam() int cpuinfo
Get the amount of RAM configured in the system.
sdlHasAltiVec() bool cpuinfo
Determine whether the CPU has AltiVec features.
sdlHasArmsimd() bool cpuinfo
Determine whether the CPU has ARM SIMD (ARMv6) features.
sdlHasAvx() bool cpuinfo
Determine whether the CPU has AVX features.
sdlHasAvx2() bool cpuinfo
Determine whether the CPU has AVX2 features.
sdlHasAvx512F() bool cpuinfo
Determine whether the CPU has AVX-512F (foundation) features.
sdlHasLasx() bool cpuinfo
Determine whether the CPU has LASX (LOONGARCH SIMD) features.
sdlHasLsx() bool cpuinfo
Determine whether the CPU has LSX (LOONGARCH SIMD) features.
sdlHasMmx() bool cpuinfo
Determine whether the CPU has MMX features.
sdlHasNeon() bool cpuinfo
Determine whether the CPU has NEON (ARM SIMD) features.
sdlHasSse() bool cpuinfo
Determine whether the CPU has SSE features.
sdlHasSse2() bool cpuinfo
Determine whether the CPU has SSE2 features.
sdlHasSse3() bool cpuinfo
Determine whether the CPU has SSE3 features.
sdlHasSse41() bool cpuinfo
Determine whether the CPU has SSE4.1 features.
sdlHasSse42() bool cpuinfo
Determine whether the CPU has SSE4.2 features.