Skip to content
Open
Show file tree
Hide file tree
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
6 changes: 6 additions & 0 deletions paddle/phi/backends/all_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,15 @@ limitations under the License. */
// path replacement after implementing phi DeviceContext

#include "paddle/phi/backends/cpu/cpu_context.h"
#ifdef PADDLE_WITH_CUSTOM_DEVICE
#include "paddle/phi/backends/custom/custom_context.h"
#endif
#if defined(PADDLE_WITH_CUDA) || defined(PADDLE_WITH_HIP)
#include "paddle/phi/backends/gpu/gpu_context.h"
#endif
#include "paddle/phi/backends/onednn/onednn_context.h"
#ifdef PADDLE_WITH_XPU
#include "paddle/phi/backends/xpu/xpu_context.h"
#endif

namespace phi {} // namespace phi
95 changes: 94 additions & 1 deletion python/setup.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -1463,7 +1463,7 @@ headers = (
# phi level api headers (low level api, for training only)
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/backends')) + # 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
Expand Down Expand Up @@ -1532,6 +1532,21 @@ if '${WITH_OPENVINO}' == 'ON':
if '${WITH_GPU}' == 'ON' or '${WITH_ROCM}' == 'ON':
# externalErrorMsg.pb for External Error message
headers += list(find_files('*.pb', '${externalError_INCLUDE_DIR}'))
headers += list(
find_files('*.h', '@PADDLE_SOURCE_DIR@/paddle/phi/backends/cpu')
)
headers += list(
find_files('*.h', '@PADDLE_SOURCE_DIR@/paddle/phi/backends/gpu, recursive=True')
)
headers += list(
find_files(
'*.h', '@PADDLE_SOURCE_DIR@/paddle/phi/backends/dynload'
)
)
headers += list(
find_files('*.h', '@PADDLE_SOURCE_DIR@/paddle/phi/backends/onednn')
)



if '${WITH_XPU}' == 'ON':
Expand All @@ -1540,6 +1555,20 @@ if '${WITH_XPU}' == 'ON':
if '/include/xpu/kernel/' not in h
] # xdnn api headers
headers += list(find_files('*.hpp', '@PADDLE_BINARY_DIR@/third_party/xpu/src/extern_xpu/xpu', recursive=True)) # xre headers with .hpp extension
headers += list(
find_files('*.h', '@PADDLE_BINARY_DIR@/paddle/phi/backends/cpu')
)
headers += list(
find_files('*.h', '@PADDLE_SOURCE_DIR@/paddle/phi/backends/xpu')
)
headers += list(
find_files(
'*.h', '@PADDLE_SOURCE_DIR@/paddle/phi/backends/dynload'
)
)
headers += list(
find_files('*.h', '@PADDLE_SOURCE_DIR@/paddle/phi/backends/onednn')
)

