未验证 提交 e8735ddf 编写于 作者: Y YuanRisheng 提交者: GitHub

fix xpu-kp bugs (#54234)

上级 6e210f92
...@@ -239,7 +239,9 @@ endif() ...@@ -239,7 +239,9 @@ endif()
set(WITH_PHI_SHARED set(WITH_PHI_SHARED
ON ON
CACHE BOOL "" FORCE) CACHE BOOL "" FORCE)
if(WIN32 OR WITH_ROCM) if(WIN32
OR WITH_ROCM
OR WITH_XPU_KP)
set(WITH_PHI_SHARED set(WITH_PHI_SHARED
OFF OFF
CACHE BOOL "" FORCE) CACHE BOOL "" FORCE)
......
...@@ -15,7 +15,8 @@ limitations under the License. */ ...@@ -15,7 +15,8 @@ limitations under the License. */
#pragma once #pragma once
#if defined(PADDLE_WITH_CUDA) || defined(PADDLE_WITH_HIP) #if defined(PADDLE_WITH_CUDA) || defined(PADDLE_WITH_HIP) || \
defined(PADDLE_WITH_XPU_KP)
#include <array> #include <array>
#include <functional> #include <functional>
......
...@@ -81,15 +81,11 @@ if(WITH_CUTLASS) ...@@ -81,15 +81,11 @@ if(WITH_CUTLASS)
list(APPEND kernel_cu ${cutlass_cu}) list(APPEND kernel_cu ${cutlass_cu})
endif() endif()
if(WITH_MKLDNN) set(cc_search_pattern
file(
GLOB kernel_cc
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
"*.cc" "*.cc"
"cpu/*.cc" "cpu/*.cc"
"legacy/*.cc" "legacy/*.cc"
"legacy/cpu/*.cc" "legacy/cpu/*.cc"
"legacy/onednn/*.cc"
"selected_rows/*.cc" "selected_rows/*.cc"
"selected_rows/cpu/*.cc" "selected_rows/cpu/*.cc"
"sparse/*.cc" "sparse/*.cc"
...@@ -98,29 +94,18 @@ if(WITH_MKLDNN) ...@@ -98,29 +94,18 @@ if(WITH_MKLDNN)
"legacy/cpu/*.cc" "legacy/cpu/*.cc"
"strings/*.cc" "strings/*.cc"
"strings/cpu/*.cc" "strings/cpu/*.cc"
"onednn/*.cc"
"fusion/*.cc" "fusion/*.cc"
"fusion/onednn/*.cc"
"fusion/cpu/*.cc") "fusion/cpu/*.cc")
else()
file( if(WITH_MKLDNN)
set(cc_search_pattern ${cc_search_pattern} "legacy/onednn/*.cc" "onednn/*.cc"
"fusion/onednn/*.cc")
endif()
file(
GLOB kernel_cc GLOB kernel_cc
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
"*.cc" ${cc_search_pattern})
"cpu/*.cc"
"legacy/*.cc"
"legacy/cpu/*.cc"
"selected_rows/*.cc"
"selected_rows/cpu/*.cc"
"sparse/*.cc"
"sparse/cpu/*.cc"
"legacy/*.cc"
"legacy/cpu/*.cc"
"strings/*.cc"
"strings/cpu/*.cc"
"fusion/*.cc"
"fusion/cpu/*.cc")
endif()
if(DEFINED REDUCE_INFERENCE_LIB_SIZE) if(DEFINED REDUCE_INFERENCE_LIB_SIZE)
list(FILTER kernel_cc EXCLUDE REGEX ".*_grad_kernel\\.cc$") list(FILTER kernel_cc EXCLUDE REGEX ".*_grad_kernel\\.cc$")
...@@ -149,19 +134,21 @@ if(WITH_XPU) ...@@ -149,19 +134,21 @@ if(WITH_XPU)
file(RENAME ${kernel} "${CMAKE_CURRENT_BINARY_DIR}/kps/${name}.kps") file(RENAME ${kernel} "${CMAKE_CURRENT_BINARY_DIR}/kps/${name}.kps")
endforeach() endforeach()
file(GLOB kernel_xpu_kps "${CMAKE_CURRENT_BINARY_DIR}/kps/*.kps") file(GLOB kernel_xpu_kps "${CMAKE_CURRENT_BINARY_DIR}/kps/*.kps")
collect_generated_srcs(kernels_srcs SRCS ${kernel_xpu_kps})
foreach(kernel ${kernel_cc}) foreach(kernel ${kernel_cc})
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/${kernel} configure_file(${CMAKE_CURRENT_SOURCE_DIR}/${kernel}
DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/${kernel}) ${CMAKE_CURRENT_BINARY_DIR}/${kernel} COPYONLY)
endforeach() endforeach()
file(GLOB_RECURSE kernel_xpu_cc "${CMAKE_CURRENT_BINARY_DIR}/*.cc") file(GLOB_RECURSE kernel_xpu_cc "${CMAKE_CURRENT_BINARY_DIR}/*.cc")
collect_generated_srcs(kernels_srcs SRCS ${kernel_xpu_cc})
set(kernel_cc "")
set(kernel_cc ${kernel_xpu_cc})
collect_generated_srcs(kernels_srcs SRCS ${kernel_xpu_kps})
endif() endif()
collect_srcs(kernels_srcs SRCS ${kernel_xpu}) collect_srcs(kernels_srcs SRCS ${kernel_xpu})
kernel_declare("${kernel_xpu}") kernel_declare("${kernel_xpu}")
kernel_declare("${kernel_xpu_kps}") kernel_declare("${kernel_xpu_kps}")
kernel_declare("${kernel_xpu_cc}")
endif() endif()
collect_srcs(kernels_srcs SRCS ${kernel_cc}) collect_srcs(kernels_srcs SRCS ${kernel_cc})
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册