Skip to content

Commit 6e56903

Browse files
committed
Merge remote-tracking branch 'upstream/develop' into pow-cp
2 parents cd45a62 + a7c64ae commit 6e56903

File tree

2,238 files changed

+72354
-28294
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,238 files changed

+72354
-28294
lines changed

.flake8

Lines changed: 0 additions & 28 deletions
This file was deleted.

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,4 +107,3 @@ paddle/phi/kernels/fusion/cutlass/cutlass_kernels/fpA_intB_gemm/autogen/*
107107
paddle/phi/kernels/fusion/cutlass/cutlass_kernels/fpA_intB_gemm/autogen_tmp/*
108108
paddle/fluid/pybind/static_op_function.*
109109
paddle/fluid/pybind/ops_api.cc
110-
paddle/fluid/pir/drr/src/*_op_factory_generated.*

.pre-commit-config.yaml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ repos:
3636
# Exclude some unit test files that require tabs.
3737
exclude: |
3838
(?x)^(
39-
test/dygraph_to_static/test_legacy_error.py
39+
test/dygraph_to_static/test_error.py
4040
)$
4141
- repo: local
4242
hooks:
@@ -56,13 +56,8 @@ repos:
5656
hooks:
5757
- id: black
5858
files: (.*\.(py|pyi|bzl)|BUILD|.*\.BUILD|WORKSPACE)$
59-
- repo: https://github.com/PyCQA/flake8
60-
rev: 5.0.4
61-
hooks:
62-
- id: flake8
63-
args: ["--config=.flake8"]
6459
- repo: https://github.com/astral-sh/ruff-pre-commit
65-
rev: v0.2.0
60+
rev: v0.3.0
6661
hooks:
6762
- id: ruff
6863
args: [--fix, --exit-non-zero-on-fix, --no-cache]

CMakeLists.txt

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,11 @@ option(WITH_ONNXRUNTIME "Compile PaddlePaddle with ONNXRUNTIME" OFF)
6363
option(WITH_CUSPARSELT "Compile PaddlePaddle with CUSPARSELT" OFF)
6464
option(WITH_SETUP_INSTALL "Compile PaddlePaddle with setup.py" OFF)
6565
option(WITH_SHARED_PHI "Compile PaddlePaddle with SHARED LIB of PHI" ON)
66-
option(CINN_ONLY "Compile CINN only in Paddle" OFF)
6766
option(CINN_WITH_CUDNN "Compile CINN with CUDNN support" ON)
68-
67+
option(WITH_PIP_CUDA_LIBRARIES
68+
"Paddle uses the CUDA library provided by NVIDIA" OFF)
69+
option(WITH_NIGHTLY_BUILD
70+
"Compile nightly paddle whl package of the develop branch" OFF)
6971
find_package(Git REQUIRED)
7072

7173
# config GIT_URL with github mirrors to speed up dependent repos clone
@@ -97,11 +99,16 @@ endif()
9799

98100
if(WITH_GPU AND NOT APPLE)
99101
#(Note risemeup1): The cudart dynamic library libcudart.so is used by set CUDA_USE_STATIC_CUDA_RUNTIME and CMAKE_CUDA_FLAGS
100-
if(LINUX)
102+
if(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_SYSTEM_PROCESSOR STREQUAL
103+
"x86_64")
101104
set(CUDA_USE_STATIC_CUDA_RUNTIME
102105
OFF
103106
CACHE BOOL "" FORCE)
104107
set(CMAKE_CUDA_FLAGS "--cudart shared")
108+
if(WITH_PIP_CUDA_LIBRARIES)
109+
#(Note risemeup1): Flag 'WITH_PIP_CUDA_LIBRARIES' will be used in dynamic_loader.cc to search for CUDA-related .so files through the Python libraries provided by NVIDIA.
110+
add_definitions(-DWITH_PIP_CUDA_LIBRARIES)
111+
endif()
105112
endif()
106113
enable_language(CUDA)
107114
message(STATUS "CUDA compiler: ${CMAKE_CUDA_COMPILER}, version: "
@@ -233,6 +240,8 @@ if(WIN32)
233240
"${${flag_var}} /ignore:4049 /ignore:4217 /ignore:4006 /ignore:4221")
234241
if(MSVC_STATIC_CRT)
235242
set(${flag_var} "${${flag_var}} /NODEFAULTLIB:MSVCRT.LIB")
243+
else()
244+
set(${flag_var} "${${flag_var}} /NODEFAULTLIB:LIBCMT.LIB")
236245
endif()
237246
endforeach()
238247

@@ -618,18 +627,6 @@ if(WITH_CINN)
618627

619628
include(cmake/cinn.cmake)
620629
add_definitions(-DPADDLE_WITH_CINN)
621-
622-
if(CINN_ONLY)
623-
add_definitions(-DCINN_WITH_ONLY)
624-
if(WITH_PYTHON)
625-
add_subdirectory(python)
626-
endif()
627-
add_subdirectory(test)
628-
if(NOT WITH_GFLAGS)
629-
add_subdirectory(paddle/utils)
630-
endif()
631-
return()
632-
endif()
633630
endif()
634631

635632
#------------- cinn cmake config end --------------

cmake/ccache.cmake

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ if(NOT WIN32)
1111
# show statistics summary of ccache
1212
message("ccache version\t\t\t " ${ccache_version} "\n"
1313
${cache_directory})
14-
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ${CCACHE_PATH})
15-
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ${CCACHE_PATH})
14+
set(CMAKE_C_COMPILER_LAUNCHER ${CCACHE_PATH})
15+
set(CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE_PATH})
16+
set(CMAKE_CUDA_COMPILER_LAUNCHER ${CCACHE_PATH})
1617
endif()
1718
elseif("${CMAKE_GENERATOR}" STREQUAL "Ninja")
1819
# (Note:zhouwei25) Only Ninja Generator can support sccache now

cmake/cinn.cmake

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -167,10 +167,8 @@ cinn_cc_library(
167167
${jitify_deps})
168168
add_dependencies(cinnapi GEN_LLVM_RUNTIME_IR_HEADER ZLIB::ZLIB)
169169
add_dependencies(cinnapi GEN_LLVM_RUNTIME_IR_HEADER ${core_deps})
170-
if(NOT CINN_ONLY)
171-
target_link_libraries(cinnapi op_dialect pir phi)
172-
add_dependencies(cinnapi op_dialect pir phi)
173-
endif()
170+
target_link_libraries(cinnapi op_dialect pir phi)
171+
add_dependencies(cinnapi op_dialect pir phi)
174172

175173
target_link_libraries(cinnapi ${PYTHON_LIBRARIES})
176174

@@ -183,11 +181,6 @@ if(WITH_MKL)
183181
endif()
184182
endif()
185183

186-
if(CINN_ONLY)
187-
target_link_libraries(cinnapi common)
188-
add_dependencies(cinnapi common)
189-
endif()
190-
191184
if(WITH_GPU)
192185
target_link_libraries(
193186
cinnapi
@@ -230,10 +223,8 @@ function(gen_cinncore LINKTYPE)
230223
ginac)
231224
add_dependencies(${CINNCORE_TARGET} GEN_LLVM_RUNTIME_IR_HEADER ZLIB::ZLIB)
232225
add_dependencies(${CINNCORE_TARGET} GEN_LLVM_RUNTIME_IR_HEADER ${core_deps})
233-
if(NOT CINN_ONLY)
234-
target_link_libraries(${CINNCORE_TARGET} op_dialect pir phi)
235-
add_dependencies(${CINNCORE_TARGET} op_dialect pir phi)
236-
endif()
226+
target_link_libraries(${CINNCORE_TARGET} op_dialect pir phi)
227+
add_dependencies(${CINNCORE_TARGET} op_dialect pir phi)
237228

238229
add_dependencies(${CINNCORE_TARGET} pybind)
239230
target_link_libraries(${CINNCORE_TARGET} ${PYTHON_LIBRARIES})
@@ -247,11 +238,6 @@ function(gen_cinncore LINKTYPE)
247238
endif()
248239
endif()
249240

250-
if(CINN_ONLY)
251-
target_link_libraries(${CINNCORE_TARGET} common)
252-
add_dependencies(${CINNCORE_TARGET} common)
253-
endif()
254-
255241
if(WITH_GPU)
256242
target_link_libraries(
257243
${CINNCORE_TARGET}

cmake/cuda.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ select_nvcc_arch_flags(NVCC_FLAGS_EXTRA NVCC_ARCH_BIN)
294294
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} ${NVCC_FLAGS_EXTRA}")
295295
message(STATUS "NVCC_FLAGS_EXTRA: ${NVCC_FLAGS_EXTRA}")
296296

297-
# Set C++14 support
297+
# Set C++17 support
298298
set(CUDA_PROPAGATE_HOST_FLAGS OFF)
299299
# Release/Debug flags set by cmake. Such as -O3 -g -DNDEBUG etc.
300300
# So, don't set these flags here.

cmake/phi_header.cmake renamed to cmake/export_paddle_header.cmake

Lines changed: 35 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,33 +15,57 @@
1515
set(PADDLE_INFERENCE_INSTALL_DIR
1616
"${CMAKE_BINARY_DIR}/paddle_inference_install_dir")
1717

18-
function(phi_header_path_compat TARGET_PATH)
19-
message(STATUS "phi header path compat processing: ${TARGET_PATH}")
18+
function(header_path_compat TARGET_PATH)
19+
message(STATUS "header path compat processing: ${TARGET_PATH}")
2020
file(GLOB HEADERS "${TARGET_PATH}/*" "*.h")
2121
foreach(header ${HEADERS})
2222
if(${header} MATCHES ".*.h$")
2323
file(READ ${header} HEADER_CONTENT)
2424
string(REPLACE "paddle/fluid/platform/" "paddle/phi/" HEADER_CONTENT
2525
"${HEADER_CONTENT}")
26+
string(REPLACE "paddle/pir/include/" "paddle/pir/" HEADER_CONTENT
27+
"${HEADER_CONTENT}")
28+
string(REPLACE "paddle/fluid/pir/drr/include/" "paddle/pir/drr/"
29+
HEADER_CONTENT "${HEADER_CONTENT}")
30+
string(REPLACE "paddle/fluid/pir/utils/" "paddle/pir/utils/"
31+
HEADER_CONTENT "${HEADER_CONTENT}")
2632
file(WRITE ${header} "${HEADER_CONTENT}")
27-
message(STATUS "phi header path compat processing complete: ${header}")
33+
message(STATUS "header path compat processing complete: ${header}")
2834
endif()
2935
endforeach()
3036
endfunction()
3137

32-
phi_header_path_compat(${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/paddle)
33-
phi_header_path_compat(
34-
${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/paddle/phi)
35-
phi_header_path_compat(
38+
header_path_compat(${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/paddle)
39+
header_path_compat(${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/paddle/phi)
40+
header_path_compat(
3641
${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/paddle/phi/api)
37-
phi_header_path_compat(
42+
header_path_compat(
3843
${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/paddle/phi/api/ext)
39-
phi_header_path_compat(
44+
header_path_compat(
4045
${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/paddle/phi/api/include)
41-
phi_header_path_compat(
46+
header_path_compat(
4247
${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/paddle/phi/common)
43-
phi_header_path_compat(
48+
header_path_compat(
4449
${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/paddle/phi/core)
50+
header_path_compat(
51+
${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/paddle/pir/core)
52+
header_path_compat(
53+
${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/paddle/pir/core/parser)
54+
header_path_compat(
55+
${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/paddle/pir/dialect/control_flow/ir
56+
)
57+
header_path_compat(
58+
${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/paddle/pir/dialect/shape/ir)
59+
header_path_compat(
60+
${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/paddle/pir/dialect/shape/utils)
61+
header_path_compat(
62+
${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/paddle/pir/drr)
63+
header_path_compat(
64+
${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/paddle/pir/pass)
65+
header_path_compat(
66+
${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/paddle/pir/pattern_rewrite)
67+
header_path_compat(
68+
${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/paddle/pir/utils)
4569

4670
# NOTE(liuyuanle): In inference lib, no need include paddle/utils/pybind.h, so we delete this.
4771
file(READ ${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/paddle/extension.h

cmake/external/cccl.cmake

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,18 @@ set(CCCL_INCLUDE_DIR ${CCCL_SOURCE_DIR})
1515
message("CCCL_INCLUDE_DIR is ${CCCL_INCLUDE_DIR}")
1616
include_directories(${CCCL_INCLUDE_DIR})
1717

18+
file(TO_NATIVE_PATH ${PADDLE_SOURCE_DIR}/patches/cccl/util_device.cuh.patch
19+
native_src)
20+
set(CCCL_PATCH_COMMAND git checkout -- . && git checkout ${CCCL_TAG} && patch
21+
-p1 -Nd ${CCCL_SOURCE_DIR} < ${native_src})
22+
1823
ExternalProject_Add(
1924
extern_cccl
2025
${EXTERNAL_PROJECT_LOG_ARGS}
2126
SOURCE_DIR ${CCCL_SOURCE_DIR}
2227
PREFIX ${CCCL_PREFIX_DIR}
2328
UPDATE_COMMAND ""
29+
PATCH_COMMAND ${CCCL_PATCH_COMMAND}
2430
CONFIGURE_COMMAND ""
2531
BUILD_COMMAND ""
2632
INSTALL_COMMAND ""

cmake/external/dirent.cmake

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ if((NOT DEFINED DIRENT_NAME) OR (NOT DEFINED DIRENT_URL))
2727
set(DIRENT_URL
2828
"${GIT_URL}/tronkko/dirent/archive/refs/tags/1.23.2.tar.gz"
2929
CACHE STRING "" FORCE)
30-
set(DIRENT_CACHE_FILENAME "1.23.2.tar.gz")
30+
set(DIRENT_CACHE_FILENAME
31+
"1.23.2.tar.gz"
32+
CACHE STRING "" FORCE)
3133
endif()
3234

3335
message(STATUS "DIRENT_NAME: ${DIRENT_NAME}, DIRENT_URL: ${DIRENT_URL}")

0 commit comments

Comments
 (0)