3 ms·
Just compile multiple libraries, one per target CPU architecture and load the one you want to use (typically with dlopen/dlsym etc..): Example from whisper.cpp
by saidinesh5 4y ago
Just compile multiple libraries, one per target CPU architecture and load the one you want to use (typically with dlopen/dlsym etc..):
Example from whisper.cpp: https://github.com/ggerganov/whisper.cpp/blob/master/examples/whisper.android/app/src/main/java/com/whispercppdemo/whisper/LibWhisper.kt#L112 https://github.com/ggerganov/whisper.cpp/blob/master/example...
if (loadVfpv4) {
Log.d(LOG_TAG, "Loading libwhisper_vfpv4.so")
System.loadLibrary("whisper_vfpv4")
} else if (loadV8fp16) {
Log.d(LOG_TAG, "Loading libwhisper_v8fp16_va.so")
System.loadLibrary("whisper_v8fp16_va")
} else {
Log.d(LOG_TAG, "Loading libwhisper.so")
System.loadLibrary("whisper")
}
You can also just compile for x86 with all the features enabled, and then choose the functions you want to execute at runtime.
This way you don't need to deal with yet another JIT compiler..