Skip to content

Commit a1e801c

Browse files
authored
[runtime] add toolchain for aarch64 (#1475)
* [runtime] add toolchain for aarch64 * [runtime] update onnxruntime version
1 parent dd0d5e6 commit a1e801c

File tree

6 files changed

+65
-60
lines changed

6 files changed

+65
-60
lines changed

runtime/core/cmake/onnx.cmake

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
if(ONNX)
2-
set(ONNX_VERSION "1.9.0")
2+
set(ONNX_VERSION "1.12.0")
33
if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
44
set(ONNX_URL "https://github.com/microsoft/onnxruntime/releases/download/v${ONNX_VERSION}/onnxruntime-win-x64-${ONNX_VERSION}.zip")
5-
set(URL_HASH "SHA256=484b08c55867963bd8f74cc39d7c9b6199260f1184839cc40f37e50304597364")
5+
set(URL_HASH "SHA256=8b5d61204989350b7904ac277f5fbccd3e6736ddbb6ec001e412723d71c9c176")
66
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
7-
set(ONNX_URL "https://github.com/microsoft/onnxruntime/releases/download/v${ONNX_VERSION}/onnxruntime-linux-x64-${ONNX_VERSION}.tgz")
8-
set(URL_HASH "SHA256=f386ab80e9d6d41f14ed9e61bff4acc6bf375770691bc3ba883ba0ba3cabca7f")
7+
if(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64")
8+
set(ONNX_URL "https://github.com/microsoft/onnxruntime/releases/download/v${ONNX_VERSION}/onnxruntime-linux-aarch64-${ONNX_VERSION}.tgz")
9+
set(URL_HASH "SHA256=5820d9f343df73c63b6b2b174a1ff62575032e171c9564bcf92060f46827d0ac")
10+
else()
11+
set(ONNX_URL "https://github.com/microsoft/onnxruntime/releases/download/v${ONNX_VERSION}/onnxruntime-linux-x64-${ONNX_VERSION}.tgz")
12+
set(URL_HASH "SHA256=5d503ce8540358b59be26c675e42081be14a3e833a5301926f555451046929c5")
13+
endif()
914
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
10-
set(ONNX_URL "https://github.com/microsoft/onnxruntime/releases/download/v${ONNX_VERSION}/onnxruntime-osx-x64-${ONNX_VERSION}.tgz")
11-
set(URL_HASH "SHA256=71517c8571186eddd31e78134ac441571494fc2f524153165f4a2fec22940d66")
15+
set(ONNX_URL "https://github.com/microsoft/onnxruntime/releases/download/v${ONNX_VERSION}/onnxruntime-osx-x86_64-${ONNX_VERSION}.tgz")
16+
set(URL_HASH "SHA256=09b17f712f8c6f19bb63da35d508815b443cbb473e16c6192abfaa297c02f600")
1217
else()
1318
message(FATAL_ERROR "Unsupported CMake System Name '${CMAKE_SYSTEM_NAME}' (expected 'Windows', 'Linux' or 'Darwin')")
1419
endif()

runtime/core/kaldi/CMakeLists.txt

Lines changed: 42 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -4,61 +4,51 @@ project(kaldi)
44

55
# include_directories() is called in the root CMakeLists.txt
66

7-
add_library(kaldi-base
8-
base/kaldi-error.cc
9-
base/kaldi-math.cc
10-
)
11-
target_link_libraries(kaldi-base PUBLIC utils)
12-
137
add_library(kaldi-util
14-
util/kaldi-io.cc
15-
util/parse-options.cc
16-
util/simple-io-funcs.cc
17-
util/text-utils.cc
18-
)
19-
target_link_libraries(kaldi-util PUBLIC kaldi-base)
20-
21-
add_library(kaldi-lat
22-
lat/determinize-lattice-pruned.cc
23-
lat/lattice-functions.cc
8+
base/kaldi-error.cc
9+
base/kaldi-math.cc
10+
util/kaldi-io.cc
11+
util/parse-options.cc
12+
util/simple-io-funcs.cc
13+
util/text-utils.cc
2414
)
25-
target_link_libraries(kaldi-lat PUBLIC kaldi-util)
15+
target_link_libraries(kaldi-util PUBLIC utils)
2616

2717
add_library(kaldi-decoder
28-
decoder/lattice-faster-decoder.cc
29-
decoder/lattice-faster-online-decoder.cc
30-
)
31-
target_link_libraries(kaldi-decoder PUBLIC kaldi-lat)
32-
33-
add_library(kaldi-lm
34-
lm/arpa-file-parser.cc
35-
lm/arpa-lm-compiler.cc
18+
lat/determinize-lattice-pruned.cc
19+
lat/lattice-functions.cc
20+
decoder/lattice-faster-decoder.cc
21+
decoder/lattice-faster-online-decoder.cc
3622
)
37-
target_link_libraries(kaldi-lm PUBLIC kaldi-util)
38-
39-
add_library(kaldi-fstext
40-
fstext/kaldi-fst-io.cc
41-
)
42-
target_link_libraries(kaldi-fstext PUBLIC kaldi-util)
43-
44-
# Arpa binary
45-
add_executable(arpa2fst lmbin/arpa2fst.cc)
46-
target_link_libraries(arpa2fst PUBLIC kaldi-lm)
47-
48-
# FST tools binary
49-
set(FST_BINS
50-
fstaddselfloops
51-
fstdeterminizestar
52-
fstisstochastic
53-
fstminimizeencoded
54-
fsttablecompose
55-
)
56-
57-
if(NOT MSVC)
58-
# dl is for dynamic linking, otherwise there is a linking error on linux
59-
link_libraries(dl)
23+
target_link_libraries(kaldi-decoder PUBLIC kaldi-util)
24+
25+
if(GRAPH_TOOLS)
26+
# Arpa binary
27+
add_executable(arpa2fst
28+
lm/arpa-file-parser.cc
29+
lm/arpa-lm-compiler.cc
30+
lmbin/arpa2fst.cc
31+
)
32+
target_link_libraries(arpa2fst PUBLIC kaldi-util)
33+
34+
# FST tools binary
35+
set(FST_BINS
36+
fstaddselfloops
37+
fstdeterminizestar
38+
fstisstochastic
39+
fstminimizeencoded
40+
fsttablecompose
41+
)
42+
43+
if(NOT MSVC)
44+
# dl is for dynamic linking, otherwise there is a linking error on linux
45+
link_libraries(dl)
46+
endif()
47+
foreach(name IN LISTS FST_BINS)
48+
add_executable(${name}
49+
fstbin/${name}.cc
50+
fstext/kaldi-fst-io.cc
51+
)
52+
target_link_libraries(${name} PUBLIC kaldi-util)
53+
endforeach()
6054
endif()
61-
foreach(name IN LISTS FST_BINS)
62-
add_executable(${name} fstbin/${name}.cc)
63-
target_link_libraries(${name} PUBLIC kaldi-fstext)
64-
endforeach()

runtime/core/patch/openfst/src/extensions/special/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ if(HAVE_BIN)
1010
sigma-fst.cc
1111
)
1212

13-
set_target_properties(fstspecial-bin PROPERTIE
13+
set_target_properties(fstspecial-bin PROPERTIES
1414
FOLDER special/bin
1515
OUTPUT_NAME fstspecial
1616
)
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
set(CMAKE_SYSTEM_NAME Linux)
2+
SET (CMAKE_SYSTEM_PROCESSOR aarch64)
3+
4+
set(CMAKE_C_COMPILER aarch64-linux-gnu-gcc)
5+
set(CMAKE_CXX_COMPILER aarch64-linux-gnu-g++)

runtime/libtorch/CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ project(wenet VERSION 0.1)
55
option(CXX11_ABI "whether to use CXX11_ABI libtorch" OFF)
66
option(FST_HAVE_BIN "whether to build fst binaries" OFF)
77
option(BUILD_TESTING "whether to build unit test" ON)
8+
option(GRAPH_TOOLS "whether to build TLG graph tools" ON)
9+
810
option(GRPC "whether to build with gRPC" OFF)
911
# TODO(Binbin Zhang): Change websocket to OFF since it depends on boost
1012
# which is a very big library
@@ -32,7 +34,9 @@ else()
3234
endif()
3335

3436
# Include all dependency
35-
include(libtorch)
37+
if(TORCH)
38+
include(libtorch)
39+
endif()
3640
if(ONNX)
3741
include(onnx)
3842
endif()

runtime/onnxruntime/toolchains

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../core/toolchains

0 commit comments

Comments
 (0)