Skip to content

Commit 9722a2f

Browse files
committed
Merge branch 'develop' of https://github.com/PaddlePaddle/Paddle into rewrite_multi_gru
2 parents 4d3ad62 + 8df8cb1 commit 9722a2f

File tree

477 files changed

+15138
-4546
lines changed

Some content is hidden

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

477 files changed

+15138
-4546
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,7 @@ option(WITH_CUDNN_FRONTEND
315315
"Compile with CUDNN Frontend API support (experimental)" OFF)
316316
option(WITH_CUDNN_DSO "Compile PaddlePaddle with cuDNN dynamic-link libraries"
317317
OFF)
318+
option(WITH_NEWIR "Compile PaddlePaddle with NEWIR" OFF)
318319

319320
if(WITH_RECORD_BUILDTIME)
320321
set_property(

cmake/external/cinn.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ if(NOT WITH_CINN)
1717
endif()
1818

1919
if(NOT CINN_GIT_TAG)
20-
# 2023.01.28 commit
21-
set(CINN_GIT_TAG 1449890f7724babf2a343c6f8073bd28a7bbc683)
20+
# 2023.02.09 commit
21+
set(CINN_GIT_TAG 63cf4267a0f8756df61b0dca5fb30bf3748ba2f4)
2222
endif()
2323

2424
message(STATUS "CINN version: " ${CINN_GIT_TAG})

cmake/external/leveldb.cmake

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@ set(LEVELDB_LIBRARIES
2323
"${LEVELDB_INSTALL_DIR}/lib/libleveldb.a"
2424
CACHE FILEPATH "leveldb library." FORCE)
2525
include_directories(${LEVELDB_INCLUDE_DIR})
26-
26+
set(LEVELDN_CXXFLAGS "-fPIC")
27+
if(WITH_HETERPS AND WITH_PSLIB)
28+
set(LEVELDN_CXXFLAGS "${LEVELDN_CXXFLAGS} -D_GLIBCXX_USE_CXX11_ABI=0")
29+
endif()
2730
ExternalProject_Add(
2831
extern_leveldb
2932
${EXTERNAL_PROJECT_LOG_ARGS}
@@ -32,15 +35,15 @@ ExternalProject_Add(
3235
GIT_TAG v1.18
3336
UPDATE_COMMAND ""
3437
CONFIGURE_COMMAND ""
35-
BUILD_COMMAND CXXFLAGS=-fPIC make -j ${NUM_OF_PROCESSOR} libleveldb.a
38+
BUILD_COMMAND export "CXXFLAGS=${LEVELDN_CXXFLAGS}" && make -j
39+
${NUM_OF_PROCESSOR} libleveldb.a
3640
INSTALL_COMMAND
3741
mkdir -p ${LEVELDB_INSTALL_DIR}/lib/ && cp
3842
${LEVELDB_PREFIX_DIR}/src/extern_leveldb/libleveldb.a ${LEVELDB_LIBRARIES}
3943
&& cp -r ${LEVELDB_PREFIX_DIR}/src/extern_leveldb/include
4044
${LEVELDB_INSTALL_DIR}/
4145
BUILD_IN_SOURCE 1
4246
BUILD_BYPRODUCTS ${LEVELDB_LIBRARIES})
43-
4447
add_dependencies(extern_leveldb snappy)
4548

4649
add_library(leveldb STATIC IMPORTED GLOBAL)

cmake/external/lite.cmake

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,11 @@ if(NOT LITE_SOURCE_DIR OR NOT LITE_BINARY_DIR)
120120
${LITE_PREFIX_DIR}/src/extern_lite/cmake/os/armlinux.cmake
121121
UPDATE_COMMAND ""
122122
BUILD_COMMAND ${LITE_BUILD_COMMAND}
123-
INSTALL_COMMAND ""
123+
INSTALL_COMMAND
124+
cp ${PADDLE_BINARY_DIR}/paddle/fluid/framework/framework.pb.cc
125+
${LITE_PREFIX_DIR}/src/extern_lite-build/lite/core/ && cp
126+
${PADDLE_BINARY_DIR}/paddle/fluid/framework/framework.pb.h
127+
${LITE_PREFIX_DIR}/src/extern_lite-build/lite/core/
124128
CMAKE_ARGS -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
125129
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
126130
-DCMAKE_CXX_FLAGS=${LITE_CMAKE_CXX_FLAGS}
@@ -169,7 +173,11 @@ if(NOT LITE_SOURCE_DIR OR NOT LITE_BINARY_DIR)
169173
"s?NNadapter_bridges_path = os.path.abspath('..')+\"\/lite\/kernels\/nnadapter\/bridges\/paddle_use_bridges.h\"?NNadapter_bridges_path = os.path.abspath(\'..\')+\"\/extern_lite\/lite\/kernels\/nnadapter\/bridges\/paddle_use_bridges.h\"?"
170174
${LITE_PREFIX_DIR}/src/extern_lite//lite/tools/cmake_tools/record_supported_kernel_op.py
171175
BUILD_COMMAND ${LITE_BUILD_COMMAND}
172-
INSTALL_COMMAND ""
176+
INSTALL_COMMAND
177+
cp ${PADDLE_BINARY_DIR}/paddle/fluid/framework/framework.pb.cc
178+
${LITE_PREFIX_DIR}/src/extern_lite-build/lite/core/ && cp
179+
${PADDLE_BINARY_DIR}/paddle/fluid/framework/framework.pb.h
180+
${LITE_PREFIX_DIR}/src/extern_lite-build/lite/core/
173181
CMAKE_ARGS -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
174182
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
175183
-DCMAKE_CXX_FLAGS=${LITE_CMAKE_CXX_FLAGS}

cmake/external/protobuf.cmake

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ function(protobuf_generate_python SRCS)
7575
list(APPEND ${SRCS} "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}_pb2.py")
7676
add_custom_command(
7777
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}_pb2.py"
78-
COMMAND ${PROTOBUF_PROTOC_EXECUTABLE} --python_out
79-
${CMAKE_CURRENT_BINARY_DIR} ${_protobuf_include_path} ${ABS_FIL}
78+
COMMAND ${PROTOBUF_PROTOC_EXECUTABLE} --python_out ${PADDLE_BINARY_DIR}
79+
-I${PADDLE_SOURCE_DIR} ${ABS_FIL}
8080
DEPENDS ${ABS_FIL} ${PROTOBUF_PROTOC_EXECUTABLE}
8181
COMMENT "Running Python protocol buffer compiler on ${FIL}"
8282
VERBATIM)
@@ -236,24 +236,24 @@ function(build_protobuf TARGET_NAME BUILD_FOR_HOST)
236236

237237
if(WITH_ASCEND AND NOT WITH_ASCEND_CXX11)
238238
set(PROTOBUF_REPOSITORY https://gitee.com/tianjianhe/protobuf.git)
239-
set(PROTOBUF_TAG v3.8.0)
239+
set(PROTOBUF_TAG v21.12)
240240
elseif(WITH_ASCEND_CL AND NOT WITH_ASCEND_CXX11)
241241
set(PROTOBUF_REPOSITORY https://gitee.com/tianjianhe/protobuf.git)
242-
set(PROTOBUF_TAG v3.8.0)
242+
set(PROTOBUF_TAG v21.12)
243243
elseif(WITH_IPU)
244244
set(PROTOBUF_REPOSITORY ${GIT_URL}/protocolbuffers/protobuf.git)
245-
set(PROTOBUF_TAG d750fbf648256c7c631f51ffdbf67d7c18b0114e)
245+
set(PROTOBUF_TAG v21.12)
246246
elseif(WIN32)
247247
set(PROTOBUF_REPOSITORY ${GIT_URL}/protocolbuffers/protobuf.git)
248248
# Change the tag to support building with vs2019
249249
set(PROTOBUF_TAG 01a05a53f40ca2ac5f0af10c6cc0810bee39b792)
250250
else()
251251
set(PROTOBUF_REPOSITORY ${GIT_URL}/protocolbuffers/protobuf.git)
252-
set(PROTOBUF_TAG 9f75c5aa851cd877fb0d93ccc31b8567a6706546)
252+
set(PROTOBUF_TAG v21.12)
253253
if(WITH_GPU)
254254
if(${CMAKE_CUDA_COMPILER_VERSION} LESS 12.0
255255
AND ${CMAKE_CXX_COMPILER_VERSION} VERSION_GREATER 12.0)
256-
set(PROTOBUF_TAG 2dc747c574b68a808ea4699d26942c8132fe2b09)
256+
set(PROTOBUF_TAG v21.12)
257257
endif()
258258
endif()
259259
endif()
@@ -321,17 +321,17 @@ function(build_protobuf TARGET_NAME BUILD_FOR_HOST)
321321
endfunction()
322322

323323
if(WITH_ASCEND OR WITH_ASCEND_CL)
324-
set(PROTOBUF_VERSION 3.8.0)
324+
set(PROTOBUF_VERSION 21.12)
325325
elseif(WITH_IPU)
326-
set(PROTOBUF_VERSION 3.6.1)
326+
set(PROTOBUF_VERSION 21.12)
327327
elseif(WITH_ARM_BRPC)
328-
set(PROTOBUF_VERSION 3.7.1-baidu-ee-common)
328+
set(PROTOBUF_VERSION 21.12-baidu-ee-common)
329329
else()
330-
set(PROTOBUF_VERSION 3.1.0)
330+
set(PROTOBUF_VERSION 21.12)
331331
if(WITH_GPU)
332332
if(${CMAKE_CUDA_COMPILER_VERSION} LESS 12.0
333333
AND ${CMAKE_CXX_COMPILER_VERSION} VERSION_GREATER 12.0)
334-
set(PROTOBUF_VERSION 3.16.0)
334+
set(PROTOBUF_VERSION 21.12)
335335
endif()
336336
endif()
337337
endif()

cmake/generic.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1063,8 +1063,8 @@ function(paddle_protobuf_generate_cpp SRCS HDRS)
10631063
add_custom_command(
10641064
OUTPUT "${_protobuf_protoc_src}" "${_protobuf_protoc_hdr}"
10651065
COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CURRENT_BINARY_DIR}"
1066-
COMMAND ${PROTOBUF_PROTOC_EXECUTABLE} -I${CMAKE_CURRENT_SOURCE_DIR}
1067-
--cpp_out "${CMAKE_CURRENT_BINARY_DIR}" ${ABS_FIL}
1066+
COMMAND ${PROTOBUF_PROTOC_EXECUTABLE} -I${PADDLE_SOURCE_DIR} --cpp_out
1067+
"${PADDLE_BINARY_DIR}" ${ABS_FIL}
10681068
# Set `EXTERN_PROTOBUF_DEPEND` only if need to compile `protoc.exe`.
10691069
DEPENDS ${ABS_FIL} ${EXTERN_PROTOBUF_DEPEND}
10701070
COMMENT "Running C++ protocol buffer compiler on ${FIL}"

cmake/operators.cmake

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,7 @@ endfunction()
2828

2929
function(find_phi_register FILENAME ADD_PATH PATTERN)
3030
# set op_name to OUTPUT
31-
set(options "")
32-
set(oneValueArgs "")
33-
set(multiValueArgs "")
3431
file(READ ${FILENAME} CONTENT)
35-
3632
string(
3733
REGEX
3834
MATCH
@@ -402,6 +398,7 @@ function(op_library TARGET)
402398
set(op_name "")
403399
# Add PHI Kernel Registry Message
404400
find_phi_register(${cc_src} ${pybind_file} "PD_REGISTER_KERNEL")
401+
find_phi_register(${cc_src} ${pybind_file} "PD_REGISTER_STRUCT_KERNEL")
405402
find_phi_register(${cc_src} ${pybind_file} "PD_REGISTER_GENERAL_KERNEL")
406403
find_register(${cc_src} "REGISTER_OPERATOR" op_name)
407404
if(NOT ${op_name} EQUAL "")
@@ -453,6 +450,7 @@ function(op_library TARGET)
453450
set(op_name "")
454451
# Add PHI Kernel Registry Message
455452
find_phi_register(${cu_src} ${pybind_file} "PD_REGISTER_KERNEL")
453+
find_phi_register(${cu_src} ${pybind_file} "PD_REGISTER_STRUCT_KERNEL")
456454
find_phi_register(${cu_src} ${pybind_file} "PD_REGISTER_GENERAL_KERNEL")
457455
find_register(${cu_src} "REGISTER_OP_CUDA_KERNEL" op_name)
458456
if(NOT ${op_name} EQUAL "")

paddle/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ add_subdirectory(phi)
1313
add_subdirectory(infrt)
1414
add_subdirectory(fluid)
1515

16+
add_subdirectory(ir)
17+
1618
# NOTE(zhiqiu): The changes of cc tests
1719
# Before, (1) the source file of cc tests are distributed in different sub-directories,
1820
# (2) the tests are added and configured by calling `cc_test()` in each `CMakeLists.txt`,

paddle/fluid/distributed/collective/process_group_custom.cc

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,12 +153,10 @@ void ProcessGroupCustom::CreateCustomManagerCache(
153153
std::vector<std::unique_ptr<CustomDeviceContext>> dev_ctx;
154154
dev_ctx.resize(places.size());
155155

156-
std::unique_ptr<phi::ccl::CCLComm> comms(
157-
new phi::ccl::CCLComm[places.size()]);
158156
for (size_t i = 0; i < places.size(); ++i) {
159157
phi::DeviceGuard guard(places[i]);
160158
ccl_comms[i] = CustomCCLCommManager::Create(
161-
device_type, GetSize(), GetRank(), &ccl_id, comms.get() + i);
159+
device_type, GetSize(), GetRank(), &ccl_id, new phi::ccl::CCLComm);
162160
dev_ctx[i].reset(new CustomDeviceContext(places[i]));
163161
}
164162

paddle/fluid/distributed/collective/reducer.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1113,7 +1113,7 @@ void EagerReducer::AllReduceSparse(EagerGroup *group,
11131113
const auto &rank_ = process_group_->GetRank();
11141114
const auto &size_ = process_group_->GetSize();
11151115

1116-
framework::Vector<int64_t> rows_num_vector(size_);
1116+
phi::Vector<int64_t> rows_num_vector(size_);
11171117
rows_num_vector[rank_] = static_cast<int64_t>(src_rows.size());
11181118

11191119
Tensor rows_num_tensor = paddle::experimental::empty(
@@ -1183,7 +1183,7 @@ void EagerReducer::AllReduceSparse(EagerGroup *group,
11831183
}
11841184
process_group_->AllGather(in, out)->Synchronize();
11851185

1186-
framework::Vector<int64_t> dst_rows_vector(rows_num, 0);
1186+
phi::Vector<int64_t> dst_rows_vector(rows_num, 0);
11871187
auto *dst_rows_dense_tensor =
11881188
std::dynamic_pointer_cast<phi::DenseTensor>(dst_rows_tensor.impl())
11891189
.get();
@@ -1262,7 +1262,7 @@ void EagerReducer::AllReduceSparse(EagerGroup *group,
12621262

12631263
Tensor dst_rows_tensor =
12641264
paddle::experimental::concat(rows_tensors, phi::Scalar(0));
1265-
framework::Vector<int64_t> dst_rows_vector(rows_num, 0);
1265+
phi::Vector<int64_t> dst_rows_vector(rows_num, 0);
12661266
auto *dst_rows_dense_tensor =
12671267
std::dynamic_pointer_cast<phi::DenseTensor>(dst_rows_tensor.impl())
12681268
.get();

paddle/fluid/distributed/fleet_executor/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ proto_library(interceptor_message_proto SRCS interceptor_message.proto)
66

77
if(WITH_ARM_BRPC)
88
set(BRPC_DEPS arm_brpc snappy gflags glog)
9-
elseif(WITH_DISTRIBUTE)
9+
elseif(WITH_DISTRIBUTE AND NOT WITH_PSLIB)
1010
set(BRPC_DEPS
1111
brpc
1212
ssl

paddle/fluid/distributed/fleet_executor/dist_model.cc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,10 +433,15 @@ bool DistModel::PrepareFleetExe() {
433433
executor_desc_ = FleetExecutorDesc();
434434
executor_desc_.set_cur_rank(config_.local_rank);
435435
std::unordered_map<int64_t, int64_t> id_to_rank;
436+
436437
for (int i = 0; i < config_.nranks; ++i) {
437438
RankInfo *rank_info = executor_desc_.add_cluster_info();
438439
rank_info->set_rank(i);
439-
rank_info->set_ip_port(config_.trainer_endpoints[i]);
440+
if (config_.nranks == 1) {
441+
rank_info->set_ip_port("");
442+
} else {
443+
rank_info->set_ip_port(config_.trainer_endpoints[i]);
444+
}
440445
id_to_rank.insert({i, i});
441446
}
442447
fleet_exe.reset(new FleetExecutor(executor_desc_));

0 commit comments

Comments
 (0)