Skip to content

Commit

Permalink
Merge branch 'develop' into apply_tensor
Browse files Browse the repository at this point in the history
  • Loading branch information
yangguohao authored Dec 19, 2023
2 parents bd99a1d + 5d32c61 commit 4931c16
Show file tree
Hide file tree
Showing 560 changed files with 28,222 additions and 5,661 deletions.
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -108,5 +108,13 @@ paddle/fluid/pir/dialect/operator/ir/pd_api.*
paddle/fluid/pir/dialect/operator/ir/op_decomp.cc
paddle/fluid/pir/dialect/operator/ir/pd_op_vjp.cc
paddle/fluid/pir/dialect/operator/ir/pd_op.*
paddle/fluid/pir/dialect/operator/ir/pd_op_bwd.*
paddle/fluid/pir/dialect/operator/ir/pd_op_fused.*
paddle/fluid/pir/dialect/operator/ir/pd_op_fused_bwd.*
paddle/fluid/pir/dialect/operator/ir/pd_pir_op.*
paddle/fluid/pir/dialect/operator/ir/pd_pir_op_bwd.*
paddle/fluid/pir/dialect/operator/ir/pd_pir_op_update.*
paddle/fluid/pir/dialect/operator/ir/pd_op_info.*
paddle/cinn/hlir/dialect/generated/ops.parsed.yaml
paddle/cinn/hlir/dialect/operator/ir/cinn_op.*
paddle/cinn/hlir/dialect/operator/ir/cinn_op_info.*
12 changes: 12 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ option(WITH_XPU "Compile PaddlePaddle with BAIDU KUNLUN XPU" OFF)
option(WITH_XPU_KP "Compile PaddlePaddle with BAIDU XPU compiler " OFF)
option(WITH_XPU_XFT "Compile PaddlePaddle with BAIDU XPU-XFT" OFF)
option(WITH_XPU_PLUGIN "Compile PaddlePaddle with BAIDU XPU plugin" OFF)
option(WITH_XPU_XHPC "Compile PaddlePaddle with BAIDU XPU-HPC library" OFF)
option(WITH_WIN_DUMP_DBG "Compile with windows core dump debug mode" OFF)
option(WITH_ROCM "Compile PaddlePaddle with ROCM platform" OFF)
option(WITH_IPU "Compile PaddlePaddle with Graphcore IPU" OFF)
Expand Down Expand Up @@ -86,6 +87,9 @@ endif()
if(WITH_GPU AND WITH_XPU_XFT)
message(FATAL_ERROR "Error when compile GPU and XPU-XFT at the same time")
endif()
if(WITH_GPU AND WITH_XPU_XHPC)
message(FATAL_ERROR "Error when compile GPU and XPU-HPC at the same time")
endif()
if(WITH_GPU AND WITH_ROCM)
message(FATAL_ERROR "Error when compile CUDA and ROCM at the same time")
endif()
Expand Down Expand Up @@ -451,6 +455,14 @@ if(NOT WITH_XPU AND WITH_XPU_BKCL)
CACHE STRING "Disable BKCL when compiling without XPU" FORCE)
endif()

if(NOT WITH_XPU AND WITH_XPU_XHPC)
message(
WARNING "Disable XHPC when compiling without XPU. Force WITH_XPU_XHPC=OFF.")
set(WITH_XPU_XHPC
OFF
CACHE STRING "Disable XHPC when compiling without XPU" FORCE)
endif()

