Skip to content

Commit c30b3cd

Browse files
Fix QNN_CONTEXT format mappings and ALOGD fallback for Genie integration
- Add RAC_MODEL_FORMAT_QNN_CONTEXT case to rac_model_detect_framework_from_format() - Add "qnn_context"/"qnn" format string parsing in model_assignment.cpp - Add QNN_CONTEXT to Kotlin CppBridgeModelRegistry.ModelFormat and ModelFormat enum - Wire QNN_CONTEXT through all bridge mapping when blocks (ModelManagement, Storage) - Fix ALOGD fprintf fallback to append newline on non-Android builds - Update Genie AAR dependency version to 0.2.0-SNAPSHOT Made-with: Cursor
1 parent 1739707 commit c30b3cd

9 files changed

Lines changed: 14 additions & 3 deletions

File tree

examples/android/RunAnywhereAI/app/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ dependencies {
221221
implementation(project(":runanywhere-core-onnx")) // ~30MB - STT, TTS, VAD
222222
// RAG pipeline is now part of the core SDK (not a separate module)
223223
// Genie: closed-source AAR from private repo (or mavenLocal for dev)
224-
implementation("com.runanywhere.sdk:runanywhere-genie-android:0.1.5-SNAPSHOT")
224+
implementation("com.runanywhere.sdk:runanywhere-genie-android:0.2.0-SNAPSHOT")
225225

226226
// AndroidX Core & Lifecycle
227227
implementation(libs.androidx.core.ktx)

sdk/runanywhere-commons/src/features/llm/rac_llm_service.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#include <android/log.h>
1818
#define ALOGD(...) __android_log_print(ANDROID_LOG_DEBUG, "RAC_LLM_SVC", __VA_ARGS__)
1919
#else
20-
#define ALOGD(...) fprintf(stderr, __VA_ARGS__)
20+
#define ALOGD(...) do { fprintf(stderr, __VA_ARGS__); fprintf(stderr, "\n"); } while(0)
2121
#endif
2222

2323
#include "rac/core/rac_core.h"

sdk/runanywhere-commons/src/infrastructure/model_management/model_assignment.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,8 @@ static std::vector<rac_model_info_t*> parse_models_json(const char* json_str, si
220220
model->format = RAC_MODEL_FORMAT_BIN;
221221
else if (format == "coreml" || format == "mlmodelc" || format == "mlpackage")
222222
model->format = RAC_MODEL_FORMAT_COREML;
223+
else if (format == "qnn_context" || format == "qnn")
224+
model->format = RAC_MODEL_FORMAT_QNN_CONTEXT;
223225
else
224226
model->format = RAC_MODEL_FORMAT_UNKNOWN;
225227

sdk/runanywhere-commons/src/infrastructure/model_management/model_types.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,9 @@ rac_bool_t rac_model_detect_framework_from_format(rac_model_format_t format,
403403
case RAC_MODEL_FORMAT_BIN:
404404
*out_framework = RAC_FRAMEWORK_FLUID_AUDIO;
405405
return RAC_TRUE;
406+
case RAC_MODEL_FORMAT_QNN_CONTEXT:
407+
*out_framework = RAC_FRAMEWORK_GENIE;
408+
return RAC_TRUE;
406409
default:
407410
return RAC_FALSE;
408411
}

sdk/runanywhere-commons/src/infrastructure/registry/service_registry.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#include <android/log.h>
2424
#define ALOGD(...) __android_log_print(ANDROID_LOG_DEBUG, "RAC_SVC_REG", __VA_ARGS__)
2525
#else
26-
#define ALOGD(...) fprintf(stderr, __VA_ARGS__)
26+
#define ALOGD(...) do { fprintf(stderr, __VA_ARGS__); fprintf(stderr, "\n"); } while(0)
2727
#endif
2828

2929
#include "rac/core/rac_core.h"

sdk/runanywhere-kotlin/src/commonMain/kotlin/com/runanywhere/sdk/public/extensions/Models/ModelTypes.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ enum class ModelFormat(
4545
ORT("ort"),
4646
GGUF("gguf"),
4747
BIN("bin"),
48+
QNN_CONTEXT("qnn_context"),
4849
UNKNOWN("unknown"),
4950
}
5051

sdk/runanywhere-kotlin/src/jvmAndroidMain/kotlin/com/runanywhere/sdk/foundation/bridge/extensions/CppBridgeModelRegistry.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ object CppBridgeModelRegistry {
7979
const val ORT = 3 // RAC_MODEL_FORMAT_ORT
8080
const val BIN = 4 // RAC_MODEL_FORMAT_BIN
8181
const val COREML = 5 // RAC_MODEL_FORMAT_COREML
82+
const val QNN_CONTEXT = 5 // RAC_MODEL_FORMAT_QNN_CONTEXT (same C++ value; COREML is 4 in C++)
8283
const val TFLITE = 6 // RAC_MODEL_FORMAT_TFLITE
8384
}
8485

sdk/runanywhere-kotlin/src/jvmAndroidMain/kotlin/com/runanywhere/sdk/public/extensions/RunAnywhere+ModelManagement.jvmAndroid.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ internal actual fun registerModelInternal(modelInfo: ModelInfo) {
9292
ModelFormat.GGUF -> CppBridgeModelRegistry.ModelFormat.GGUF
9393
ModelFormat.ONNX -> CppBridgeModelRegistry.ModelFormat.ONNX
9494
ModelFormat.ORT -> CppBridgeModelRegistry.ModelFormat.ORT
95+
ModelFormat.QNN_CONTEXT -> CppBridgeModelRegistry.ModelFormat.QNN_CONTEXT
9596
else -> CppBridgeModelRegistry.ModelFormat.UNKNOWN
9697
},
9798
// CRITICAL: Map InferenceFramework to C++ framework constant
@@ -295,6 +296,7 @@ private fun bridgeModelToPublic(bridge: CppBridgeModelRegistry.ModelInfo): Model
295296
CppBridgeModelRegistry.ModelFormat.GGUF -> ModelFormat.GGUF
296297
CppBridgeModelRegistry.ModelFormat.ONNX -> ModelFormat.ONNX
297298
CppBridgeModelRegistry.ModelFormat.ORT -> ModelFormat.ORT
299+
CppBridgeModelRegistry.ModelFormat.QNN_CONTEXT -> ModelFormat.QNN_CONTEXT
298300
else -> ModelFormat.UNKNOWN
299301
},
300302
framework =
@@ -1346,6 +1348,7 @@ private fun parseModelAssignmentsJson(json: String): List<ModelInfo> {
13461348
1 -> ModelFormat.GGUF
13471349
2 -> ModelFormat.ONNX
13481350
3 -> ModelFormat.ORT
1351+
5 -> ModelFormat.QNN_CONTEXT
13491352
else -> ModelFormat.UNKNOWN
13501353
},
13511354
framework =

sdk/runanywhere-kotlin/src/jvmAndroidMain/kotlin/com/runanywhere/sdk/public/extensions/RunAnywhere+Storage.jvmAndroid.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ private fun convertToModelStorageMetrics(
231231
CppBridgeModelRegistry.ModelFormat.ONNX -> ModelFormat.ONNX
232232
CppBridgeModelRegistry.ModelFormat.ORT -> ModelFormat.ORT
233233
CppBridgeModelRegistry.ModelFormat.BIN -> ModelFormat.BIN
234+
CppBridgeModelRegistry.ModelFormat.QNN_CONTEXT -> ModelFormat.QNN_CONTEXT
234235
else -> ModelFormat.UNKNOWN
235236
}
236237

0 commit comments

Comments
 (0)