Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 10 additions & 14 deletions extension/android/jni/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,6 @@ load(":build_defs.bzl", "ET_JNI_COMPILER_FLAGS")

oncall("executorch")

# Define the common JNI source files
shared_srcs = [
"jni_layer.cpp",
"jni_layer_runtime.cpp",
"jni_helper.cpp",
"log.cpp",
]

non_fbcode_target(_kind = executorch_generated_lib,
name = "generated_op_lib_optimized",
custom_ops_aten_kernel_deps = [
Expand All @@ -36,7 +28,7 @@ non_fbcode_target(_kind = executorch_generated_lib,

non_fbcode_target(_kind = fb_android_cxx_library,
name = "executorch_jni",
srcs = shared_srcs,
srcs = ["jni_layer.cpp", "log.cpp", "jni_layer_runtime.cpp", "jni_helper.cpp"],
allow_jni_merging = False,
compiler_flags = ET_JNI_COMPILER_FLAGS,
soname = "libexecutorch.$(ext)",
Expand All @@ -57,7 +49,7 @@ non_fbcode_target(_kind = fb_android_cxx_library,

non_fbcode_target(_kind = fb_android_cxx_library,
name = "executorch_jni_full",
srcs = shared_srcs,
srcs = ["jni_layer.cpp", "log.cpp", "jni_layer_runtime.cpp", "jni_helper.cpp"],
allow_jni_merging = False,
compiler_flags = ET_JNI_COMPILER_FLAGS,
soname = "libexecutorch.$(ext)",
Expand All @@ -79,7 +71,7 @@ non_fbcode_target(_kind = fb_android_cxx_library,

non_fbcode_target(_kind = fb_android_cxx_library,
name = "executorch_training_jni",
srcs = shared_srcs + ["jni_layer_training.cpp"],
srcs = ["jni_layer.cpp", "log.cpp", "jni_layer_runtime.cpp", "jni_layer_training.cpp", "jni_helper.cpp"],
allow_jni_merging = False,
compiler_flags = ET_JNI_COMPILER_FLAGS + [
"-DEXECUTORCH_BUILD_EXTENSION_TRAINING",
Expand All @@ -106,9 +98,12 @@ non_fbcode_target(_kind = fb_android_cxx_library,

non_fbcode_target(_kind = fb_android_cxx_library,
name = "executorch_llama_jni",
exclude_files = ["log.cpp"]
shared_srcs_filtered = [f for f in shared_srcs if f not in exclude_files]
srcs = shared_srcs_filtered + ["jni_layer_llama.cpp"]
srcs = [
"jni_layer.cpp",
"jni_layer_llama.cpp",
"jni_layer_runtime.cpp",
"jni_helper.cpp",
],
allow_jni_merging = False,
compiler_flags = ET_JNI_COMPILER_FLAGS + [
"-DEXECUTORCH_BUILD_LLAMA_JNI",
Expand Down Expand Up @@ -159,5 +154,6 @@ runtime.cxx_library(
name = "jni_headers",
exported_headers = [
"jni_layer_constants.h",
"jni_helper.h",
]
)
2 changes: 2 additions & 0 deletions extension/android/jni/jni_layer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ class JEValue : public facebook::jni::JavaClass<JEValue> {
ss << "Unknown EValue type: [" << static_cast<int>(evalue.tag) << "]";
jni_helper::throwExecutorchException(
static_cast<uint32_t>(Error::InvalidArgument), ss.str().c_str());
return {};
}

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

Expand Down
Loading