if(WITH_NCCL)
add_definitions("-DPADDLE_WITH_NCCL")
include(nccl)
Expand Down
1 change: 0 additions & 1 deletion cmake/cinn/external/llvm.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ llvm_map_components_to_libnames(
message(STATUS "LLVM libs: ${llvm_libs}")

get_property(mlir_libs GLOBAL PROPERTY MLIR_ALL_LIBS)
message(STATUS "MLIR libs: ${mlir_libs}")
add_definitions(${LLVM_DEFINITIONS})

# The minimum needed libraries for MLIR IR parse and transform.
Expand Down
1 change: 0 additions & 1 deletion cmake/cinn/llvm.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ llvm_map_components_to_libnames(
message(STATUS "LLVM libs: ${llvm_libs}")

get_property(mlir_libs GLOBAL PROPERTY MLIR_ALL_LIBS)
message(STATUS "MLIR libs: ${mlir_libs}")
add_definitions(${LLVM_DEFINITIONS})

# The minimum needed libraries for MLIR IR parse and transform.
Expand Down
61 changes: 44 additions & 17 deletions cmake/external/xpu.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,16 @@ set(XPU_API_LIB_NAME "libxpuapi.so")
set(XPU_RT_LIB_NAME "libxpurt.so")
set(XPU_XFT_LIB_NAME "libxft.so")
set(XPU_XPTI_LIB_NAME "libxpti.so")
set(XPU_XBLAS_LIB_NAME "libxpu_blas.so")
set(XPU_XFA_LIB_NAME "libxpu_flash_attention.so")

if(NOT DEFINED XPU_BASE_DATE)
set(XPU_BASE_DATE "20231203")
endif()
set(XPU_XCCL_BASE_VERSION "1.1.6.1")
if(NOT DEFINED XPU_XHPC_BASE_DATE)
set(XPU_XHPC_BASE_DATE "20231215")
endif()
set(XPU_XCCL_BASE_VERSION "1.1.7.1")
if(NOT DEFINED XPU_XFT_BASE_VERSION)
set(XPU_XFT_BASE_VERSION "20230602")
endif()
Expand Down Expand Up @@ -68,18 +73,20 @@ if(WITH_AARCH64)
elseif(WITH_SUNWAY)
set(XPU_XRE_DIR_NAME "xre-deepin_sw6_64")
set(XPU_XDNN_DIR_NAME "xdnn-deepin_sw6_64")
set(XPU_XCCL_DIR_NAME "${XPU_XCCL_PREFIX}-deepin_sw6_64")
set(XPU_XCCL_DIR_NAME "") # TODO: xccl has no deepin output at now.
set(XPU_XFT_DIR_NAME "") # TODO: xft has no deepin output at now.
elseif(WITH_BDCENTOS)
set(XPU_XRE_DIR_NAME "xre-bdcentos_x86_64")
set(XPU_XDNN_DIR_NAME "xdnn-bdcentos_x86_64")
set(XPU_XCCL_DIR_NAME "${XPU_XCCL_PREFIX}-bdcentos_x86_64")
set(XPU_XFT_DIR_NAME "xft_bdcentos6u3_x86_64_gcc82")
set(XPU_XHPC_DIR_NAME "xhpc-bdcentos_x86_64")
elseif(WITH_UBUNTU)
set(XPU_XRE_DIR_NAME "xre-ubuntu_x86_64")
set(XPU_XDNN_DIR_NAME "xdnn-ubuntu_x86_64")
set(XPU_XCCL_DIR_NAME "${XPU_XCCL_PREFIX}-ubuntu_x86_64")
set(XPU_XFT_DIR_NAME "xft_ubuntu1604_x86_64")
set(XPU_XHPC_DIR_NAME "xhpc-ubuntu_x86_64")
elseif(WITH_CENTOS)
set(XPU_XRE_DIR_NAME "xre-centos7_x86_64")
set(XPU_XDNN_DIR_NAME "xdnn-centos7_x86_64")
Expand All @@ -90,6 +97,7 @@ else()
set(XPU_XDNN_DIR_NAME "xdnn-ubuntu_x86_64")
set(XPU_XCCL_DIR_NAME "${XPU_XCCL_PREFIX}-ubuntu_x86_64")
set(XPU_XFT_DIR_NAME "xft_ubuntu1604_x86_64")
set(XPU_XHPC_DIR_NAME "xhpc-ubuntu_x86_64")
endif()
set(XPU_XPTI_DIR_NAME "xpti")

Expand All @@ -110,14 +118,22 @@ set(XPU_XFT_GET_DEPENCE_URL
"https://baidu-kunlun-public.su.bcebos.com/paddle_depence/get_xft_dependence.sh"
CACHE STRING "" FORCE)

if(WITH_XPU_XHPC)
set(XPU_XHPC_URL
"https://klx-sdk-release-public.su.bcebos.com/xhpc/dev/${XPU_XHPC_BASE_DATE}/${XPU_XHPC_DIR_NAME}.tar.gz"
CACHE STRING "" FORCE)
endif()

set(SNAPPY_PREFIX_DIR "${THIRD_PARTY_PATH}/xpu")
set(XPU_DOWNLOAD_DIR "${SNAPPY_PREFIX_DIR}/src/${XPU_PROJECT}")
set(XPU_INSTALL_DIR "${THIRD_PARTY_PATH}/install/xpu")
set(XPU_INC_DIR "${THIRD_PARTY_PATH}/install/xpu/include")
set(XPU_LIB_DIR "${THIRD_PARTY_PATH}/install/xpu/lib")

set(XPU_API_LIB "${XPU_LIB_DIR}/${XPU_API_LIB_NAME}")
set(XPU_XBLAS_LIB "${XPU_LIB_DIR}/${XPU_XBLAS_LIB_NAME}")
set(XPU_RT_LIB "${XPU_LIB_DIR}/${XPU_RT_LIB_NAME}")
set(XPU_XFA_LIB "${XPU_LIB_DIR}/${XPU_XFA_LIB_NAME}")

set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_RPATH}" "${XPU_INSTALL_DIR}/lib")

Expand All @@ -144,19 +160,20 @@ ExternalProject_Add(
DOWNLOAD_DIR ${XPU_DOWNLOAD_DIR}
DOWNLOAD_COMMAND
bash ${CMAKE_SOURCE_DIR}/tools/xpu/check_xpu_dependence.sh ${XPU_BASE_URL}
${XPU_XCCL_BASE_URL} && bash
${XPU_XCCL_BASE_URL} && WITH_XPU_XHPC=${WITH_XPU_XHPC} bash
${CMAKE_SOURCE_DIR}/tools/xpu/pack_paddle_depence.sh ${XPU_XRE_URL}
${XPU_XRE_DIR_NAME} ${XPU_XDNN_URL} ${XPU_XDNN_DIR_NAME} ${XPU_XCCL_URL}
${XPU_XCCL_DIR_NAME} && wget ${XPU_XFT_GET_DEPENCE_URL} && bash
get_xft_dependence.sh ${XPU_XFT_URL} ${XPU_XFT_DIR_NAME} &&
WITH_XPTI=${WITH_XPTI} bash
${XPU_XCCL_DIR_NAME} ${XPU_XHPC_URL} ${XPU_XHPC_DIR_NAME} && wget
${XPU_XFT_GET_DEPENCE_URL} && bash get_xft_dependence.sh ${XPU_XFT_URL}
${XPU_XFT_DIR_NAME} && WITH_XPTI=${WITH_XPTI} bash
${CMAKE_SOURCE_DIR}/tools/xpu/get_xpti_dependence.sh ${XPU_XPTI_URL}
${XPU_XPTI_DIR_NAME}
DOWNLOAD_NO_PROGRESS 1
UPDATE_COMMAND ""
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${XPU_INSTALL_ROOT}
CMAKE_CACHE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${XPU_INSTALL_ROOT}
BUILD_BYPRODUCTS ${XPU_API_LIB}
BUILD_BYPRODUCTS ${XPU_API_LIB} BUILD_BYPORDUCTS ${XPU_XBLAS_LIB}
BUILD_BYPRODUCTS ${XPU_XFA_LIB}
BUILD_BYPRODUCTS ${XPU_RT_LIB}
BUILD_BYPRODUCTS ${XPU_BKCL_LIB})

Expand All @@ -179,6 +196,19 @@ if(WITH_XPU_XFT)
set(XPU_XFT_LIB "${XPU_LIB_DIR}/${XPU_XFT_LIB_NAME}")
endif()

if(WITH_XPU_XHPC)
message(STATUS "Compile with XPU XHPC!")
add_definitions(-DPADDLE_WITH_XPU_XHPC)

set(XPU_XHPC_INC_DIR "${XPU_INC_DIR}/xhpc")
include_directories(${XPU_XHPC_INC_DIR})
set(XPU_XBLAS_INC_DIR "${XPU_INC_DIR}/xhpc/xblas")
include_directories(${XPU_XBLAS_INC_DIR})

set(XPU_XFA_INC_DIR "${XPU_INC_DIR}/xhpc/xfa")
include_directories(${XPU_XFA_INC_DIR})
endif()

if(WITH_XPTI)
message(STATUS "Compile with XPU XPTI!")
add_definitions(-DPADDLE_WITH_XPTI)
Expand All @@ -191,21 +221,18 @@ if(WITH_XPU_PLUGIN)
include_directories(${CMAKE_SOURCE_DIR}/paddle/phi/kernels/xpu/plugin/include)
endif()

if(WITH_XPU_BKCL AND WITH_XPU_XFT)
target_link_libraries(xpulib ${XPU_API_LIB} ${XPU_RT_LIB} ${XPU_BKCL_LIB}
${XPU_XFT_LIB})
elseif(WITH_XPU_BKCL)
target_link_libraries(xpulib ${XPU_API_LIB} ${XPU_RT_LIB} ${XPU_BKCL_LIB})
elseif(WITH_XPU_XFT)
target_link_libraries(xpulib ${XPU_API_LIB} ${XPU_RT_LIB} ${XPU_XFT_LIB})
else()
target_link_libraries(xpulib ${XPU_API_LIB} ${XPU_RT_LIB})
endif()
target_link_libraries(xpulib ${XPU_API_LIB} ${XPU_RT_LIB} ${XPU_BKCL_LIB}
${XPU_XFT_LIB})

if(WITH_XPTI)
target_link_libraries(xpulib ${XPU_XPTI_LIB})
endif()

if(WITH_XPU_XHPC)
target_link_libraries(xpulib ${XPU_API_LIB} ${XPU_RT_LIB} ${XPU_XBLAS_LIB}
${XPU_XFA_LIB})
endif()

add_dependencies(xpulib ${XPU_PROJECT})

# Ensure that xpu/api.h can be included without dependency errors.
Expand Down
8 changes: 4 additions & 4 deletions cmake/generic.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,10 @@ function(paddle_test_build TARGET_NAME)
${paddle_test_DEPS} common paddle_gtest_main_new)
add_dependencies(${TARGET_NAME} ${paddle_lib} ${paddle_test_DEPS} common
paddle_gtest_main_new)
if(WITH_MKLDNN)
target_link_libraries(${TARGET_NAME} mkldnn)
add_dependencies(${TARGET_NAME} mkldnn)
endif()
if(WITH_SHARED_PHI)
target_link_libraries(${TARGET_NAME} $<TARGET_LINKER_FILE:phi>)
add_dependencies(${TARGET_NAME} phi)
Expand Down Expand Up @@ -833,7 +837,6 @@ function(hip_test TARGET_NAME)
${hip_test_DEPS}
paddle_gtest_main
lod_tensor
memory
gtest
glog
phi
Expand All @@ -843,7 +846,6 @@ function(hip_test TARGET_NAME)
${hip_test_DEPS}
paddle_gtest_main
lod_tensor
memory
gtest
phi
glog)
Expand Down Expand Up @@ -940,7 +942,6 @@ function(xpu_test TARGET_NAME)
${xpu_test_DEPS}
paddle_gtest_main
lod_tensor
memory
gtest
phi
glog
Expand All @@ -950,7 +951,6 @@ function(xpu_test TARGET_NAME)
${xpu_test_DEPS}
paddle_gtest_main
lod_tensor
memory
gtest
phi
glog)
Expand Down
2 changes: 0 additions & 2 deletions paddle/cinn/api/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
core_gather_headers()

