Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/PaddlePaddle/Paddle into…
Browse files Browse the repository at this point in the history
… place_for_all
  • Loading branch information
jiweibo committed Jan 16, 2022
2 parents 87111ea + 5c35867 commit 4a5e80f
Show file tree
Hide file tree
Showing 208 changed files with 2,432 additions and 1,873 deletions.
13 changes: 8 additions & 5 deletions cmake/external/llvm.cmake
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
include(FetchContent)

set(LLVM_DOWNLOAD_URL https://paddle-inference-dist.bj.bcebos.com/CINN/llvm11.tar.gz)
set(LLVM_MD5 39d32b6be466781dddf5869318dcba53)
set(LLVM_DOWNLOAD_URL https://paddle-inference-dist.bj.bcebos.com/infrt/llvm_b5149f4e66a49a98b67e8e2de4e24a4af8e2781b.tar.gz)
set(LLVM_MD5 022819bb5760817013cf4b8a37e97d5e)

set(FETCHCONTENT_BASE_DIR ${THIRD_PARTY_PATH}/llvm)
set(FETCHCONTENT_QUIET OFF)
Expand Down Expand Up @@ -51,16 +51,18 @@ message(STATUS "Using LLVMConfig.cmake in: ${LLVM_DIR}")
# To build with MLIR, the LLVM is build from source code using the following flags:

#[==[
cmake -G Ninja ../llvm \
cmake ../llvm -G "Unix Makefiles" \
-DLLVM_ENABLE_PROJECTS="mlir;clang" \
-DLLVM_BUILD_EXAMPLES=OFF \
-DLLVM_TARGETS_TO_BUILD="X86" \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_ENABLE_ASSERTIONS=ON \
-DLLVM_ENABLE_ZLIB=OFF \
-DLLVM_ENABLE_RTTI=ON \
-DLLVM_INSTALL_UTILS=ON \
-DCMAKE_INSTALL_PREFIX=./install
#]==]
# The matched llvm-project version is f9dc2b7079350d0fed3bb3775f496b90483c9e42 (currently a temporary commit)
# The matched llvm-project version is b5149f4e66a49a98b67e8e2de4e24a4af8e2781b (currently a temporary commit)

add_definitions(${LLVM_DEFINITIONS})

Expand All @@ -75,7 +77,7 @@ add_definitions(${LLVM_DEFINITIONS})


# The minimum needed libraries for MLIR IR parse and transform.
set(MLIR_IR_LIBS MLIRAnalysis MLIRStandardOps MLIRPass MLIRParser MLIRDialect MLIRIR MLIROptLib)
set(MLIR_IR_LIBS MLIRAnalysis MLIRPass MLIRParser MLIRDialect MLIRIR MLIROptLib)


# tb_base is the name of a xxx.td file (without the .td suffix)
Expand All @@ -89,6 +91,7 @@ function(mlir_tablegen_on td_base)
mlir_tablegen(${td_base}.cpp.inc -gen-op-defs)
if (mlir_tablegen_on_DIALECT)
mlir_tablegen(${td_base}_dialect.hpp.inc --gen-dialect-decls -dialect=${mlir_tablegen_on_DIALECT})
mlir_tablegen(${td_base}_dialect.cpp.inc --gen-dialect-defs -dialect=${mlir_tablegen_on_DIALECT})
endif()
add_public_tablegen_target(${td_base}_IncGen)
add_custom_target(${td_base}_inc DEPENDS ${td_base}_IncGen)
Expand Down
2 changes: 1 addition & 1 deletion paddle/fluid/distributed/fleet.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ limitations under the License. */

namespace paddle {
namespace framework {
class LoDTensor;
class Tensor;
class Scope;
class SelectedRows;
class Variable;
Expand Down
2 changes: 1 addition & 1 deletion paddle/fluid/distributed/service/brpc_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ limitations under the License. */
namespace paddle {
namespace framework {
class Variable;
class LoDTensor;
class Tensor;
} // namespace framework
} // namespace paddle

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class PSClient;
class PSServer;
} // namespace distributed
namespace framework {
class LoDTensor;
class Tensor;
class Variable;
} // namespace framework
} // namespace paddle
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class PSClient;
class PSServer;
} // namespace distributed
namespace framework {
class LoDTensor;
class Tensor;
class Variable;
} // namespace framework
} // namespace paddle
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,24 +32,27 @@ TEST(AccumulationNode, EagerTensor) {
pten::DenseTensorMeta meta = pten::DenseTensorMeta(
pten::DataType::FLOAT16, paddle::framework::make_ddim({1, 1}));
std::shared_ptr<pten::DenseTensor> dt0 = std::make_shared<pten::DenseTensor>(
pten::make_intrusive<paddle::experimental::SharedStorage>(
paddle::platform::CPUPlace()),
std::make_unique<paddle::experimental::DefaultAllocator>(
paddle::platform::CPUPlace())
.get(),
meta);
dt0->mutable_data<paddle::platform::float16>()[0] = 10.0;
EagerTensor et0 = EagerTensor(dt0);

std::shared_ptr<pten::DenseTensor> dt1 = std::make_shared<pten::DenseTensor>(
pten::make_intrusive<paddle::experimental::SharedStorage>(
paddle::platform::CPUPlace()),
std::make_unique<paddle::experimental::DefaultAllocator>(
paddle::platform::CPUPlace())
.get(),
meta);

dt1->mutable_data<paddle::platform::float16>()[0] = 20.0;
EagerTensor et1 = EagerTensor(dt1);

std::shared_ptr<pten::DenseTensor> grad_dt =
std::make_shared<pten::DenseTensor>(
pten::make_intrusive<paddle::experimental::SharedStorage>(
paddle::platform::CPUPlace()),
std::make_unique<paddle::experimental::DefaultAllocator>(
paddle::platform::CPUPlace())
.get(),
meta);
EagerTensor grad_et = EagerTensor(grad_dt);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ TEST(AutogradMeta, MemberFunction) {
pten::DenseTensorMeta meta = pten::DenseTensorMeta(
pten::DataType::FLOAT32, paddle::framework::make_ddim({1, 2}));
std::shared_ptr<pten::DenseTensor> dt = std::make_shared<pten::DenseTensor>(
pten::make_intrusive<paddle::experimental::SharedStorage>(
paddle::platform::CPUPlace()),
std::make_unique<paddle::experimental::DefaultAllocator>(
paddle::platform::CPUPlace())
.get(),
meta);
auto* dt_ptr = dt->mutable_data<float>();
dt_ptr[0] = 5.0f;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ TEST(EagerTensor, Constructor) {
pten::DenseTensorMeta meta = pten::DenseTensorMeta(
pten::DataType::FLOAT32, paddle::framework::make_ddim({1, 2}));
std::shared_ptr<pten::DenseTensor> dt = std::make_shared<pten::DenseTensor>(
pten::make_intrusive<paddle::experimental::SharedStorage>(
paddle::platform::CPUPlace()),
std::make_unique<paddle::experimental::DefaultAllocator>(
paddle::platform::CPUPlace())
.get(),
meta);
auto* dt_ptr = dt->mutable_data<float>();
dt_ptr[0] = 5.0f;
Expand Down Expand Up @@ -65,8 +66,9 @@ TEST(EagerTensor, MemberFunction) {
pten::DenseTensorMeta meta = pten::DenseTensorMeta(
pten::DataType::FLOAT32, paddle::framework::make_ddim({1, 2}));
std::shared_ptr<pten::DenseTensor> dt = std::make_shared<pten::DenseTensor>(
pten::make_intrusive<paddle::experimental::SharedStorage>(
paddle::platform::CPUPlace()),
std::make_unique<paddle::experimental::DefaultAllocator>(
paddle::platform::CPUPlace())
.get(),
meta);
auto* dt_ptr = dt->mutable_data<float>();
dt_ptr[0] = 5.0f;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,9 @@ TEST(GradNodeInfo, GradNodeBase) {
pten::DenseTensorMeta meta = pten::DenseTensorMeta(
pten::DataType::FLOAT32, paddle::framework::make_ddim({1, 1}));
std::shared_ptr<pten::DenseTensor> dt = std::make_shared<pten::DenseTensor>(
pten::make_intrusive<paddle::experimental::SharedStorage>(
paddle::platform::CPUPlace()),
std::make_unique<paddle::experimental::DefaultAllocator>(
paddle::platform::CPUPlace())
.get(),
meta);
auto* dt_ptr = dt->mutable_data<float>();
dt_ptr[0] = 5.0f;
Expand Down Expand Up @@ -97,8 +98,9 @@ TEST(GradNodeInfo, GradNodeBase) {
pten::DenseTensorMeta meta = pten::DenseTensorMeta(
pten::DataType::FLOAT32, paddle::framework::make_ddim({1, 1}));
std::shared_ptr<pten::DenseTensor> dt = std::make_shared<pten::DenseTensor>(
pten::make_intrusive<paddle::experimental::SharedStorage>(
paddle::platform::CPUPlace()),
std::make_unique<paddle::experimental::DefaultAllocator>(
paddle::platform::CPUPlace())
.get(),
meta);
auto* dt_ptr = dt->mutable_data<float>();
dt_ptr[0] = 6.0f;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@ class GradTestNode : public egr::GradNodeBase {
pten::DenseTensorMeta meta = pten::DenseTensorMeta(
pten::DataType::FLOAT32, paddle::framework::make_ddim({1, 1}));
std::shared_ptr<pten::DenseTensor> dt = std::make_shared<pten::DenseTensor>(
pten::make_intrusive<paddle::experimental::SharedStorage>(
paddle::platform::CPUPlace()),
std::make_unique<paddle::experimental::DefaultAllocator>(
paddle::platform::CPUPlace())
.get(),
meta);
auto* dt_ptr = dt->mutable_data<float>();
dt_ptr[0] = 6.0f;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ TEST(GradTensorHolder, Constructor) {
pten::DenseTensorMeta meta = pten::DenseTensorMeta(
pten::DataType::FLOAT32, paddle::framework::make_ddim({2, 2}));
std::shared_ptr<pten::DenseTensor> dt = std::make_shared<pten::DenseTensor>(
pten::make_intrusive<paddle::experimental::SharedStorage>(
paddle::platform::CPUPlace()),
std::make_unique<paddle::experimental::DefaultAllocator>(
paddle::platform::CPUPlace())
.get(),
meta);
EagerTensor et = EagerTensor(dt);

Expand All @@ -52,15 +53,17 @@ TEST(GradTensorHolder, Interfaces) {
pten::DenseTensorMeta meta = pten::DenseTensorMeta(
pten::DataType::FLOAT32, paddle::framework::make_ddim({1, 1}));
std::shared_ptr<pten::DenseTensor> dt0 = std::make_shared<pten::DenseTensor>(
pten::make_intrusive<paddle::experimental::SharedStorage>(
paddle::platform::CPUPlace()),
std::make_unique<paddle::experimental::DefaultAllocator>(
paddle::platform::CPUPlace())
.get(),
meta);
dt0->mutable_data<float>()[0] = 10.0;
EagerTensor et0 = EagerTensor(dt0);

std::shared_ptr<pten::DenseTensor> dt1 = std::make_shared<pten::DenseTensor>(
pten::make_intrusive<paddle::experimental::SharedStorage>(
paddle::platform::CPUPlace()),
std::make_unique<paddle::experimental::DefaultAllocator>(
paddle::platform::CPUPlace())
.get(),
meta);
dt1->mutable_data<float>()[0] = 20.0;
EagerTensor et1 = EagerTensor(dt1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ TEST(TensorWrapper, Basic) {
pten::DenseTensorMeta meta = pten::DenseTensorMeta(
pten::DataType::FLOAT32, paddle::framework::make_ddim({1, 2}));
std::shared_ptr<pten::DenseTensor> dt = std::make_shared<pten::DenseTensor>(
pten::make_intrusive<paddle::experimental::SharedStorage>(
paddle::platform::CPUPlace()),
std::make_unique<paddle::experimental::DefaultAllocator>(
paddle::platform::CPUPlace())
.get(),
meta);
auto* dt_ptr = dt->mutable_data<float>();
dt_ptr[0] = 5.0f;
Expand All @@ -51,9 +52,10 @@ TEST(TensorWrapper, Basic) {
pten::DenseTensorMeta meta2 = pten::DenseTensorMeta(
pten::DataType::FLOAT32, paddle::framework::make_ddim({1, 2}));
std::shared_ptr<pten::DenseTensor> dt2 = std::make_shared<pten::DenseTensor>(
pten::make_intrusive<paddle::experimental::SharedStorage>(
paddle::platform::CPUPlace()),
meta);
std::make_unique<paddle::experimental::DefaultAllocator>(
paddle::platform::CPUPlace())
.get(),
meta2);
auto* dt_ptr2 = dt->mutable_data<float>();
dt_ptr2[0] = 6.0f;
dt_ptr2[1] = 11.0f;
Expand Down
15 changes: 9 additions & 6 deletions paddle/fluid/eager/tests/task_tests/eager_utils_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,17 @@ TEST(EagerUtils, AutoGradMeta) {
pten::DenseTensorMeta meta = pten::DenseTensorMeta(
pten::DataType::FLOAT32, paddle::framework::make_ddim({1, 1}));
std::shared_ptr<pten::DenseTensor> dt0 = std::make_shared<pten::DenseTensor>(
pten::make_intrusive<paddle::experimental::SharedStorage>(
paddle::platform::CPUPlace()),
std::make_unique<paddle::experimental::DefaultAllocator>(
paddle::platform::CPUPlace())
.get(),
meta);
dt0->mutable_data<float>()[0] = 10.0;
EagerTensor et0 = EagerTensor(dt0);

std::shared_ptr<pten::DenseTensor> dt1 = std::make_shared<pten::DenseTensor>(
pten::make_intrusive<paddle::experimental::SharedStorage>(
paddle::platform::CPUPlace()),
std::make_unique<paddle::experimental::DefaultAllocator>(
paddle::platform::CPUPlace())
.get(),
meta);
dt1->mutable_data<float>()[0] = 20.0;
EagerTensor et1 = EagerTensor(dt1);
Expand Down Expand Up @@ -106,8 +108,9 @@ egr::EagerTensor CreateTestCPUTensor(T val,
pten::DenseTensorMeta(pten::DataType::FLOAT32, ddim);
egr::EagerTensor tensor;
std::shared_ptr<pten::DenseTensor> dt = std::make_shared<pten::DenseTensor>(
pten::make_intrusive<paddle::experimental::SharedStorage>(
paddle::platform::CPUPlace()),
std::make_unique<paddle::experimental::DefaultAllocator>(
paddle::platform::CPUPlace())
.get(),
meta);
auto* dt_ptr = dt->mutable_data<T>();
for (int64_t i = 0; i < dt->numel(); i++) {
Expand Down
2 changes: 1 addition & 1 deletion paddle/fluid/framework/data_feed.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ DECLARE_bool(enable_slotrecord_reset_shrink);
namespace paddle {
namespace framework {
class DataFeedDesc;
class LoDTensor;
class Tensor;
class Scope;
class Variable;
} // namespace framework
Expand Down
2 changes: 1 addition & 1 deletion paddle/fluid/framework/details/fetch_async_op_handle.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

namespace paddle {
namespace framework {
class LoDTensor;
class Tensor;

namespace ir {
class Node;
Expand Down
2 changes: 1 addition & 1 deletion paddle/fluid/framework/details/variable_visitor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

namespace paddle {
namespace framework {
class LoDTensor;
class Tensor;
class Variable;
} // namespace framework
} // namespace paddle
Expand Down
2 changes: 1 addition & 1 deletion paddle/fluid/framework/device_worker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ limitations under the License. */
namespace paddle {
namespace framework {

class LoDTensor;
class Tensor;
class Scope;

void DeviceWorker::SetRootScope(Scope* root_scope) { root_scope_ = root_scope; }
Expand Down
3 changes: 1 addition & 2 deletions paddle/fluid/framework/device_worker.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,9 @@ limitations under the License. */

namespace paddle {
namespace framework {
class LoDTensor;
class Tensor;
class ProgramDesc;
class Scope;
class Tensor;
} // namespace framework
namespace platform {
class DeviceContext;
Expand Down
2 changes: 1 addition & 1 deletion paddle/fluid/framework/downpour_worker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ limitations under the License. */

namespace paddle {
namespace framework {
class LoDTensor;
class Tensor;
class Variable;
} // namespace framework
} // namespace paddle
Expand Down
2 changes: 1 addition & 1 deletion paddle/fluid/framework/feed_fetch_method.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ limitations under the License. */
namespace paddle {
namespace framework {

class LoDTensor;
class Tensor;
class Variable;

void SetFeedVariable(Scope* scope, const LoDTensor& input,
Expand Down
2 changes: 1 addition & 1 deletion paddle/fluid/framework/feed_fetch_method.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ limitations under the License. */
namespace paddle {
namespace framework {

class LoDTensor;
class Tensor;
class Scope;

void SetFeedVariable(Scope* scope, const LoDTensor& input,
Expand Down
2 changes: 1 addition & 1 deletion paddle/fluid/framework/ir/conv_affine_channel_fuse_pass.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

namespace paddle {
namespace framework {
class LoDTensor;
class Tensor;
class Scope;
} // namespace framework
} // namespace paddle
Expand Down
2 changes: 1 addition & 1 deletion paddle/fluid/framework/ir/conv_bn_fuse_pass.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

namespace paddle {
namespace framework {
class LoDTensor;
class Tensor;
class Scope;
} // namespace framework
} // namespace paddle
Expand Down
2 changes: 1 addition & 1 deletion paddle/fluid/framework/ir/delete_dropout_op_pass.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

namespace paddle {
namespace framework {
class LoDTensor;
class Tensor;
} // namespace framework
} // namespace paddle

Expand Down
2 changes: 1 addition & 1 deletion paddle/fluid/framework/ir/delete_quant_dequant_op_pass.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

namespace paddle {
namespace framework {
class LoDTensor;
class Tensor;
} // namespace framework
} // namespace paddle

Expand Down
Loading

1 comment on commit 4a5e80f

@paddle-bot-old
Copy link

@paddle-bot-old paddle-bot-old bot commented on 4a5e80f Jan 16, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🕵️ CI failures summary

🔍 PR: #38899 Commit ID: 4a5e80f contains failed CI.

🔹 Failed: PR-CI-APPROVAL

approve_failed
2022-01-17 12:24:07 正在解析主机 sys-p0.bj.bcebos.com... 182.61.200.195, 182.61.200.229, 2409:8c04:1001:1002:0:ff:b001:368a
2022-01-17 12:24:07 正在连接 sys-p0.bj.bcebos.com|182.61.200.195|:443... 已连接。
2022-01-17 12:24:07 警告: 证书通用名 “*.bcebos.com” 与所要求的主机名 “sys-p0.bj.bcebos.com” 不符。
2022-01-17 12:24:07 已发出 HTTP 请求,正在等待回应... 200 OK
2022-01-17 12:24:07 长度:5 [application/octet-stream]
2022-01-17 12:24:07 正在保存至: “bk.txt”
2022-01-17 12:24:07 0K 100% 3.45M=0s
2022-01-17 12:24:07 2022-01-17 12:24:07 (3.45 MB/s) - 已保存 “bk.txt” [5/5])
2022-01-17 12:24:14 ****************
2022-01-17 12:24:15 0. You must have Dianhai or XiaoguangHu01 approval for change 20+ files or add than 1000+ lines of content.
2022-01-17 12:24:15 There are 1 approved errors.
2022-01-17 12:24:15 ****************
2022-01-17 12:24:15 + EXCODE=6
2022-01-17 12:24:15 + echo 'EXCODE: 6'
2022-01-17 12:24:15 EXCODE: 6
2022-01-17 12:24:15 + echo 'ipipe_log_param_EXCODE: 6'
2022-01-17 12:24:15 ipipe_log_param_EXCODE: 6
2022-01-17 12:24:15 + exit 6

Please sign in to comment.