From 81054ad4be5e793aba7a094892755bf7ffcf3ef1 Mon Sep 17 00:00:00 2001 From: YuanRisheng Date: Tue, 4 Apr 2023 18:53:23 +0800 Subject: [PATCH] fix xpu compile bugs (#52501) --- paddle/phi/kernels/CMakeLists.txt | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/paddle/phi/kernels/CMakeLists.txt b/paddle/phi/kernels/CMakeLists.txt index f233c2d13a9..b0da4df9c8d 100644 --- a/paddle/phi/kernels/CMakeLists.txt +++ b/paddle/phi/kernels/CMakeLists.txt @@ -205,20 +205,40 @@ elseif(WITH_XPU) file(RENAME ${kernel} "${CMAKE_CURRENT_BINARY_DIR}/kps/${name}.kps") endforeach() file(GLOB kernel_xpu_kps "${CMAKE_CURRENT_BINARY_DIR}/kps/*.kps") + file( + GLOB kernel_cc_relative + RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" + "*.cc" + "cpu/*.cc" + "selected_rows/*.cc" + "selected_rows/cpu/*.cc" + "sparse/*.cc" + "sparse/cpu/*.cc" + "strings/*.cc" + "strings/cpu/*.cc" + "fusion/*.cc" + "fusion/cpu/*.cc") + foreach(kernel ${kernel_cc_relative}) + file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/${kernel} + DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/${kernel}) + endforeach() + file(GLOB_RECURSE kernel_xpu_cc "${CMAKE_CURRENT_BINARY_DIR}/*.cc") xpu_add_library( phi_xpu STATIC ${kernel_xpu} ${kernel_xpu_kps} - ${kernel_cc} + ${kernel_xpu_cc} DEPENDS ${COMMON_KERNEL_DEPS}) + kernel_declare("${kernel_xpu_cc}") else() add_library(phi_xpu ${kernel_xpu} ${kernel_cc}) + kernel_declare("${kernel_cc}") endif() kernel_declare("${kernel_xpu}") kernel_declare("${kernel_xpu_kps}") - kernel_declare("${kernel_cc}") + target_link_libraries(phi_xpu ${COMMON_KERNEL_DEPS}) set(ADD_PHI_KERNELS ${ADD_PHI_KERNELS} phi_xpu) else() -- GitLab