Skip to content

Commit

Permalink
Merge pull request #118 from yuxianzhi/patch-25
Browse files Browse the repository at this point in the history
fix jni address cast bug
  • Loading branch information
jianfeifeng authored Jul 29, 2022
2 parents fb9621f + 082853d commit 4bdc81e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion inference/engine/include/BoltModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ JNIEXPORT void JNICALL BOLT_JNI_PREFIX(BoltModel_setRuntimeDeviceDynamicJNI)(
* Method: setNumThreads
* Signature: (I)V
*/
JNIEXPORT void JNICALL BOLT_JNI_PREFIX(BoltModel_setNumThreads)(JNIEnv *, jint);
JNIEXPORT void JNICALL BOLT_JNI_PREFIX(BoltModel_setNumThreads)(JNIEnv *, jobject, jint);

/*
* Class: BoltModel
Expand Down
6 changes: 3 additions & 3 deletions inference/engine/src/BoltModel_Jni.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ extern "C" JNIEXPORT jlong JNICALL BOLT_JNI_PREFIX(BoltModel_createModel)(
const char *affinityPtr = env->GetStringUTFChars(affinity, JNI_FALSE);
std::string affinity_str = (std::string)affinityPtr;
AFFINITY_TYPE affinity_cur = str2AFFINITY_TYPE(affinity_str);
long modelAddr = (long long)CreateModel(modelPathPtr, affinity_cur, NULL);
long long modelAddr = (long long)CreateModel(modelPathPtr, affinity_cur, NULL);
ModelHandleInfo *ihInfo = (ModelHandleInfo *)modelAddr;
if (nullptr == ihInfo) {
UNI_ERROR_LOG("Bolt instance not created\n");
Expand All @@ -285,7 +285,7 @@ extern "C" JNIEXPORT jlong JNICALL BOLT_JNI_PREFIX(BoltModel_cloneModel)(
UNI_DEBUG_LOG("JNI %s...\n", __FUNCTION__);
ModelHandle handle = (ModelHandle)modelAddr;
ModelHandle cloneHandle = CloneModel(handle);
long ret = (long long)cloneHandle;
long long ret = (long long)cloneHandle;
UNI_DEBUG_LOG("JNI %s end.\n", __FUNCTION__);
return ret;
}
Expand Down Expand Up @@ -433,7 +433,7 @@ extern "C" JNIEXPORT void JNICALL BOLT_JNI_PREFIX(BoltModel_setRuntimeDeviceDyna
UNI_DEBUG_LOG("JNI %s end.\n", __FUNCTION__);
}

extern "C" JNIEXPORT void JNICALL BOLT_JNI_PREFIX(BoltModel_setNumThreads)(JNIEnv *env, jint threads)
extern "C" JNIEXPORT void JNICALL BOLT_JNI_PREFIX(BoltModel_setNumThreads)(JNIEnv *env, jobject, jint threads)
{
UNI_DEBUG_LOG("JNI %s...\n", __FUNCTION__);
SetNumThreads(threads);
Expand Down

0 comments on commit 4bdc81e

Please sign in to comment.