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: 21 additions & 3 deletions cmake/onnxruntime_java.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,31 @@ if (CMAKE_SYSTEM_NAME STREQUAL "Android")
file(MAKE_DIRECTORY ${ANDROID_PACKAGE_OUTPUT_DIR})
endif()

# Set platform and ach for packaging
# Set platform and arch for packaging
# Checks the names set by MLAS on non-Windows platforms first
if (CMAKE_SYSTEM_NAME STREQUAL "Android")
set(JNI_ARCH ${ANDROID_ABI})
elseif (CMAKE_SIZEOF_VOID_P EQUAL "8")
elseif (ARM64)
set(JNI_ARCH aarch64)
elseif (X86_64)
set(JNI_ARCH x64)
elseif (POWER)
set(JNI_ARCH ppc64)
else()
message(FATAL_ERROR "Java is currently not supported for x86 architecture")
# Now mirror the checks used with MSVC
if(MSVC)
if(onnxruntime_target_platform STREQUAL "ARM64")
set(JNI_ARCH aarch64)
elseif(onnxruntime_target_platform STREQUAL "x64")
set(JNI_ARCH x64)
else()
# if everything else failed then we're on a 32-bit arch and Java isn't supported
message(FATAL_ERROR "Java is currently not supported on 32-bit x86 architecture")
endif()
else()
# if everything else failed then we're on a 32-bit arch and Java isn't supported
message(FATAL_ERROR "Java is currently not supported on 32-bit x86 architecture")
endif()
endif()

if (WIN32)
Expand Down
4 changes: 3 additions & 1 deletion cmake/onnxruntime_mlas.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,9 @@ else()
OUTPUT_VARIABLE dumpmachine_output
ERROR_QUIET
)
if(dumpmachine_output MATCHES "^arm.*")
if(dumpmachine_output MATCHES "^arm64.*")
set(ARM64 TRUE)
elseif(dumpmachine_output MATCHES "^arm.*")
set(ARM TRUE)
elseif(dumpmachine_output MATCHES "^aarch64.*")
set(ARM64 TRUE)
Expand Down
9 changes: 7 additions & 2 deletions java/src/main/java/ai/onnxruntime/OnnxRuntime.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,15 @@ private static String initOsArch() {
}
String detectedArch = null;
String arch = System.getProperty("os.arch", "generic").toLowerCase(Locale.ENGLISH);
if (arch.indexOf("amd64") == 0 || arch.indexOf("x86_64") == 0) {
if (arch.startsWith("amd64") || arch.startsWith("x86_64")) {
detectedArch = "x64";
} else if (arch.indexOf("x86") == 0) {
} else if (arch.startsWith("x86")) {
// 32-bit x86 is not supported by the Java API
detectedArch = "x86";
} else if (arch.startsWith("aarch64")) {
detectedArch = "aarch64";
} else if (arch.startsWith("ppc64")) {
detectedArch = "ppc64";
} else if (isAndroid()) {
detectedArch = arch;
} else {
Expand Down
4 changes: 4 additions & 0 deletions onnxruntime/core/mlas/lib/aarch64/QgemmU8X8KernelNeon.S
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ Abstract:

.equ .LGemmU8X8KernelFrame_ColumnSumBuffer, 0
.equ .LGemmU8X8KernelFrame_DepthValue, 8
#if defined(__APPLE__)
.equ .LGemmU8X8KernelFrame_ZeroMode, 12
#else
.equ .LGemmU8X8KernelFrame_ZeroMode, 16
#endif

.text

Expand Down