gather_srcs(cinnapi_src SRCS op_node.cc tensor_node.cc)

message(STATUS "srcs: ${cinnapi_src}")
11 changes: 8 additions & 3 deletions paddle/cinn/common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ gather_srcs(
cas.cc
union_find.cc
python_interpreter_guard.cc
nvgpu_dev_info.cc)

message(STATUS "srcs: ${cinnapi_src}")
nvgpu_dev_info.cc
integer_set.cc
dim_expr_simplify.cc)

cinn_cc_test(test_equation_graph_topo_walker SRCS
equation_graph_topo_walker_test.cc DEPS gtest glog)
Expand All @@ -38,10 +38,15 @@ cinn_cc_test(test_arithmatic SRCS arithmatic_test.cc DEPS cinncore)
cinn_cc_test(test_cas SRCS cas_test.cc DEPS cinncore)
cinn_cc_test(test_type SRCS type_test.cc DEPS cinncore)
cinn_cc_test(test_axis SRCS axis_test.cc DEPS cinncore)
cinn_cc_test(test_integer_set SRCS integer_set_test.cc DEPS cinncore)

cinn_cc_test(test_fp16_bf16_host SRCS float16_bfloat16_host_test.cc DEPS gtest
glog)
if(WITH_CUDA)
cinn_nv_test(test_fp16_bf16_cuda SRCS float16_bfloat16_cuda_test.cu DEPS
gtest glog)
endif()
if(NOT CINN_ONLY)
cinn_cc_test(dim_expr_simplify_test SRCS dim_expr_simplify_test.cc DEPS
cinncore)
endif()
Loading

0 comments on commit 4931c16

Please sign in to comment.