From d9dd840f09d53ba3c1f25f90ff5a6a333c9f4a31 Mon Sep 17 00:00:00 2001
From: Aganlengzi <aganlengzi@gmail.com>
Date: Fri, 4 Mar 2022 13:28:48 +0800
Subject: [PATCH] Publish header files for out user (#40150)

---
 paddle/fluid/memory/detail/buddy_allocator.cc | 1 +
 paddle/phi/backends/callback_manager.h        | 2 --
 paddle/phi/backends/device_base.cc            | 1 +
 paddle/phi/backends/event.h                   | 3 ++-
 paddle/phi/backends/stream.h                  | 3 ++-
 python/setup.py.in                            | 6 +++++-
 6 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/paddle/fluid/memory/detail/buddy_allocator.cc b/paddle/fluid/memory/detail/buddy_allocator.cc
index cdaa2b7b1df..076a9613961 100644
--- a/paddle/fluid/memory/detail/buddy_allocator.cc
+++ b/paddle/fluid/memory/detail/buddy_allocator.cc
@@ -26,6 +26,7 @@ DECLARE_uint64(reallocate_gpu_memory_in_mb);
 #endif
 
 #include "paddle/fluid/platform/device/device_wrapper.h"
+#include "paddle/fluid/platform/place.h"
 
 namespace paddle {
 namespace memory {
diff --git a/paddle/phi/backends/callback_manager.h b/paddle/phi/backends/callback_manager.h
index a15cb075668..359958b7c93 100644
--- a/paddle/phi/backends/callback_manager.h
+++ b/paddle/phi/backends/callback_manager.h
@@ -30,8 +30,6 @@
 #include <memory>
 #include <mutex>  // NOLINT
 
-#include "paddle/fluid/platform/enforce.h"
-
 namespace phi {
 
 namespace stream {
diff --git a/paddle/phi/backends/device_base.cc b/paddle/phi/backends/device_base.cc
index 6f634c58af0..14fe90192e5 100644
--- a/paddle/phi/backends/device_base.cc
+++ b/paddle/phi/backends/device_base.cc
@@ -14,6 +14,7 @@
 
 #include "paddle/phi/backends/device_base.h"
 #include "gflags/gflags.h"
+#include "paddle/phi/core/enforce.h"
 
 DECLARE_double(fraction_of_gpu_memory_to_use);
 DECLARE_uint64(initial_gpu_memory_in_mb);
diff --git a/paddle/phi/backends/event.h b/paddle/phi/backends/event.h
index f2e86343f8f..0866adcf39a 100644
--- a/paddle/phi/backends/event.h
+++ b/paddle/phi/backends/event.h
@@ -13,7 +13,8 @@
 // limitations under the License.
 
 #pragma once
-#include "paddle/fluid/platform/place.h"
+#include "paddle/phi/common/place.h"
+#include "paddle/phi/core/macros.h"
 
 namespace phi {
 
diff --git a/paddle/phi/backends/stream.h b/paddle/phi/backends/stream.h
index 6c26ab3c2d5..d1578c90ec1 100644
--- a/paddle/phi/backends/stream.h
+++ b/paddle/phi/backends/stream.h
@@ -14,8 +14,9 @@
 
 #pragma once
 
-#include "paddle/fluid/platform/place.h"
 #include "paddle/phi/backends/callback_manager.h"
+#include "paddle/phi/common/place.h"
+#include "paddle/phi/core/macros.h"
 
 namespace phi {
 
diff --git a/python/setup.py.in b/python/setup.py.in
index 91580614fa9..0bc32cfbc00 100755
--- a/python/setup.py.in
+++ b/python/setup.py.in
@@ -576,8 +576,12 @@ headers = (
     list(find_files('*.h', '@PADDLE_SOURCE_DIR@/paddle/phi/api/include')) +  # phi api
     list(find_files('*.h', '@PADDLE_SOURCE_DIR@/paddle/phi/common')) +  # phi common headers
     # phi level api headers (low level api)
-    list(find_files('*.h', '@PADDLE_SOURCE_DIR@/paddle/phi/core', recursive=True)) +  # phi core headers
+    list(find_files('*.h', '@PADDLE_SOURCE_DIR@/paddle/phi')) +  # phi extension header
+    list(find_files('*.h', '@PADDLE_SOURCE_DIR@/paddle/phi/include', recursive=True)) +  # phi include headers
     list(find_files('*.h', '@PADDLE_SOURCE_DIR@/paddle/phi/backends', recursive=True)) +  # phi backends headers
+    list(find_files('*.h', '@PADDLE_SOURCE_DIR@/paddle/phi/core', recursive=True)) +  # phi core headers
+    list(find_files('*.h', '@PADDLE_SOURCE_DIR@/paddle/phi/infermeta', recursive=True)) +  # phi infermeta headers
+    list(find_files('*.h', '@PADDLE_SOURCE_DIR@/paddle/phi/kernels', recursive=True)) +  # phi kernels headers
     # utila api headers
     list(find_files('*.h', '@PADDLE_SOURCE_DIR@/paddle/utils', recursive=True)))  # paddle utils headers
 
-- 
GitLab