Skip to content

Commit

Permalink
whisper.android : return output from benchmarks (ggerganov#1785)
Browse files Browse the repository at this point in the history
Benchmarks are failing because JNI expects a jstring and the benchmarks
are missing a return statement (i.e., returning null). The functions
actually build a jstring but don't return it, so this seems to have been
an oversight.

This patch returns the jstring and now the benchmarks run successfully.

Fixes ggerganov#1783.
  • Loading branch information
luciferous authored and jiahansu committed Apr 17, 2024
1 parent 7b9e641 commit cc2c43e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions examples/whisper.android/lib/src/main/jni/whisper/jni.c
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ Java_com_whispercpp_whisper_WhisperLib_00024Companion_benchMemcpy(JNIEnv *env, j
UNUSED(thiz);
const char *bench_ggml_memcpy = whisper_bench_memcpy_str(n_threads);
jstring string = (*env)->NewStringUTF(env, bench_ggml_memcpy);
return string;
}

JNIEXPORT jstring JNICALL
Expand All @@ -236,4 +237,5 @@ Java_com_whispercpp_whisper_WhisperLib_00024Companion_benchGgmlMulMat(JNIEnv *en
UNUSED(thiz);
const char *bench_ggml_mul_mat = whisper_bench_ggml_mul_mat_str(n_threads);
jstring string = (*env)->NewStringUTF(env, bench_ggml_mul_mat);
return string;
}

0 comments on commit cc2c43e

Please sign in to comment.