if (
'@WITH_GPU@' == 'ON'
Expand All @@ -1550,6 +1579,70 @@ if (
headers += list(find_files('*.h', '@PADDLE_SOURCE_DIR@/paddle/fluid/fp8/deep_gemm/include/cutlass/', recursive=True))
headers += list(find_files('*.hpp', '@PADDLE_SOURCE_DIR@/paddle/fluid/fp8/deep_gemm/include/cutlass/', recursive=True))
headers += list(find_files('*.cuh', '@PADDLE_SOURCE_DIR@/paddle/fluid/fp8/deep_gemm/include/deep_gemm', recursive=True))
if (
'@WITH_GPU@' == 'OFF'
and '@WITH_ROCM@' == 'OFF'
and '@WITH_XPU@' == 'OFF'
): # Custom Device
headers += list(
find_files('*.h', '@PADDLE_SOURCE_DIR@/paddle/phi/backends/cpu')
)
headers += list(
find_files('*.h', '@PADDLE_SOURCE_DIR@/paddle/phi/backends/custom')
)
headers += list(
find_files('*.h', '@PADDLE_SOURCE_DIR@/paddle/phi/backends/gpu', recursive=True)
)
headers += list(
find_files('*.h', '@PADDLE_SOURCE_DIR@/paddle/phi/backends/onednn')
)
headers += [
os.path.join(
'@PADDLE_SOURCE_DIR@/paddle/phi/backends/dynload/afs_api.h'
),
os.path.join(
'@PADDLE_SOURCE_DIR@/paddle/phi/backends/dynload/dynamic_loader.h',
),
os.path.join(
'@PADDLE_SOURCE_DIR@/paddle/phi/backends/dynload/mklml.h'
),
os.path.join(
'@PADDLE_SOURCE_DIR@/paddle/phi/backends/dynload/mklrt.h'
),
os.path.join(
'@PADDLE_SOURCE_DIR@/paddle/phi/backends/dynload/lapack.h'
),
os.path.join(
'@PADDLE_SOURCE_DIR@/paddle/phi/backends/dynload/hml.h'
),
]
else:
headers += list(
find_files('*.h', '@PADDLE_SOURCE_DIR@/paddle/phi/backends/cpu')
)
headers += list(
find_files('*.h', '@PADDLE_SOURCE_DIR@/paddle/phi/backends/onednn')
)
headers += [
os.path.join(
'@PADDLE_SOURCE_DIR@/paddle/phi/backends/dynload/afs_api.h'
),
os.path.join(
'@PADDLE_SOURCE_DIR@/paddle/phi/backends/dynload/dynamic_loader.h',
),
os.path.join(
'@PADDLE_SOURCE_DIR@/paddle/phi/backends/dynload/mklml.h'
),
os.path.join(
'@PADDLE_SOURCE_DIR@/paddle/phi/backends/dynload/mklrt.h'
),
os.path.join(
'@PADDLE_SOURCE_DIR@/paddle/phi/backends/dynload/lapack.h'
),
os.path.join(
'@PADDLE_SOURCE_DIR@/paddle/phi/backends/dynload/hml.h'
),
]

headers += list(find_files('*.h', '${PYBIND_INCLUDE_DIR}', True)) # pybind headers

Expand Down
108 changes: 103 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2035,11 +2035,7 @@ def get_headers():
)
)
+ list( # phi backends headers
find_files(
'*.h',
paddle_source_dir + '/paddle/phi/backends',
recursive=True,
)
find_files('*.h', paddle_source_dir + '/paddle/phi/backends')
)
+ list( # phi core headers
find_files(
Expand Down Expand Up @@ -2326,6 +2322,23 @@ def get_headers():
headers += list(
find_files('*.pb', env_dict.get("externalError_INCLUDE_DIR"))
)
headers += list(
find_files('*.h', paddle_source_dir + '/paddle/phi/backends/cpu')
)
headers += list(
find_files(
'*.h',
paddle_source_dir + '/paddle/phi/backends/gpu, recursive=True',
)
)
headers += list(
find_files(
'*.h', paddle_source_dir + '/paddle/phi/backends/dynload'
)
)
headers += list(
find_files('*.h', paddle_source_dir + '/paddle/phi/backends/onednn')
)

if env_dict.get("WITH_XPU") == 'ON':
headers += [
Expand All @@ -2344,6 +2357,20 @@ def get_headers():
recursive=True,
)
) # xre headers with .hpp extension
headers += list(
find_files('*.h', paddle_source_dir + '/paddle/phi/backends/cpu')
)
headers += list(
find_files('*.h', paddle_source_dir + '/paddle/phi/backends/xpu')
)
headers += list(
find_files(
'*.h', paddle_source_dir + '/paddle/phi/backends/dynload'
)
)
headers += list(
find_files('*.h', paddle_source_dir + '/paddle/phi/backends/onednn')
)

if (
env_dict.get("WITH_GPU") == 'ON'
Expand Down Expand Up @@ -2381,6 +2408,77 @@ def get_headers():
recursive=True,
)
)

if (
env_dict.get("WITH_GPU") == 'OFF'
and env_dict.get("WITH_ROCM") == 'OFF'
and env_dict.get("WITH_XPU") == 'OFF'
): # Custom Device
headers += list(
find_files('*.h', paddle_source_dir + '/paddle/phi/backends/cpu')
)
headers += list(
find_files('*.h', paddle_source_dir + '/paddle/phi/backends/custom')
)
headers += list(
find_files(
'*.h',
paddle_source_dir + '/paddle/phi/backends/gpu',
recursive=True,
)
)
headers += list(
find_files('*.h', paddle_source_dir + '/paddle/phi/backends/onednn')
)
headers += [
os.path.join(
paddle_source_dir, 'paddle/phi/backends/dynload/afs_api.h'
),
os.path.join(
paddle_source_dir,
'paddle/phi/backends/dynload/dynamic_loader.h',
),
os.path.join(
paddle_source_dir, 'paddle/phi/backends/dynload/mklml.h'
),
os.path.join(
paddle_source_dir, 'paddle/phi/backends/dynload/mklrt.h'
),
os.path.join(
paddle_source_dir, 'paddle/phi/backends/dynload/lapack.h'
),
os.path.join(
paddle_source_dir, 'paddle/phi/backends/dynload/hml.h'
),
]
else:
headers += list(
find_files('*.h', paddle_source_dir + '/paddle/phi/backends/cpu')
)
headers += list(
find_files('*.h', paddle_source_dir + '/paddle/phi/backends/onednn')
)
headers += [
os.path.join(
paddle_source_dir, 'paddle/phi/backends/dynload/afs_api.h'
),
os.path.join(
paddle_source_dir,
'paddle/phi/backends/dynload/dynamic_loader.h',
),
os.path.join(
paddle_source_dir, 'paddle/phi/backends/dynload/mklml.h'
),
os.path.join(
paddle_source_dir, 'paddle/phi/backends/dynload/mklrt.h'
),
os.path.join(
paddle_source_dir, 'paddle/phi/backends/dynload/lapack.h'
),
os.path.join(
paddle_source_dir, 'paddle/phi/backends/dynload/hml.h'
),
]
# pybind headers
headers += list(find_files('*.h', env_dict.get("PYBIND_INCLUDE_DIR"), True))
return headers
Expand Down
Loading