diff --git a/android/src/main/java/com/rnllama/LlamaContext.java b/android/src/main/java/com/rnllama/LlamaContext.java index e2044cf1..dad6fb5e 100644 --- a/android/src/main/java/com/rnllama/LlamaContext.java +++ b/android/src/main/java/com/rnllama/LlamaContext.java @@ -237,33 +237,33 @@ public void release() { static { Log.d(NAME, "Primary ABI: " + Build.SUPPORTED_ABIS[0]); if (LlamaContext.isArm64V8a()) { - String cpuFeatures = LlamaContext.getCpuFeatures(); - Log.d(NAME, "CPU features: " + cpuFeatures); + String cpuFeatures = LlamaContext.getCpuFeatures(); + Log.d(NAME, "CPU features: " + cpuFeatures); - boolean hasFp16 = cpuFeatures.contains("fp16") || cpuFeatures.contains("fphp"); - boolean hasDotProd = cpuFeatures.contains("dotprod") || cpuFeatures.contains("asimddp"); - boolean isAtLeastArmV82 = cpuFeatures.contains("asimd") && cpuFeatures.contains("crc32") && cpuFeatures.contains("aes"); - boolean isAtLeastArmV84 = cpuFeatures.contains("dcpop") && cpuFeatures.contains("uscat"); + boolean hasFp16 = cpuFeatures.contains("fp16") || cpuFeatures.contains("fphp"); + boolean hasDotProd = cpuFeatures.contains("dotprod") || cpuFeatures.contains("asimddp"); + boolean isAtLeastArmV82 = cpuFeatures.contains("asimd") && cpuFeatures.contains("crc32") && cpuFeatures.contains("aes"); + boolean isAtLeastArmV84 = cpuFeatures.contains("dcpop") && cpuFeatures.contains("uscat"); - if (isAtLeastArmV84 && hasFp16 && hasDotProd) { - Log.d(NAME, "Loading librnllama_v8_4_fp16_dotprod.so"); - System.loadLibrary("rnllama_v8_4_fp16_dotprod"); - } else if (isAtLeastArmV82 && hasFp16 && hasDotProd) { - Log.d(NAME, "Loading librnllama_v8_2_fp16_dotprod.so"); - System.loadLibrary("rnllama_v8_2_fp16_dotprod"); - } else if (isAtLeastArmV82 && hasFp16) { - Log.d(NAME, "Loading librnllama_v8_2_fp16.so"); - System.loadLibrary("rnllama_v8_2_fp16"); - } else { - Log.d(NAME, "Loading librnllama_v8.so"); - System.loadLibrary("rnllama_v8"); - } + if (isAtLeastArmV84 && hasFp16 && hasDotProd) { + Log.d(NAME, "Loading librnllama_v8_4_fp16_dotprod.so"); + System.loadLibrary("rnllama_v8_4_fp16_dotprod"); + } else if (isAtLeastArmV82 && hasFp16 && hasDotProd) { + Log.d(NAME, "Loading librnllama_v8_2_fp16_dotprod.so"); + System.loadLibrary("rnllama_v8_2_fp16_dotprod"); + } else if (isAtLeastArmV82 && hasFp16) { + Log.d(NAME, "Loading librnllama_v8_2_fp16.so"); + System.loadLibrary("rnllama_v8_2_fp16"); + } else { + Log.d(NAME, "Loading librnllama_v8.so"); + System.loadLibrary("rnllama_v8"); + } } else if (LlamaContext.isX86_64()) { - Log.d(NAME, "Loading librnllama_x86_64.so"); - System.loadLibrary("rnllama_x86_64"); + Log.d(NAME, "Loading librnllama_x86_64.so"); + System.loadLibrary("rnllama_x86_64"); } else { - Log.d(NAME, "Loading default librnllama.so"); - System.loadLibrary("rnllama"); + Log.d(NAME, "Loading default librnllama.so"); + System.loadLibrary("rnllama"); } }