未验证 提交 356ba7e3 编写于 作者: Y Yuanle Liu 提交者: GitHub

[cherry-pick] remove c++14 assert and remove include tensor.h in phi (#53071)

* remove c++14 assert and remove include tensor.h in phi

* update

* remove delete_cast_op_pass
上级 3f5058e6
...@@ -17,21 +17,24 @@ set(PADDLE_INFERENCE_INSTALL_DIR ...@@ -17,21 +17,24 @@ set(PADDLE_INFERENCE_INSTALL_DIR
function(phi_header_path_compat TARGET_PATH) function(phi_header_path_compat TARGET_PATH)
message(STATUS "phi header path compat processing: ${TARGET_PATH}") message(STATUS "phi header path compat processing: ${TARGET_PATH}")
file(GLOB HEADERS "${TARGET_PATH}/*" "*.h") string(FIND ${TARGET_PATH} "experimental" pos)
foreach(header ${HEADERS}) if(pos GREATER 1)
if(${header} MATCHES ".*.h$") file(GLOB HEADERS "${TARGET_PATH}/*" "*.h")
file(READ ${header} HEADER_CONTENT) foreach(header ${HEADERS})
string(REPLACE "paddle/phi/" "paddle/include/experimental/phi/" if(${header} MATCHES ".*.h$")
HEADER_CONTENT "${HEADER_CONTENT}") file(READ ${header} HEADER_CONTENT)
string(REPLACE "paddle/fluid/platform/" string(REPLACE "paddle/phi/" "paddle/include/experimental/phi/"
"paddle/include/experimental/phi/" HEADER_CONTENT HEADER_CONTENT "${HEADER_CONTENT}")
"${HEADER_CONTENT}") string(REPLACE "paddle/fluid/platform/"
string(REPLACE "paddle/utils/" "paddle/include/experimental/utils/" "paddle/include/experimental/phi/" HEADER_CONTENT
HEADER_CONTENT "${HEADER_CONTENT}") "${HEADER_CONTENT}")
file(WRITE ${header} "${HEADER_CONTENT}") string(REPLACE "paddle/utils/" "paddle/include/experimental/utils/"
message(STATUS "phi header path compat processing complete: ${header}") HEADER_CONTENT "${HEADER_CONTENT}")
endif() file(WRITE ${header} "${HEADER_CONTENT}")
endforeach() message(STATUS "phi header path compat processing complete: ${header}")
endif()
endforeach()
endif()
endfunction() endfunction()
phi_header_path_compat( phi_header_path_compat(
...@@ -48,7 +51,16 @@ phi_header_path_compat( ...@@ -48,7 +51,16 @@ phi_header_path_compat(
${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/experimental/phi/common) ${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/experimental/phi/common)
phi_header_path_compat( phi_header_path_compat(
${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/experimental/phi/core) ${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/experimental/phi/core)
phi_header_path_compat(${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/)
# NOTE(liuyuanle): In inference lib, no need include paddle/utils/pybind.h, so we delete this.
file(READ
${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/experimental/extension.h
HEADER_CONTENT)
string(REGEX REPLACE "#if !defined\\(PADDLE_ON_INFERENCE\\).*#endif" ""
HEADER_CONTENT "${HEADER_CONTENT}")
file(WRITE
${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/experimental/extension.h
"${HEADER_CONTENT}")
# In order to be compatible with the original behavior, the header file name needs to be changed # In order to be compatible with the original behavior, the header file name needs to be changed
file(RENAME file(RENAME
......
...@@ -16,8 +16,8 @@ limitations under the License. */ ...@@ -16,8 +16,8 @@ limitations under the License. */
// All paddle apis in C++ frontend // All paddle apis in C++ frontend
#include "paddle/phi/api/all.h" #include "paddle/phi/api/all.h"
// Python bindings for the C++ frontend (includes Python.h)
#if !defined(PADDLE_ON_INFERENCE) && !defined(PADDLE_NO_PYTHON) #if !defined(PADDLE_ON_INFERENCE) && !defined(PADDLE_NO_PYTHON)
// Python bindings for the C++ frontend (includes Python.h)
#include "paddle/utils/pybind.h" #include "paddle/utils/pybind.h"
#endif #endif
// For initialization of DeviceContextPool and MemoryMethod // For initialization of DeviceContextPool and MemoryMethod
......
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
#include "paddle/fluid/platform/device_context.h" #include "paddle/fluid/platform/device_context.h"
#include "paddle/fluid/platform/place.h" #include "paddle/fluid/platform/place.h"
#include "paddle/fluid/platform/profiler.h" #include "paddle/fluid/platform/profiler.h"
#include "paddle/phi/api/ext/op_meta_info.h" #include "paddle/phi/api/include/tensor.h"
#include "paddle/phi/common/backend.h" #include "paddle/phi/common/backend.h"
#include "paddle/phi/common/data_type.h" #include "paddle/phi/common/data_type.h"
#include "paddle/phi/common/place.h" #include "paddle/phi/common/place.h"
......
...@@ -266,7 +266,6 @@ GpuPassStrategy::GpuPassStrategy() : PassStrategy({}) { ...@@ -266,7 +266,6 @@ GpuPassStrategy::GpuPassStrategy() : PassStrategy({}) {
"transpose_flatten_concat_fuse_pass", // "transpose_flatten_concat_fuse_pass", //
"conv2d_fusion_layout_transfer_pass", // "conv2d_fusion_layout_transfer_pass", //
"auto_mixed_precision_pass", // "auto_mixed_precision_pass", //
"delete_cast_op_pass", //
"inplace_op_var_pass", // should be the last pass. "inplace_op_var_pass", // should be the last pass.
}); });
......
...@@ -21,13 +21,15 @@ ...@@ -21,13 +21,15 @@
#include "paddle_infer_declare.h" // NOLINT #include "paddle_infer_declare.h" // NOLINT
#include "paddle/phi/api/include/tensor.h" // expose paddle::Tensor
#ifdef PADDLE_WITH_ONNXRUNTIME #ifdef PADDLE_WITH_ONNXRUNTIME
#include "onnxruntime_c_api.h" // NOLINT #include "onnxruntime_c_api.h" // NOLINT
#include "onnxruntime_cxx_api.h" // NOLINT #include "onnxruntime_cxx_api.h" // NOLINT
#endif #endif
namespace paddle {
class Tensor;
}
namespace paddle_infer { namespace paddle_infer {
/// \brief Experimental. /// \brief Experimental.
......
...@@ -11,8 +11,11 @@ distributed under the License is distributed on an "AS IS" BASIS, ...@@ -11,8 +11,11 @@ distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. */ limitations under the License. */
#pragma once #pragma once
#include "paddle/phi/api/include/dll_decl.h" #include "paddle/phi/api/include/dll_decl.h"
namespace paddle { namespace paddle {
class PADDLE_API InitPhi { class PADDLE_API InitPhi {
......
...@@ -14,10 +14,6 @@ limitations under the License. */ ...@@ -14,10 +14,6 @@ limitations under the License. */
#pragma once #pragma once
#if !defined(_MSC_VER) && __cplusplus < 201402L
#error C++14 or later compatible compiler is required to use Paddle.
#endif
#ifdef _WIN32 #ifdef _WIN32
#ifndef NOMINMAX #ifndef NOMINMAX
#define NOMINMAX // msvc max/min macro conflict with std::min/max #define NOMINMAX // msvc max/min macro conflict with std::min/max
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册