Skip to content

Commit 27991c5

Browse files
committed
Merge branch 'support_complex' of https://github.com/jim19930609/Paddle into support_fill_zero
2 parents 753798e + b8538de commit 27991c5

File tree

2,305 files changed

+125963
-62254
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,305 files changed

+125963
-62254
lines changed

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,14 @@ paddle/fluid/eager/api/generated/*
66
paddle/fluid/op_use_default_grad_maker_DEV.spec
77
paddle/fluid/op_use_default_grad_maker_PR.spec
88
paddle/phi/api/backward/backward_api.h
9+
paddle/phi/api/backward/sparse_bw_api.h
910
paddle/phi/api/include/api.h
11+
paddle/phi/api/include/sparse_api.h
1012
paddle/phi/api/lib/api.cc
1113
paddle/phi/api/lib/dygraph_api.*
1214
paddle/phi/api/lib/backward_api.cc
15+
paddle/phi/api/lib/sparse_api.cc
16+
paddle/phi/api/lib/sparse_bw_api.cc
1317
paddle/phi/extension.h
1418
paddle/phi/include/*
1519
paddle/phi/infermeta/generated.*
@@ -20,6 +24,7 @@ build/
2024
build_doc/
2125
*.user
2226
*.tmp
27+
*.pyc
2328

2429
.vscode
2530
.idea
@@ -48,6 +53,10 @@ tools/__pycache__
4853
# This file is automatically generated.
4954
# TODO(zhiqiang) Move this file to build directory.
5055
paddle/infrt/dialect/pd_ops.td
56+
paddle/infrt/dialect/phi/ir/phi_cpu_kernels.td
57+
paddle/infrt/dialect/phi/ir/phi_gpu_kernels.td
58+
tools/infrt/kernels.json
59+
tools/infrt/kernel_signature.json
5160
paddle/infrt/dialect/pd_ops_info.h
5261
.lit_test_times.txt
5362
paddle/infrt/tests/dialect/Output

CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ option(WITH_IPU "Compile PaddlePaddle with Graphcore IPU" OFF)
5353
# to develop some acl related functionality on x86
5454
option(WITH_ASCEND_CL "Compile PaddlePaddle with ASCEND CL" ${WITH_ASCEND})
5555
option(WITH_ASCEND_CXX11 "Compile PaddlePaddle with ASCEND and CXX11 ABI" OFF)
56+
option(WITH_ONNXRUNTIME "Compile PaddlePaddle with ONNXRUNTIME" OFF)
5657
# Note(zhouwei): It use option above, so put here
5758
include(init)
5859
include(generic) # simplify cmake module
@@ -238,7 +239,8 @@ option(WITH_MIPS "Compile PaddlePaddle with mips support" OFF)
238239
option(WITH_MUSL "Compile with musl libc instead of gblic" OFF)
239240
option(WITH_UNITY_BUILD "Compile with UnityBuild mode" OFF)
240241
option(WITH_STRIP "Strip so files of Whl packages" OFF)
241-
option(NEW_RELEASE_CUBIN "PaddlePaddle next-level release strategy for pypi cubin package" OFF)
242+
option(NEW_RELEASE_PYPI "PaddlePaddle next-level release strategy for pypi cubin package" OFF)
243+
option(NEW_RELEASE_ALL "PaddlePaddle next-level release strategy for all arches cubin package" OFF)
242244
option(NEW_RELEASE_JIT "PaddlePaddle next-level release strategy for backup jit package" OFF)
243245
option(WITH_ASCEND_INT64 "Compile with int64 kernel for ascend NPU" OFF)
244246
option(WITH_POCKETFFT "Compile with pocketfft support" ON)
@@ -330,6 +332,7 @@ if(WITH_BRPC_RDMA)
330332
endif()
331333
endif()
332334

335+
333336
if(WITH_GPU)
334337
include(cuda)
335338
# lite subgraph compilation depends on CUDNN_ROOT,

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ English | [简体中文](./README_cn.md)
1515
Welcome to the PaddlePaddle GitHub.
1616

1717
PaddlePaddle, as the only independent R&D deep learning platform in China, has been officially open-sourced to professional communities since 2016. It is an industrial platform with advanced technologies and rich features that cover core deep learning frameworks, basic model libraries, end-to-end development kits, tools & components as well as service platforms.
18-
PaddlePaddle is originated from industrial practices with dedication and commitments to industrialization. It has been widely adopted by a wide range of sectors including manufacturing, agriculture, enterprise service, and so on while serving more than 2.3 million developers. With such advantages, PaddlePaddle has helped an increasing number of partners commercialize AI.
18+
PaddlePaddle is originated from industrial practices with dedication and commitments to industrialization. It has been widely adopted by a wide range of sectors including manufacturing, agriculture, enterprise service, and so on while serving more than 4 million developers. With such advantages, PaddlePaddle has helped an increasing number of partners commercialize AI.
1919

2020

2121

README_cn.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
欢迎来到 PaddlePaddle GitHub
1717

18-
飞桨(PaddlePaddle)以百度多年的深度学习技术研究和业务应用为基础,是中国首个自主研发、功能完备、 开源开放的产业级深度学习平台,集深度学习核心训练和推理框架、基础模型库、端到端开发套件和丰富的工具组件于一体。目前,飞桨累计开发者265万,服务企业10万家,基于飞桨开源深度学习平台产生了34万个模型。飞桨助力开发者快速实现AI想法,快速上线AI业务。帮助越来越多的行业完成AI赋能,实现产业智能化升级。
18+
飞桨(PaddlePaddle)以百度多年的深度学习技术研究和业务应用为基础,是中国首个自主研发、功能完备、 开源开放的产业级深度学习平台,集深度学习核心训练和推理框架、基础模型库、端到端开发套件和丰富的工具组件于一体。目前,飞桨累计开发者406万,服务企业15.7万家,基于飞桨开源深度学习平台产生了47.6万个模型。飞桨助力开发者快速实现AI想法,快速上线AI业务。帮助越来越多的行业完成AI赋能,实现产业智能化升级。
1919

2020
## 安装
2121

cmake/cuda.cmake

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,22 @@ if(WITH_NV_JETSON)
66
add_definitions(-DWITH_NV_JETSON)
77
set(paddle_known_gpu_archs "53 62 72")
88
set(paddle_known_gpu_archs10 "53 62 72")
9-
elseif(NEW_RELEASE_CUBIN)
9+
elseif(NEW_RELEASE_ALL)
10+
message("Using New Release Strategy - All Arches Packge")
11+
add_definitions(-DNEW_RELEASE_ALL)
12+
set(paddle_known_gpu_archs "35 50 52 60 61 70 75 80 86")
13+
set(paddle_known_gpu_archs10 "35 50 52 60 61 70 75")
14+
set(paddle_known_gpu_archs11 "35 50 52 60 61 70 75 80")
15+
elseif(NEW_RELEASE_PYPI)
1016
message("Using New Release Strategy - Cubin Packge")
11-
add_definitions(-DNEW_RELEASE_CUBIN)
12-
set(paddle_known_gpu_archs "35 37 50 52 60 61 70 75 80 86")
13-
set(paddle_known_gpu_archs10 "50 60 70 75")
14-
set(paddle_known_gpu_archs11 "60 70 75 80")
17+
add_definitions(-DNEW_RELEASE_PYPI)
18+
set(paddle_known_gpu_archs "35 50 52 60 61 70 75 80 86")
19+
set(paddle_known_gpu_archs10 "")
20+
set(paddle_known_gpu_archs11 "60 61 70 75 80")
1521
elseif(NEW_RELEASE_JIT)
1622
message("Using New Release Strategy - JIT Packge")
1723
add_definitions(-DNEW_RELEASE_JIT)
18-
set(paddle_known_gpu_archs "35 37 50 52 60 61 70 75 80 86")
24+
set(paddle_known_gpu_archs "35 50 52 60 61 70 75 80 86")
1925
set(paddle_known_gpu_archs10 "35 50 60 70 75")
2026
set(paddle_known_gpu_archs11 "35 50 60 70 75 80")
2127
else()
@@ -148,7 +154,7 @@ function(select_nvcc_arch_flags out_variable)
148154

149155
# remove dots and convert to lists
150156
string(REGEX REPLACE "\\." "" cuda_arch_bin "${cuda_arch_bin}")
151-
string(REGEX REPLACE "\\." "" cuda_arch_ptx "${CUDA_ARCH_PTX}")
157+
string(REGEX REPLACE "\\." "" cuda_arch_ptx "${cuda_arch_ptx}")
152158
string(REGEX MATCHALL "[0-9()]+" cuda_arch_bin "${cuda_arch_bin}")
153159
string(REGEX MATCHALL "[0-9]+" cuda_arch_ptx "${cuda_arch_ptx}")
154160

cmake/external/cinn.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ add_definitions(-w)
2626
######################################
2727
include(ExternalProject)
2828
set(CINN_PREFIX_DIR ${THIRD_PARTY_PATH}/CINN)
29-
set(CINN_GIT_TAG release/v0.1)
29+
set(CINN_GIT_TAG 56879b637e2c4db19091eedad03d7cc674e092a2)
3030
set(CINN_OPTIONAL_ARGS -DPY_VERSION=${PY_VERSION}
3131
-DWITH_CUDA=${WITH_GPU}
3232
-DWITH_CUDNN=${WITH_GPU}

cmake/external/llvm.cmake

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,10 @@ endfunction()
9999

100100
function(mlir_add_rewriter td_base)
101101
set(LLVM_TARGET_DEFINITIONS ${td_base}.td)
102-
mlir_tablegen(${td_base}.hpp.inc -gen-rewriters "-I${CMAKE_SOURCE_DIR}/infrt/dialect/pass")
103-
add_public_tablegen_target(${td_base}_IncGen)
104-
add_custom_target(${td_base}_inc DEPENDS ${td_base}_IncGen)
102+
set(LLVM_TARGET_DEPENDS ${LLVM_TARGET_DEPENDS} ${CMAKE_SOURCE_DIR}/paddle/infrt/dialect/infrt/ir/infrt_base.td)
103+
mlir_tablegen(${td_base}.cpp.inc -gen-rewriters)
104+
add_public_tablegen_target(MLIR${td_base}IncGen)
105+
add_dependencies(mlir-headers MLIR${td_base}IncGen)
105106
endfunction()
106107

107108
# Execute the mlir script with infrt-exec program.

cmake/external/onnxruntime.cmake

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
if (NOT WITH_ONNXRUNTIME)
16+
return()
17+
endif ()
18+
19+
if (WITH_ARM)
20+
message(SEND_ERROR "The current onnxruntime backend doesn't support ARM cpu")
21+
return()
22+
endif ()
23+
24+
INCLUDE(ExternalProject)
25+
26+
add_definitions(-DPADDLE_WITH_ONNXRUNTIME)
27+
28+
SET(ONNXRUNTIME_PROJECT "extern_onnxruntime")
29+
SET(ONNXRUNTIME_PREFIX_DIR ${THIRD_PARTY_PATH}/onnxruntime)
30+
SET(ONNXRUNTIME_SOURCE_DIR ${THIRD_PARTY_PATH}/onnxruntime/src/${ONNXRUNTIME_PROJECT})
31+
SET(ONNXRUNTIME_INSTALL_DIR ${THIRD_PARTY_PATH}/install/onnxruntime)
32+
SET(ONNXRUNTIME_INC_DIR "${ONNXRUNTIME_INSTALL_DIR}/include" CACHE PATH "onnxruntime include directory." FORCE)
33+
SET(ONNXRUNTIME_LIB_DIR "${ONNXRUNTIME_INSTALL_DIR}/lib" CACHE PATH "onnxruntime lib directory." FORCE)
34+
SET(CMAKE_BUILD_RPATH "${CMAKE_BUILD_RPATH}" "${ONNXRUNTIME_LIB_DIR}")
35+
36+
37+
if (WIN32)
38+
SET(ONNXRUNTIME_URL "https://github.com/microsoft/onnxruntime/releases/download/v1.10.0/onnxruntime-win-x64-1.10.0.zip")
39+
elseif (APPLE)
40+
SET(ONNXRUNTIME_URL "https://github.com/microsoft/onnxruntime/releases/download/v1.10.0/onnxruntime-osx-x86_64-1.10.0.tgz")
41+
else ()
42+
SET(ONNXRUNTIME_URL "https://github.com/microsoft/onnxruntime/releases/download/v1.10.0/onnxruntime-linux-x64-1.10.0.tgz")
43+
endif()
44+
45+
46+
INCLUDE_DIRECTORIES(${ONNXRUNTIME_INC_DIR}) # For ONNXRUNTIME code to include internal headers.
47+
if (WIN32)
48+
SET(ONNXRUNTIME_SOURCE_LIB "${ONNXRUNTIME_SOURCE_DIR}/lib/onnxruntime.dll" CACHE FILEPATH "ONNXRUNTIME source library." FORCE)
49+
SET(ONNXRUNTIME_SHARED_LIB "${ONNXRUNTIME_INSTALL_DIR}/lib/onnxruntime.dll" CACHE FILEPATH "ONNXRUNTIME shared library." FORCE)
50+
SET(ONNXRUNTIME_LIB "${ONNXRUNTIME_INSTALL_DIR}/lib/onnxruntime.lib" CACHE FILEPATH "ONNXRUNTIME static library." FORCE)
51+
elseif (APPLE)
52+
SET(ONNXRUNTIME_SOURCE_LIB "${ONNXRUNTIME_SOURCE_DIR}/lib/libonnxruntime.1.10.0.dylib" CACHE FILEPATH "ONNXRUNTIME source library." FORCE)
53+
SET(ONNXRUNTIME_LIB "${ONNXRUNTIME_INSTALL_DIR}/lib/libonnxruntime.1.10.0.dylib" CACHE FILEPATH "ONNXRUNTIME static library." FORCE)
54+
SET(ONNXRUNTIME_SHARED_LIB ${ONNXRUNTIME_LIB} CACHE FILEPATH "ONNXRUNTIME shared library." FORCE)
55+
else ()
56+
SET(ONNXRUNTIME_SOURCE_LIB "${ONNXRUNTIME_SOURCE_DIR}/lib/libonnxruntime.so.1.10.0" CACHE FILEPATH "ONNXRUNTIME source library." FORCE)
57+
SET(ONNXRUNTIME_LIB "${ONNXRUNTIME_INSTALL_DIR}/lib/libonnxruntime.so.1.10.0" CACHE FILEPATH "ONNXRUNTIME static library." FORCE)
58+
SET(ONNXRUNTIME_SHARED_LIB ${ONNXRUNTIME_LIB} CACHE FILEPATH "ONNXRUNTIME shared library." FORCE)
59+
endif ()
60+
61+
if (WIN32)
62+
ExternalProject_Add(
63+
${ONNXRUNTIME_PROJECT}
64+
${EXTERNAL_PROJECT_LOG_ARGS}
65+
URL ${ONNXRUNTIME_URL}
66+
PREFIX ${ONNXRUNTIME_PREFIX_DIR}
67+
DOWNLOAD_NO_PROGRESS 1
68+
CONFIGURE_COMMAND ""
69+
BUILD_COMMAND ""
70+
UPDATE_COMMAND ""
71+
INSTALL_COMMAND ${CMAKE_COMMAND} -E copy ${ONNXRUNTIME_SOURCE_LIB} ${ONNXRUNTIME_SHARED_LIB} &&
72+
${CMAKE_COMMAND} -E copy ${ONNXRUNTIME_SOURCE_DIR}/lib/onnxruntime.lib ${ONNXRUNTIME_LIB} &&
73+
${CMAKE_COMMAND} -E copy_directory ${ONNXRUNTIME_SOURCE_DIR}/include ${ONNXRUNTIME_INC_DIR}
74+
BUILD_BYPRODUCTS ${ONNXRUNTIME_LIB}
75+
)
76+
else ()
77+
ExternalProject_Add(
78+
${ONNXRUNTIME_PROJECT}
79+
${EXTERNAL_PROJECT_LOG_ARGS}
80+
URL ${ONNXRUNTIME_URL}
81+
PREFIX ${ONNXRUNTIME_PREFIX_DIR}
82+
DOWNLOAD_NO_PROGRESS 1
83+
CONFIGURE_COMMAND ""
84+
BUILD_COMMAND ""
85+
UPDATE_COMMAND ""
86+
INSTALL_COMMAND ${CMAKE_COMMAND} -E copy ${ONNXRUNTIME_SOURCE_LIB} ${ONNXRUNTIME_LIB} &&
87+
${CMAKE_COMMAND} -E copy_directory ${ONNXRUNTIME_SOURCE_DIR}/include ${ONNXRUNTIME_INC_DIR}
88+
BUILD_BYPRODUCTS ${ONNXRUNTIME_LIB}
89+
)
90+
endif()
91+
92+
ADD_LIBRARY(onnxruntime STATIC IMPORTED GLOBAL)
93+
SET_PROPERTY(TARGET onnxruntime PROPERTY IMPORTED_LOCATION ${ONNXRUNTIME_LIB})
94+
ADD_DEPENDENCIES(onnxruntime ${ONNXRUNTIME_PROJECT})

cmake/external/paddle2onnx.cmake

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
if(NOT WITH_ONNXRUNTIME)
16+
return()
17+
endif()
18+
19+
if (WITH_ARM)
20+
message(SEND_ERROR "The current onnxruntime backend doesn't support ARM cpu")
21+
return()
22+
endif ()
23+
24+
INCLUDE(ExternalProject)
25+
26+
SET(PADDLE2ONNX_PROJECT "extern_paddle2onnx")
27+
SET(PADDLE2ONNX_PREFIX_DIR ${THIRD_PARTY_PATH}/paddle2onnx)
28+
SET(PADDLE2ONNX_INSTALL_DIR ${THIRD_PARTY_PATH}/install/paddle2onnx)
29+
SET(PADDLE2ONNX_INC_DIR "${PADDLE2ONNX_INSTALL_DIR}/include" CACHE PATH "paddle2onnx include directory." FORCE)
30+
SET(PADDLE2ONNX_REPOSITORY ${GIT_URL}/PaddlePaddle/Paddle2ONNX.git)
31+
SET(PADDLE2ONNX_TAG cpp)
32+
SET(LIBDIR "lib")
33+
SET(CMAKE_BUILD_RPATH "${CMAKE_BUILD_RPATH}" "${PADDLE2ONNX_INSTALL_DIR}/${LIBDIR}")
34+
35+
INCLUDE_DIRECTORIES(${PADDLE2ONNX_INC_DIR}) # For PADDLE2ONNX code to include internal headers.
36+
if(WIN32)
37+
SET(PADDLE2ONNX_LIB "${PADDLE2ONNX_INSTALL_DIR}/${LIBDIR}/paddle2onnx.lib" CACHE FILEPATH "paddle2onnx static library." FORCE)
38+
SET(PADDLE2ONNX_SHARED_LIB "${PADDLE2ONNX_INSTALL_DIR}/${LIBDIR}/paddle2onnx.dll" CACHE FILEPATH "paddle2onnx shared library." FORCE)
39+
elseif(APPLE)
40+
SET(PADDLE2ONNX_LIB "${PADDLE2ONNX_INSTALL_DIR}/${LIBDIR}/libpaddle2onnx.dylib" CACHE FILEPATH "PADDLE2ONNX library." FORCE)
41+
else()
42+
SET(PADDLE2ONNX_LIB "${PADDLE2ONNX_INSTALL_DIR}/${LIBDIR}/libpaddle2onnx.so" CACHE FILEPATH "PADDLE2ONNX library." FORCE)
43+
endif(WIN32)
44+
45+
46+
# The protoc path is required to compile onnx.
47+
string(REPLACE "/" ";" PROTOC_BIN_PATH ${PROTOBUF_PROTOC_EXECUTABLE})
48+
list(POP_BACK PROTOC_BIN_PATH)
49+
list(JOIN PROTOC_BIN_PATH "/" PROTOC_BIN_PATH)
50+
51+
52+
set(PADDLE2ONNX_OPTIONAL_ARGS
53+
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
54+
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
55+
-DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}
56+
-DCMAKE_CXX_FLAGS_RELEASE=${CMAKE_CXX_FLAGS_RELEASE}
57+
-DCMAKE_CXX_FLAGS_DEBUG=${CMAKE_CXX_FLAGS_DEBUG}
58+
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
59+
-DCMAKE_C_FLAGS_DEBUG=${CMAKE_C_FLAGS_DEBUG}
60+
-DCMAKE_C_FLAGS_RELEASE=${CMAKE_C_FLAGS_RELEASE}
61+
-DONNX_CUSTOM_PROTOC_PATH=${PROTOC_BIN_PATH}
62+
-DWITH_STATIC=OFF
63+
-DCMAKE_INSTALL_PREFIX=${PADDLE2ONNX_INSTALL_DIR}
64+
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
65+
-DCMAKE_BUILD_TYPE=${THIRD_PARTY_BUILD_TYPE}
66+
${EXTERNAL_OPTIONAL_ARGS}
67+
)
68+
69+
if (WITH_PYTHON)
70+
set(PADDLE2ONNX_OPTIONAL_ARGS ${PADDLE2ONNX_OPTIONAL_ARGS}
71+
-DPYTHON_EXECUTABLE:FILEPATH=${PYTHON_EXECUTABLE}
72+
-DPYTHON_INCLUDE_DIR:PATH=${PYTHON_INCLUDE_DIR}
73+
-DPYTHON_LIBRARY:FILEPATH=${PYTHON_LIBRARY}
74+
)
75+
endif ()
76+
77+
78+
ExternalProject_Add(
79+
${PADDLE2ONNX_PROJECT}
80+
${EXTERNAL_PROJECT_LOG_ARGS}
81+
${SHALLOW_CLONE}
82+
GIT_REPOSITORY ${PADDLE2ONNX_REPOSITORY}
83+
GIT_TAG ${PADDLE2ONNX_TAG}
84+
DEPENDS protobuf
85+
PREFIX ${PADDLE2ONNX_PREFIX_DIR}
86+
UPDATE_COMMAND ""
87+
CMAKE_ARGS ${PADDLE2ONNX_OPTIONAL_ARGS}
88+
CMAKE_CACHE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${PADDLE2ONNX_INSTALL_DIR}
89+
-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON
90+
-DCMAKE_BUILD_TYPE:STRING=${THIRD_PARTY_BUILD_TYPE}
91+
BUILD_BYPRODUCTS ${PADDLE2ONNX_LIB}
92+
)
93+
94+
ADD_LIBRARY(paddle2onnx STATIC IMPORTED GLOBAL)
95+
SET_PROPERTY(TARGET paddle2onnx PROPERTY IMPORTED_LOCATION ${PADDLE2ONNX_LIB})
96+
ADD_DEPENDENCIES(paddle2onnx ${PADDLE2ONNX_PROJECT})

cmake/external/protobuf.cmake

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,11 @@ FUNCTION(build_protobuf TARGET_NAME BUILD_FOR_HOST)
198198
"-Dprotobuf_MSVC_STATIC_RUNTIME=${MSVC_STATIC_CRT}")
199199
ENDIF()
200200

201-
if(WITH_ASCEND AND NOT WITH_ASCEND_CXX11)
201+
202+
if(WITH_ONNXRUNTIME)
203+
SET(PROTOBUF_REPOSITORY ${GIT_URL}/protocolbuffers/protobuf.git)
204+
SET(PROTOBUF_TAG v3.18.0)
205+
elseif(WITH_ASCEND AND NOT WITH_ASCEND_CXX11)
202206
SET(PROTOBUF_REPOSITORY https://gitee.com/tianjianhe/protobuf.git)
203207
SET(PROTOBUF_TAG v3.8.0)
204208
elseif(WITH_ASCEND_CL AND NOT WITH_ASCEND_CXX11)
@@ -248,7 +252,9 @@ FUNCTION(build_protobuf TARGET_NAME BUILD_FOR_HOST)
248252
)
249253
ENDFUNCTION()
250254

251-
if(WITH_ASCEND OR WITH_ASCEND_CL)
255+
if(WITH_ONNXRUNTIME)
256+
SET(PROTOBUF_VERSION 3.18.0)
257+
elseif(WITH_ASCEND OR WITH_ASCEND_CL)
252258
SET(PROTOBUF_VERSION 3.8.0)
253259
elseif(WITH_IPU)
254260
SET(PROTOBUF_VERSION 3.6.1)

0 commit comments

Comments
 (0)