kotlin-simd
1.2.0indexedExposes SSE, SSE2, SSE3, SSSE3, SSE4.1 and SSE4.2 compiler intrinsics as functions, plus boolean SSE-support constants for runtime feature detection and fallback implementations.
Exposes SSE, SSE2, SSE3, SSSE3, SSE4.1 and SSE4.2 compiler intrinsics as functions, plus boolean SSE-support constants for runtime feature detection and fallback implementations.
Exposes SSE, SSE2, SSE3, SSSE3, SSE4.1, and SSE4.2 compiler intrincs to Kotlin/Native as functions.
SSE Support can be checked by using the boolean constants defined by the library (simply called SSE, SSE2, etc). This allows changing implementation at runtime based on hardware SSE support:
fun round(x: Vector128): Vector128 = when {
SSE4_1 -> sse4_1_round_ps(x, SSE4_1_FROUND_NEARBYINT)
else -> {
vectorOf(
round(x.getFloatAt(0)),
round(x.getFloatAt(1)),
round(x.getFloatAt(2)),
round(x.getFloatAt(3)),
)
}
}
In order to use the SIMD functions from common source sets like
nativeMain or similar, cinterop commonization needs to be enabled in gradle.properties:
kotlin.mpp.enableCinteropCommonization=true
This is only required if using functions from the platform.simd package directly.
Surfaced from shared tags and platforms — no rankings paid for.