Skip to content

[Unify CustomOp Headerfile] Inference headerfile includes paddle/extension.h #51745

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

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions cmake/phi_header.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,6 @@ phi_header_path_compat(
file(RENAME
Copy link
Contributor

Choose a reason for hiding this comment

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

之前experimental下的不需要删除吗?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

出于兼容性的考虑,之前 experimental 下的应该删不掉~

${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/experimental/extension.h
${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/experimental/ext_all.h)
# Included header file of training and inference can be unified as single file: paddle/extension.h
file(COPY ${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/experimental/ext_all.h
Copy link
Contributor

Choose a reason for hiding this comment

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

ext_all.h的内容:

 15 #pragma once
 16
 17 // All paddle apis in C++ frontend
 18 #include "paddle/include/experimental/phi/api/all.h"
 19 // Python bindings for the C++ frontend
 20 #ifndef PADDLE_ON_INFERENCE
 21 #include "paddle/include/experimental/utils/pybind.h"
 22 #endif

这里的相对路径关系不影响吗?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

这里的路径关系是正确的,不会影响,并且需要引用的也是 ext_all.h 中的相对路径~

原来用户需要引用的头文件是 paddle/include/experimental/ext_all.h,现在把这个文件拷贝到 ${PADDLE_INFERENCE_INSTALL_DIR}/paddle/extension.h,相当于用户引用的头文件变成了 paddle/extension.h,从而达成自定义算子下,训练和推理引用头文件一致的效果。用户不需要做源码改动,提高易用性。

DESTINATION ${PADDLE_INFERENCE_INSTALL_DIR}/paddle/extension.h)