-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Upgrade protobuf to 4.21.x #49168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upgrade protobuf to 4.21.x #49168
Changes from 42 commits
9c5433f
46fee37
2eaa5ba
8936be4
57d3d28
166a8e6
6e6781f
e9559c5
dac9d9c
4ab81ef
3c917bc
6472685
9af85b4
45ddb5f
2b321f9
290d621
0d8b4ad
36e3be8
9540763
461a5f7
d6ac6ab
53d586b
8df27c9
f5bfedb
62afefc
1f917b3
a3419f9
ee84d4b
8754fa9
ad98b03
6f33c4c
4fd60cb
51beac2
5ac619f
d752353
8e2cd11
d68be19
5d3a118
37d44ac
660622f
09c0b39
096fd88
1dc7d2e
59bbe6c
3375564
dfaf0aa
76c16d8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -75,8 +75,8 @@ function(protobuf_generate_python SRCS) | |
list(APPEND ${SRCS} "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}_pb2.py") | ||
add_custom_command( | ||
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}_pb2.py" | ||
COMMAND ${PROTOBUF_PROTOC_EXECUTABLE} --python_out | ||
${CMAKE_CURRENT_BINARY_DIR} ${_protobuf_include_path} ${ABS_FIL} | ||
COMMAND ${PROTOBUF_PROTOC_EXECUTABLE} --python_out ${PADDLE_BINARY_DIR} | ||
-I${PADDLE_SOURCE_DIR} ${ABS_FIL} | ||
DEPENDS ${ABS_FIL} ${PROTOBUF_PROTOC_EXECUTABLE} | ||
COMMENT "Running Python protocol buffer compiler on ${FIL}" | ||
VERBATIM) | ||
|
@@ -236,24 +236,24 @@ function(build_protobuf TARGET_NAME BUILD_FOR_HOST) | |
|
||
if(WITH_ASCEND AND NOT WITH_ASCEND_CXX11) | ||
set(PROTOBUF_REPOSITORY https://gitee.com/tianjianhe/protobuf.git) | ||
set(PROTOBUF_TAG v3.8.0) | ||
set(PROTOBUF_TAG v21.12) | ||
elseif(WITH_ASCEND_CL AND NOT WITH_ASCEND_CXX11) | ||
set(PROTOBUF_REPOSITORY https://gitee.com/tianjianhe/protobuf.git) | ||
set(PROTOBUF_TAG v3.8.0) | ||
set(PROTOBUF_TAG v21.12) | ||
elseif(WITH_IPU) | ||
set(PROTOBUF_REPOSITORY ${GIT_URL}/protocolbuffers/protobuf.git) | ||
set(PROTOBUF_TAG d750fbf648256c7c631f51ffdbf67d7c18b0114e) | ||
set(PROTOBUF_TAG v21.12) | ||
elseif(WIN32) | ||
set(PROTOBUF_REPOSITORY ${GIT_URL}/protocolbuffers/protobuf.git) | ||
# Change the tag to support building with vs2019 | ||
set(PROTOBUF_TAG 01a05a53f40ca2ac5f0af10c6cc0810bee39b792) | ||
set(PROTOBUF_TAG v21.12) | ||
else() | ||
set(PROTOBUF_REPOSITORY ${GIT_URL}/protocolbuffers/protobuf.git) | ||
set(PROTOBUF_TAG 9f75c5aa851cd877fb0d93ccc31b8567a6706546) | ||
set(PROTOBUF_TAG v21.12) | ||
if(WITH_GPU) | ||
if(${CMAKE_CUDA_COMPILER_VERSION} LESS 12.0 | ||
AND ${CMAKE_CXX_COMPILER_VERSION} VERSION_GREATER 12.0) | ||
set(PROTOBUF_TAG 2dc747c574b68a808ea4699d26942c8132fe2b09) | ||
set(PROTOBUF_TAG v21.12) | ||
endif() | ||
endif() | ||
endif() | ||
|
@@ -321,17 +321,17 @@ function(build_protobuf TARGET_NAME BUILD_FOR_HOST) | |
endfunction() | ||
|
||
if(WITH_ASCEND OR WITH_ASCEND_CL) | ||
set(PROTOBUF_VERSION 3.8.0) | ||
set(PROTOBUF_VERSION 21.12) | ||
elseif(WITH_IPU) | ||
set(PROTOBUF_VERSION 3.6.1) | ||
set(PROTOBUF_VERSION 21.12) | ||
elseif(WITH_ARM_BRPC) | ||
set(PROTOBUF_VERSION 3.7.1-baidu-ee-common) | ||
set(PROTOBUF_VERSION 21.12-baidu-ee-common) | ||
else() | ||
set(PROTOBUF_VERSION 3.1.0) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 不重要,这里windows上的PROTOBUF_VERSION不是21.12? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 不是,还是之前的低版本protobuf_version There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 是否需要为windows加一个PROTOBUF_VERSION的判断逻辑? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok,我下一个PR加一下,这样更好 |
||
set(PROTOBUF_VERSION 21.12) | ||
if(WITH_GPU) | ||
if(${CMAKE_CUDA_COMPILER_VERSION} LESS 12.0 | ||
AND ${CMAKE_CXX_COMPILER_VERSION} VERSION_GREATER 12.0) | ||
set(PROTOBUF_VERSION 3.16.0) | ||
set(PROTOBUF_VERSION 21.12) | ||
endif() | ||
endif() | ||
endif() | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1063,8 +1063,8 @@ function(paddle_protobuf_generate_cpp SRCS HDRS) | |
add_custom_command( | ||
OUTPUT "${_protobuf_protoc_src}" "${_protobuf_protoc_hdr}" | ||
COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CURRENT_BINARY_DIR}" | ||
COMMAND ${PROTOBUF_PROTOC_EXECUTABLE} -I${CMAKE_CURRENT_SOURCE_DIR} | ||
--cpp_out "${CMAKE_CURRENT_BINARY_DIR}" ${ABS_FIL} | ||
COMMAND ${PROTOBUF_PROTOC_EXECUTABLE} -I${PADDLE_SOURCE_DIR} --cpp_out | ||
"${PADDLE_BINARY_DIR}" ${ABS_FIL} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why change dir? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. protoc编译的时候,推荐使用根目录,然后以绝对路径import文件 |
||
# Set `EXTERN_PROTOBUF_DEPEND` only if need to compile `protoc.exe`. | ||
DEPENDS ${ABS_FIL} ${EXTERN_PROTOBUF_DEPEND} | ||
COMMENT "Running C++ protocol buffer compiler on ${FIL}" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,9 +30,8 @@ inline __device__ bool AttemptInsert( | |
static_cast<unsigned int>(-1), | ||
static_cast<unsigned int>(id)); | ||
if (key == -1 || key == id) { | ||
atomicMin( | ||
reinterpret_cast<unsigned long long int*>(&key_index[pos]), // NOLINT | ||
static_cast<unsigned long long int>(index)); // NOLINT | ||
atomicMin(reinterpret_cast<unsigned int*>(&key_index[pos]), // NOLINT | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why need to change it? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 多谢review,这个之前实验的时候改的数据类型,忘了改回来,下个PR把这个改回来。 |
||
static_cast<unsigned int>(index)); // NOLINT | ||
return true; | ||
} else { | ||
return false; | ||
|
@@ -43,9 +42,8 @@ inline __device__ bool AttemptInsert( | |
static_cast<unsigned long long int>(-1), // NOLINT | ||
static_cast<unsigned long long int>(id)); // NOLINT | ||
if (key == -1 || key == id) { | ||
atomicMin( | ||
reinterpret_cast<unsigned long long int*>(&key_index[pos]), // NOLINT | ||
static_cast<unsigned long long int>(index)); // NOLINT | ||
atomicMin(reinterpret_cast<unsigned int*>(&key_index[pos]), // NOLINT | ||
static_cast<unsigned int>(index)); // NOLINT | ||
return true; | ||
} else { | ||
return false; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
requests>=2.20.0 | ||
numpy>=1.13 | ||
protobuf>=3.1.0, <=3.20.2 | ||
protobuf>=3.1.0 | ||
Pillow | ||
decorator | ||
astor | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ASCEND和IPU这些新硬件设备应该不用改tag吧?不过新硬件设备上编译时可能没有走这些分支。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
应该不用