diff --git a/cmake/flags.cmake b/cmake/flags.cmake index 7a4956e6e15567..bb94e5627bd620 100644 --- a/cmake/flags.cmake +++ b/cmake/flags.cmake @@ -37,6 +37,7 @@ checkcompilercxx14flag() if(NOT WIN32) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17") else() + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -std=c++17") set(CMAKE_CXX_STANDARD 17) endif() diff --git a/paddle/fluid/pybind/pir.cc b/paddle/fluid/pybind/pir.cc index 60c3aa5b2e8751..24190ce13f60a5 100644 --- a/paddle/fluid/pybind/pir.cc +++ b/paddle/fluid/pybind/pir.cc @@ -71,6 +71,7 @@ #include "paddle/pir/core/type.h" #include "paddle/pir/core/value.h" #include "paddle/pir/dialect/control_flow/ir/cf_dialect.h" +#include "paddle/pir/dialect/shape/ir/shape_attribute.h" #include "paddle/pir/dialect/shape/ir/shape_dialect.h" #include "paddle/pir/pass/pass.h" #include "paddle/pir/pass/pass_manager.h" @@ -451,6 +452,7 @@ void BindOperation(py::module *m) { [](Operation &self) -> py::dict { py::dict attrs_dict; for (auto &pair : self.attributes()) { + if (pair.second.isa()) continue; attrs_dict[pair.first.c_str()] = paddle::dialect::GetAttributeData(pair.second); } @@ -1564,11 +1566,12 @@ static bool HasDynamicShape(const Program &program) { continue; } for (uint32_t i = 0; i < op.num_results(); ++i) { - if (op.result(i) && op.result(i) - .type() - .dyn_cast() - .IsDynamicShape()) { - return true; + if (op.result(i) && op.result(i).type()) { + auto shaped_type = + op.result(i).type().dyn_cast(); + if (shaped_type && + pir::ShapedTypeInterface::IsDynamicShape(shaped_type.GetShape())) + return true; } } } diff --git a/python/paddle/jit/dy2static/pir_partial_program.py b/python/paddle/jit/dy2static/pir_partial_program.py index 574821ab5b3420..6479b35eff2278 100644 --- a/python/paddle/jit/dy2static/pir_partial_program.py +++ b/python/paddle/jit/dy2static/pir_partial_program.py @@ -551,9 +551,7 @@ def _create_program(self, is_infer_mode=False): # TODO(lanxianghit) mv this into pass_fn def shape_pass_fn(forward_program, backward_program): pm = paddle.base.libpaddle.pir.PassManager() - paddle.base.libpaddle.pir.infer_symbolic_shape_pass( - pm, forward_program - ) + paddle.base.libpaddle.pir.infer_symbolic_shape_pass(pm) pm.run(forward_program) return forward_program, backward_program diff --git a/test/cpp/pir/core/type_interface_test.cc b/test/cpp/pir/core/type_interface_test.cc index 9f3d0d85c478db..2b381f133f0cdb 100644 --- a/test/cpp/pir/core/type_interface_test.cc +++ b/test/cpp/pir/core/type_interface_test.cc @@ -52,8 +52,7 @@ TEST(shapedtype_test, shapedtype_test) { dense_tensor_type_interface.GetElementType().isa(), true); EXPECT_EQ(dense_tensor_type_interface.GetShape(), dims); - EXPECT_EQ(dense_tensor_type_interface.kDynamic, - std::numeric_limits::min()); + EXPECT_EQ(dense_tensor_type_interface.kDynamic, -1); EXPECT_EQ(dense_tensor_type_interface.GetRank(), 2); EXPECT_EQ(dense_tensor_type_interface.IsDynamic(2), false); EXPECT_EQ(dense_tensor_type_interface.IsDynamicShape(dims), false);