fix phi header and add ut, test=develop #51798
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR types
Bug fixes
PR changes
Others
Describe
最近在独立PHI算子库的过程中,"paddle/phi/extension.h" 常常因为引入多余的fluid头文件而导致编译失败。增加 test_phi_extension_header.py 单测来保证安装后的PaddleWHL包支持通过引入 "paddle/phi/extension.h" 独立编译,而不会导致头文件找不到的问题。
之前修复过类似问题的PR见
#51244 此PR中解决了头文件 "context_pool_utils.h" 中包含fluid头文件而导致的问题
#51782 此PR中 "paddle/phi/api/profiler/trace_event_collector.h" 不会被 setup.py 打包到 site-packages 下的 paddle/include 目录,因此直接引用 "paddle/phi/extension.h" 会报 "paddle/phi/api/profiler/trace_event_collector.h" 头文件找不到的错误。
相关PR见 #51511