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

fix xpu-kp bugs (#54234)

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