Skip to content

Commit 2100527

Browse files
psiddhGithub Executorch
andauthored
Summary: Follow up fix to pr#13526 (#13640)
Test Plan: CI Reviewers: Subscribers: Tasks: Tags: ### Summary [PLEASE REMOVE] See [CONTRIBUTING.md's Pull Requests](https://github.com/pytorch/executorch/blob/main/CONTRIBUTING.md#pull-requests) for ExecuTorch PR guidelines. [PLEASE REMOVE] If this PR closes an issue, please add a `Fixes #<issue-id>` line. [PLEASE REMOVE] If this PR introduces a fix or feature that should be the upcoming release notes, please add a "Release notes: <area>" label. For a list of available release notes labels, check out [CONTRIBUTING.md's Pull Requests](https://github.com/pytorch/executorch/blob/main/CONTRIBUTING.md#pull-requests). ### Test plan [PLEASE REMOVE] How did you test this PR? Please write down any manual commands you used and note down tests that you have written if applicable. Co-authored-by: Github Executorch <[email protected]>
1 parent fa07ed9 commit 2100527

File tree

2 files changed

+12
-14
lines changed

2 files changed

+12
-14
lines changed

extension/android/jni/BUCK

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,6 @@ load(":build_defs.bzl", "ET_JNI_COMPILER_FLAGS")
77

88
oncall("executorch")
99

10-
# Define the common JNI source files
11-
shared_srcs = [
12-
"jni_layer.cpp",
13-
"jni_layer_runtime.cpp",
14-
"jni_helper.cpp",
15-
"log.cpp",
16-
]
17-
1810
non_fbcode_target(_kind = executorch_generated_lib,
1911
name = "generated_op_lib_optimized",
2012
custom_ops_aten_kernel_deps = [
@@ -36,7 +28,7 @@ non_fbcode_target(_kind = executorch_generated_lib,
3628

3729
non_fbcode_target(_kind = fb_android_cxx_library,
3830
name = "executorch_jni",
39-
srcs = shared_srcs,
31+
srcs = ["jni_layer.cpp", "log.cpp", "jni_layer_runtime.cpp", "jni_helper.cpp"],
4032
allow_jni_merging = False,
4133
compiler_flags = ET_JNI_COMPILER_FLAGS,
4234
soname = "libexecutorch.$(ext)",
@@ -57,7 +49,7 @@ non_fbcode_target(_kind = fb_android_cxx_library,
5749

5850
non_fbcode_target(_kind = fb_android_cxx_library,
5951
name = "executorch_jni_full",
60-
srcs = shared_srcs,
52+
srcs = ["jni_layer.cpp", "log.cpp", "jni_layer_runtime.cpp", "jni_helper.cpp"],
6153
allow_jni_merging = False,
6254
compiler_flags = ET_JNI_COMPILER_FLAGS,
6355
soname = "libexecutorch.$(ext)",
@@ -79,7 +71,7 @@ non_fbcode_target(_kind = fb_android_cxx_library,
7971

8072
non_fbcode_target(_kind = fb_android_cxx_library,
8173
name = "executorch_training_jni",
82-
srcs = shared_srcs + ["jni_layer_training.cpp"],
74+
srcs = ["jni_layer.cpp", "log.cpp", "jni_layer_runtime.cpp", "jni_layer_training.cpp", "jni_helper.cpp"],
8375
allow_jni_merging = False,
8476
compiler_flags = ET_JNI_COMPILER_FLAGS + [
8577
"-DEXECUTORCH_BUILD_EXTENSION_TRAINING",
@@ -106,9 +98,12 @@ non_fbcode_target(_kind = fb_android_cxx_library,
10698

10799
non_fbcode_target(_kind = fb_android_cxx_library,
108100
name = "executorch_llama_jni",
109-
exclude_files = ["log.cpp"]
110-
shared_srcs_filtered = [f for f in shared_srcs if f not in exclude_files]
111-
srcs = shared_srcs_filtered + ["jni_layer_llama.cpp"]
101+
srcs = [
102+
"jni_layer.cpp",
103+
"jni_layer_llama.cpp",
104+
"jni_layer_runtime.cpp",
105+
"jni_helper.cpp",
106+
],
112107
allow_jni_merging = False,
113108
compiler_flags = ET_JNI_COMPILER_FLAGS + [
114109
"-DEXECUTORCH_BUILD_LLAMA_JNI",
@@ -159,5 +154,6 @@ runtime.cxx_library(
159154
name = "jni_headers",
160155
exported_headers = [
161156
"jni_layer_constants.h",
157+
"jni_helper.h",
162158
]
163159
)

extension/android/jni/jni_layer.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ class JEValue : public facebook::jni::JavaClass<JEValue> {
200200
ss << "Unknown EValue type: [" << static_cast<int>(evalue.tag) << "]";
201201
jni_helper::throwExecutorchException(
202202
static_cast<uint32_t>(Error::InvalidArgument), ss.str().c_str());
203+
return {};
203204
}
204205

205206
static TensorPtr JEValueToTensorImpl(
@@ -219,6 +220,7 @@ class JEValue : public facebook::jni::JavaClass<JEValue> {
219220
ss << "Unknown EValue typeCode: " << typeCode;
220221
jni_helper::throwExecutorchException(
221222
static_cast<uint32_t>(Error::InvalidArgument), ss.str().c_str());
223+
return {};
222224
}
223225
};
224226

0 commit comments

Comments
 (0)