diff --git a/paddle/phi/kernels/CMakeLists.txt b/paddle/phi/kernels/CMakeLists.txt index acfeaf21d0742debca0d9411c733e9eb9a1d4dc4..7cddacb7e3928d4dd80b9a79e5e92bc1cdac05e0 100644 --- a/paddle/phi/kernels/CMakeLists.txt +++ b/paddle/phi/kernels/CMakeLists.txt @@ -133,8 +133,16 @@ endif() if(WITH_XPU) if(WITH_XPU_KP) - file(GLOB kernel_xpu_kps "kps/*.cu") - xpu_add_library(phi_xpu STATIC ${kernel_xpu} ${kernel_xpu_kps}) + file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/kps/ + DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/kps/) + file(GLOB kernel_xpu_kps "${CMAKE_CURRENT_BINARY_DIR}/kps/*.cu") + foreach(kernel ${kernel_xpu_kps}) + get_filename_component(name ${kernel} NAME_WE) + file(RENAME ${kernel} "${CMAKE_CURRENT_BINARY_DIR}/kps/${name}.kps") + endforeach() + file(GLOB kernel_xpu_kps "${CMAKE_CURRENT_BINARY_DIR}/kps/*.kps") + xpu_add_library(phi_xpu STATIC ${kernel_xpu} ${kernel_xpu_kps} DEPENDS + ${COMMON_KERNEL_DEPS}) else() add_library(phi_xpu ${kernel_xpu}) endif()