Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/PaddlePaddle/Paddle into…
Browse files Browse the repository at this point in the history
… nested-namespace-part-6
  • Loading branch information
walkalone20 committed Jun 16, 2024
2 parents 09ac2c1 + 02be1a8 commit 298a2f3
Show file tree
Hide file tree
Showing 1,777 changed files with 29,939 additions and 83,875 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,7 @@ paddle/phi/kernels/fusion/cutlass/cutlass_kernels/fpA_intB_gemm/autogen_tmp/*
paddle/fluid/pybind/static_op_function.*
paddle/fluid/pybind/ops_api.cc
python/paddle/tensor/tensor.pyi
paddle/phi/kernels/fusion/cutlass/conv2d/build
paddle/phi/kernels/fusion/cutlass/conv2d/cutlass
paddle/phi/kernels/fusion/cutlass/gemm_epilogue/build
paddle/phi/kernels/fusion/cutlass/gemm_epilogue/cutlass
2 changes: 0 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ repos:
- id: sort-simple-yaml
files: (ops|backward|op_[a-z_]+)\.yaml$
- id: trailing-whitespace
files: (.*\.(py|bzl|md|rst|c|cc|cxx|cpp|cu|h|hpp|hxx|xpu|kps|cmake|yaml|yml|hook)|BUILD|.*\.BUILD|WORKSPACE|CMakeLists\.txt)$
- repo: https://github.com/Lucas-C/pre-commit-hooks.git
rev: v1.5.1
hooks:
Expand Down Expand Up @@ -55,7 +54,6 @@ repos:
rev: 23.3.0
hooks:
- id: black
files: (.*\.(py|pyi|bzl)|BUILD|.*\.BUILD|WORKSPACE)$
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.5
hooks:
Expand Down
17 changes: 8 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +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"
${WITH_XPU})
option(WITH_XPU_XRE5 "Compile PaddlePaddle with BAIDU XPU XRE 5" 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 @@ -91,8 +90,8 @@ 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")
if(WITH_GPU AND WITH_XPU_XRE5)
message(FATAL_ERROR "Error when compile GPU and XPU-XRE5 at the same time")
endif()
if(WITH_GPU AND WITH_ROCM)
message(FATAL_ERROR "Error when compile CUDA and ROCM at the same time")
Expand Down Expand Up @@ -468,12 +467,12 @@ 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
if(NOT WITH_XPU AND WITH_XPU_XRE5)
message((WARNING
"Disable XRE5 when compiling without XPU. Force WITH_XPU_XRE5=OFF"))
set(WITH_XPU_XRE5
OFF
CACHE STRING "Disable XHPC when compiling without XPU" FORCE)
CACHE STRING "Disable XRE5 when compiling without XPU" FORCE)
endif()

if(WITH_NCCL)
Expand Down
4 changes: 4 additions & 0 deletions cmake/cinn/external/absl.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ set(ABSL_LIB_NAMES
raw_hash_set)
set(ABSL_LIBS "")

if(WITH_ROCM)
list(APPEND ABSL_LIB_NAMES strings_internal raw_logging_internal)
endif()

add_library(absl STATIC IMPORTED GLOBAL)
set_property(TARGET absl PROPERTY IMPORTED_LOCATION
${ABSL_INSTALL_DIR}/lib/libabsl_base.a)
Expand Down
110 changes: 49 additions & 61 deletions cmake/external/xpu.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -20,36 +20,26 @@ include(ExternalProject)
set(XPU_PROJECT "extern_xpu")
set(XPU_API_LIB_NAME "libxpuapi.so")
set(XPU_RT_LIB_NAME "libxpurt.so")
set(XPU_CUDA_LIB_NAME "libxpucuda.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 "20240104")
endif()
if(NOT DEFINED XPU_XDNN_BASE_DATE)
set(XPU_XDNN_BASE_DATE "20240327")
if(NOT DEFINED XPU_XRE_BASE_VERSION)
set(XPU_XRE_BASE_VERSION "4.32.0.1")
endif()
if(NOT DEFINED XPU_XHPC_BASE_DATE)
set(XPU_XHPC_BASE_DATE "20240515")
endif()
set(XPU_XCCL_BASE_VERSION "1.2.0.5")
set(XPU_XCCL_BASE_VERSION "1.2.1.2")
if(NOT DEFINED XPU_XFT_BASE_VERSION)
set(XPU_XFT_BASE_VERSION "20230602")
endif()
set(XPU_XPTI_BASE_VERSION "0.0.1")

if(NOT DEFINED XPU_BASE_URL)
set(XPU_BASE_URL_WITHOUT_DATE
"https://baidu-kunlun-product.su.bcebos.com/KL-SDK/klsdk-dev")
set(XPU_BASE_URL "${XPU_BASE_URL_WITHOUT_DATE}/${XPU_BASE_DATE}")
else()
set(XPU_BASE_URL "${XPU_BASE_URL}")
endif()

set(XPU_XDNN_BASE_URL
"https://klx-sdk-release-public.su.bcebos.com/xdnn/stable/${XPU_XDNN_BASE_DATE}"
set(XPU_XRE_BASE_URL
"https://klx-sdk-release-public.su.bcebos.com/xre/release/${XPU_XRE_BASE_VERSION}"
)

set(XPU_XCCL_BASE_URL
Expand All @@ -66,6 +56,14 @@ set(XPU_XPTI_BASE_URL
"https://klx-sdk-release-public.su.bcebos.com/xpti/dev/${XPU_XPTI_BASE_VERSION}"
)

if(WITH_XPU_XRE5)
set(XPU_XRE_BASE_VERSION "5.0.3.1")
set(XPU_XHPC_BASE_DATE "20240601")
set(XPU_XRE_BASE_URL
"https://klx-sdk-release-public.su.bcebos.com/xre/kl3-release/${XPU_XRE_BASE_VERSION}"
)
endif()

if(WITH_XCCL_RDMA)
set(XPU_XCCL_PREFIX "xccl_rdma")
else()
Expand All @@ -74,45 +72,42 @@ endif()

if(WITH_AARCH64)
set(XPU_XRE_DIR_NAME "xre-kylin_aarch64")
set(XPU_XDNN_DIR_NAME "xdnn-kylin_aarch64")
set(XPU_XCCL_DIR_NAME "${XPU_XCCL_PREFIX}-kylin_aarch64")
set(XPU_XFT_DIR_NAME "") # TODO: xft has no kylin output at now.
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 "") # 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")
if(WITH_XPU_XRE5)
set(XPU_XRE_DIR_NAME "xre-bdcentos-x86_64-${XPU_XRE_BASE_VERSION}")
set(XPU_XHPC_DIR_NAME "xhpc-bdcentos7_x86_64")
else()
set(XPU_XRE_DIR_NAME "xre-bdcentos_x86_64")
set(XPU_XHPC_DIR_NAME "xhpc-bdcentos_x86_64")
endif()
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")
set(XPU_XCCL_DIR_NAME "${XPU_XCCL_PREFIX}-bdcentos_x86_64")
set(XPU_XFT_DIR_NAME "xft_bdcentos6u3_x86_64_gcc82")
else()
set(XPU_XRE_DIR_NAME "xre-ubuntu_x86_64")
set(XPU_XDNN_DIR_NAME "xdnn-ubuntu_x86_64")
# Ubuntu as default
if(WITH_XPU_XRE5)
set(XPU_XRE_DIR_NAME "xre-ubuntu_2004-x86_64-${XPU_XRE_BASE_VERSION}")
set(XPU_XHPC_DIR_NAME "xhpc-ubuntu2004_x86_64")
else()
set(XPU_XRE_DIR_NAME "xre-ubuntu_1604_x86_64")
set(XPU_XHPC_DIR_NAME "xhpc-ubuntu_x86_64")
endif()
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")

set(XPU_XRE_URL
"${XPU_BASE_URL}/${XPU_XRE_DIR_NAME}.tar.gz"
CACHE STRING "" FORCE)
set(XPU_XDNN_URL
"${XPU_XDNN_BASE_URL}/${XPU_XDNN_DIR_NAME}.tar.gz"
"${XPU_XRE_BASE_URL}/${XPU_XRE_DIR_NAME}.tar.gz"
CACHE STRING "" FORCE)
set(XPU_XCCL_URL
"${XPU_XCCL_BASE_URL}/${XPU_XCCL_DIR_NAME}.tar.gz"
Expand All @@ -125,10 +120,14 @@ 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)
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)

if(DEFINED XPU_BASE_URL)
set(XPU_XRE_URL "${XPU_BASE_URL}/${XPU_XRE_DIR_NAME}.tar.gz")
set(XPU_XHPC_URL "${XPU_BASE_URL}/${XPU_XHPC_DIR_NAME}.tar.gz")
set(XPU_XCCL_URL "${XPU_BASE_URL}/${XPU_XCCL_DIR_NAME}.tar.gz")
endif()

set(SNAPPY_PREFIX_DIR "${THIRD_PARTY_PATH}/xpu")
Expand All @@ -140,6 +139,7 @@ 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_CUDA_LIB "${XPU_LIB_DIR}/${XPU_CUDA_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 @@ -166,10 +166,8 @@ ExternalProject_Add(
PREFIX ${SNAPPY_PREFIX_DIR}
DOWNLOAD_DIR ${XPU_DOWNLOAD_DIR}
DOWNLOAD_COMMAND
bash ${CMAKE_SOURCE_DIR}/tools/xpu/check_xpu_dependence.sh ${XPU_BASE_URL}
${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}
bash ${CMAKE_SOURCE_DIR}/tools/xpu/pack_paddle_depence.sh ${XPU_XRE_URL}
${XPU_XRE_DIR_NAME} ${XPU_XHPC_URL} ${XPU_XHPC_DIR_NAME} ${XPU_XCCL_URL}
${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
Expand Down Expand Up @@ -203,18 +201,13 @@ 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_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()
set(XPU_XFA_INC_DIR "${XPU_INC_DIR}/xhpc/xfa")
include_directories(${XPU_XFA_INC_DIR})

if(WITH_XPTI)
message(STATUS "Compile with XPU XPTI!")
Expand All @@ -228,17 +221,12 @@ if(WITH_XPU_PLUGIN)
include_directories(${CMAKE_SOURCE_DIR}/paddle/phi/kernels/xpu/plugin/include)
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_RT_LIB} ${XPU_XBLAS_LIB} ${XPU_API_LIB}
${XPU_XFA_LIB})
endif()
target_link_libraries(xpulib ${XPU_RT_LIB} ${XPU_BKCL_LIB} ${XPU_XBLAS_LIB}
${XPU_API_LIB} ${XPU_XFA_LIB})

add_dependencies(xpulib ${XPU_PROJECT})

Expand Down
6 changes: 1 addition & 5 deletions cmake/hip.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,7 @@ list(APPEND HIP_CXX_FLAGS -Wno-unused-local-typedef)
list(APPEND HIP_CXX_FLAGS -Wno-missing-braces)
list(APPEND HIP_CXX_FLAGS -Wno-sometimes-uninitialized)

if(WITH_CINN)
list(APPEND HIP_CXX_FLAGS -std=c++14)
else()
list(APPEND HIP_CXX_FLAGS -std=c++17)
endif()
list(APPEND HIP_CXX_FLAGS -std=c++17)
list(APPEND HIP_CXX_FLAGS --gpu-max-threads-per-block=1024)

if(CMAKE_BUILD_TYPE MATCHES Debug)
Expand Down
8 changes: 8 additions & 0 deletions cmake/inference_lib.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,14 @@ else()
inference_lib_dist
SRCS ${paddle_phi_lib}
DSTS ${PADDLE_INFERENCE_INSTALL_DIR}/paddle/lib)
if(WITH_GPU OR WITH_ROCM)
set(paddle_phi_kernel_gpu_lib
${PADDLE_BINARY_DIR}/paddle/phi/libphi_kernel_gpu.*)
copy(
inference_lib_dist
SRCS ${paddle_phi_kernel_gpu_lib}
DSTS ${PADDLE_INFERENCE_INSTALL_DIR}/paddle/lib)
endif()
endif()
endif()

Expand Down
4 changes: 2 additions & 2 deletions paddle/.set_python_path.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
# limitations under the License.

#
# A simple test driver for cmake.
# A simple test driver for cmake.
# set PYTHONPATH before run command.
# Usage:
# ./.set_python_pash.sh -p YOUR_PYTHON_PATH {exec...}
#
#
# It same as PYTHONPATH=${YOUR_PYTHON_PATH}:$PYTHONPATH {exec...}
#
PYPATH=""
Expand Down
20 changes: 0 additions & 20 deletions paddle/cinn/auto_schedule/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,25 +1,5 @@
add_subdirectory(analysis)
add_subdirectory(cost_model)
add_subdirectory(database)
add_subdirectory(measure)
add_subdirectory(post_schedule_rule)
add_subdirectory(search_space)
add_subdirectory(search_strategy)
add_subdirectory(task)
add_subdirectory(task_scheduler)
add_subdirectory(tests)

cinn_proto_library(auto_schedule_proto SRCS auto_schedule.proto DEPS
schedule_desc_proto)

core_gather_headers()

gather_srcs(cinnapi_src SRCS auto_tuner.cc)

#cinn_cc_test(test_auto_tuner SRCS auto_tuner_test.cc DEPS cinncore)

foreach(header ${auto_schedule_proto_HDRS})
set(core_proto_includes
"${core_proto_includes};${header}"
CACHE INTERNAL "")
endforeach()
2 changes: 0 additions & 2 deletions paddle/cinn/auto_schedule/analysis/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
core_gather_headers()

gather_srcs(cinnapi_src SRCS analyze_ir.cc)

cinn_cc_test(test_analyze_ir SRCS analyze_ir_test.cc DEPS cinncore)
Loading

0 comments on commit 298a2f3

Please sign in to comment.