Skip to content

Commit ef6c30c

Browse files
committed
Merge branch 'develop' of https://github.com/caolonghao/Paddle into develop
2 parents bd836e0 + ecae7b3 commit ef6c30c

File tree

3,260 files changed

+19288
-15412
lines changed

Some content is hidden

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

3,260 files changed

+19288
-15412
lines changed

.flake8

Lines changed: 80 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,95 @@
11
[flake8]
22
select = C,E,F,W
3-
exclude = ./build
3+
exclude =
4+
./build,
5+
# A trick to exclude fluid/ but keep fluid/tests/, see more at
6+
# https://github.com/PaddlePaddle/Paddle/pull/46290#discussion_r976392010
7+
./python/paddle/fluid/[!t]**,
8+
./python/paddle/fluid/tra**
49
ignore =
510
# E, see https://pycodestyle.pycqa.org/en/latest/intro.html#error-codes
6-
E101,E121,E122,E123,E124,E125,E126,E127,E128,E129,E131,
7-
E201,E202,E203,E221,E225,E226,E228,E231,E241,E251,E261,E262,E265,E266,E271,E272,E275,
11+
E121,E122,E123,E125,E126,E127,E128,E129,E131,
12+
E201,E202,E203,E225,E226,E228,E231,E241,E251,E261,E262,E265,E266,E271,E272,
813
E301,E302,E303,E305,E306,
914
E401,E402,
1015
E501,E502,
1116
E701,E711,E712,E713,E714,E721,E722,E731,E741,
1217

1318
# F, see https://flake8.pycqa.org/en/latest/user/error-codes.html
14-
F401,F402,F403,F404,F405,
15-
F522,F523,F524,F541,
19+
F402,F403,F405,
20+
F522,F524,F541,
1621
F601,F631,F632,
17-
F811,F821,F823,F841,
22+
F811,F821,F841,
1823

1924
# W, see https://pycodestyle.pycqa.org/en/latest/intro.html#error-codes
20-
W191,
2125
W503,W504
2226
W601,W605
27+
per-file-ignores =
28+
# These files need tabs for testing.
29+
python/paddle/fluid/tests/unittests/dygraph_to_static/test_error.py:E101,W191
30+
python/paddle/fluid/tests/unittests/collective/fleet/test_hdfs1.py:E101,W191
31+
# Ignore unused imports in __init__.py
32+
__init__.py: F401
33+
# These files will be fixed later
34+
r/*:F401
35+
cmake/*:F401
36+
paddle/*:F401
37+
tools/*:F401
38+
python/paddle/signal.py:F401
39+
python/paddle/common_ops_import.py:F401
40+
python/paddle/check_import_scipy.py:F401
41+
python/paddle/fft.py:F401
42+
python/paddle/_C_ops.py:F401
43+
python/paddle/framework/*:F401
44+
python/paddle/reader/*:F401
45+
python/paddle/nn/*:F401
46+
python/paddle/distributed/*:F401
47+
python/paddle/proto/*:F401
48+
python/paddle/onnx/*:F401
49+
python/paddle/optimizer/*:F401
50+
python/paddle/hapi/*:F401
51+
python/paddle/autograd/*:F401
52+
python/paddle/dataset/*:F401
53+
python/paddle/io/*:F401
54+
python/paddle/cost_model/*:F401
55+
python/paddle/tests/*:F401
56+
python/paddle/distribution/*:F401
57+
python/paddle/geometric/*:F401
58+
python/paddle/utils/*:F401
59+
python/paddle/vision/*:F401
60+
python/paddle/quantization/*:F401
61+
python/paddle/libs/*:F401
62+
python/paddle/audio/*:F401
63+
python/paddle/incubate/*:F401
64+
python/paddle/amp/*:F401
65+
python/paddle/jit/*:F401
66+
python/paddle/static/*:F401
67+
python/paddle/inference/*:F401
68+
python/paddle/device/*:F401
69+
python/paddle/profiler/*:F401
70+
python/paddle/tensor/*:F401
71+
python/paddle/text/*:F401
72+
python/paddle/metric/*:F401
73+
python/paddle/fluid/tests/custom_kernel/*:F401
74+
python/paddle/fluid/tests/custom_runtime/*:F401
75+
python/paddle/fluid/tests/unittests/ir/*:F401
76+
python/paddle/fluid/tests/unittests/tokenizer/*:F401
77+
python/paddle/fluid/tests/unittests/xpu/*:F401
78+
python/paddle/fluid/tests/unittests/distribution/*:F401
79+
python/paddle/fluid/tests/unittests/mlu/*:F401
80+
python/paddle/fluid/tests/unittests/npu/*:F401
81+
python/paddle/fluid/tests/unittests/ipu/*:F401
82+
python/paddle/fluid/tests/unittests/distributed_passes/*:F401
83+
python/paddle/fluid/tests/unittests/auto_parallel/*:F401
84+
python/paddle/fluid/tests/unittests/dygraph_to_static/*:F401
85+
python/paddle/fluid/tests/unittests/ps/*:F401
86+
python/paddle/fluid/tests/unittests/fft/*:F401
87+
python/paddle/fluid/tests/unittests/white_list/*:F401
88+
python/paddle/fluid/tests/unittests/sequence/*:F401
89+
python/paddle/fluid/tests/unittests/mkldnn/*:F401
90+
python/paddle/fluid/tests/unittests/rnn/*:F401
91+
python/paddle/fluid/tests/book/*:F401
92+
python/paddle/fluid/tests/custom_op/*:F401
93+
python/paddle/fluid/tests/unittests/test_*:F401
94+
python/paddle/fluid/tests/test_*:F401
95+
python/paddle/fluid/tests/*:F401

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ paddle/infrt/tests/dialect/Output
6868
paddle/infrt/tests/lit.cfg.py
6969
paddle/infrt/kernel/phi/infershaped/infershaped_kernel_launchers.cc
7070
paddle/fluid/pybind/eager_op_function.cc
71+
tools/nvcc_lazy
7172

7273
# these files (directories) are generated before build system generation
7374
paddle/fluid/operators/generated_op.cc

.pre-commit-config.yaml

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
# Exclude all third-party libraries globally
12
exclude: |
23
(?x)^(
34
patches/.+|
45
paddle/fluid/framework/fleet/heter_ps/cudf/.+|
5-
paddle/fluid/distributed/ps/thirdparty/round_robin.h
6+
paddle/fluid/distributed/ps/thirdparty/round_robin.h|
7+
python/paddle/utils/gast/.+
68
)$
79
repos:
810
- repo: https://github.com/Lucas-C/pre-commit-hooks.git
@@ -12,16 +14,22 @@ repos:
1214
- id: remove-tabs
1315
files: \.(c|cc|cxx|cpp|cu|h|hpp|hxx|xpu|kps)$
1416
args: [--whitespaces-count, '2']
17+
- id: remove-tabs
18+
files: (.*\.(py|bzl)|BUILD|.*\.BUILD|WORKSPACE)$
19+
args: [--whitespaces-count, '4']
20+
# Exclude the fluid directory but keep the fluid/tests directory.
21+
# And exclude some unit test files that require tabs.
22+
exclude: |
23+
(?x)^(
24+
python/paddle/fluid/(?!tests).+|
25+
python/paddle/fluid/tests/unittests/collective/fleet/test_hdfs1.py|
26+
python/paddle/fluid/tests/unittests/dygraph_to_static/test_error.py
27+
)$
1528
- repo: https://github.com/google/yapf
1629
rev: v0.32.0
1730
hooks:
1831
- id: yapf
1932
files: (.*\.(py|bzl)|BUILD|.*\.BUILD|WORKSPACE)$
20-
exclude: |
21-
(?x)^(
22-
python/paddle/fluid/tests/unittests/dygraph_to_static/test_error.py|
23-
python/paddle/fluid/tests/unittests/dygraph_to_static/test_origin_info.py
24-
)$
2533
- repo: https://github.com/PyCQA/flake8
2634
rev: 4.0.1
2735
hooks:

AUTHORS.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ This is an incomplete list of authors of [Paddle](https://github.com/PaddlePaddl
1212
| beckett1124 | Bin Qi |
1313
| ChengduoZH | Cheng-Duo Zhao|
1414
| chengxiaohua1105 | Xiao-Hua Cheng |
15+
| chenwhql | Wei-Hang Chen |
1516
| cxwangyi, yiwangbaidu, wangkuiyi | Yi Wang |
1617
| cxysteven | Xing-Yi Cheng |
1718
| ddokupil | Dariusz Dokupil |
@@ -91,3 +92,25 @@ This is an incomplete list of authors of [Paddle](https://github.com/PaddlePaddl
9192
| jzhang533 | Jun Zhang |
9293
| Ligoml | Meng-Liu Li |
9394
| jeff41404 | Xiang Gao |
95+
| zh794390558 | Hui Zhang |
96+
| limin2021 | Min Li |
97+
| zhouwei25 | Wei Zhou |
98+
| littletomatodonkey | Ruo-Yu Guo |
99+
| zhupengyang | Zhu Pengyang |
100+
| DesmonDay | Siming Dai |
101+
| thisjiang | jiangcheng |
102+
| yghstill | Guanghua Yu |
103+
| CtfGo | Tefeng Chen |
104+
| ZHUI | Hui Zhong|
105+
| LemonNoel | Huijuan Wang |
106+
| wawltor | Zeyang Fang |
107+
| FrostML | Zheng-Xi Liu |
108+
| jiangjiajun | jiangjiajun |
109+
| dingjiaweiww | dingjiawei |
110+
| gglin001 | Allen Guo (Graphcore) |
111+
| yaozhixin | Zhixin Yao (Graphcore) |
112+
| XBWGC | Xiaobing Wang (Graphcore) |
113+
| jianghaicheng | Haicheng Jiang (Graphcore) |
114+
| czr-gc | Zhaorui Chen (Graphcore) |
115+
| zhao-han | Han Zhao (Graphcore) |
116+
| yiakwy, yiakwy-xpu-ml-framework-team | Yi Wang (Graphcore) |

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ unset(WITH_RECORD_BUILDTIME CACHE)
323323

324324
# PY_VERSION
325325
if(NOT PY_VERSION)
326-
set(PY_VERSION 3.6)
326+
set(PY_VERSION 3.7)
327327
endif()
328328
set(PYBIND11_PYTHON_VERSION ${PY_VERSION})
329329

cmake/experiments/cuda_module_loading_lazy.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ if(LINUX)
3838
set(CUDA_USE_STATIC_CUDA_RUNTIME
3939
OFF
4040
CACHE BOOL "" FORCE)
41+
set(CMAKE_CUDA_FLAGS "--cudart shared")
4142
enable_language(CUDA)
4243
execute_process(
4344
COMMAND "rm" "-rf" "${CMAKE_SOURCE_DIR}/tools/nvcc_lazy"

cmake/external/python.cmake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414

1515
include(python_module)
1616

17+
check_py_version(${PY_VERSION})
18+
19+
# Find Python with mnimum PY_VERSION specified or will raise error!
1720
find_package(PythonInterp ${PY_VERSION} REQUIRED)
1821
find_package(PythonLibs ${PY_VERSION} REQUIRED)
1922

@@ -79,5 +82,6 @@ if(PYTHONINTERP_FOUND)
7982
"please use pip to upgrade protobuf. pip install -U protobuf")
8083
endif()
8184
endif(PYTHONINTERP_FOUND)
85+
8286
include_directories(${PYTHON_INCLUDE_DIR})
8387
include_directories(${PYTHON_NUMPY_INCLUDE_DIR})

cmake/external/xpu.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ set(XPU_RT_LIB_NAME "libxpurt.so")
1010
if(NOT DEFINED XPU_BASE_URL)
1111
set(XPU_BASE_URL_WITHOUT_DATE
1212
"https://baidu-kunlun-product.su.bcebos.com/KL-SDK/klsdk-dev")
13-
set(XPU_BASE_URL "${XPU_BASE_URL_WITHOUT_DATE}/20220919")
13+
set(XPU_BASE_URL "${XPU_BASE_URL_WITHOUT_DATE}/20220928")
1414
else()
1515
set(XPU_BASE_URL "${XPU_BASE_URL}")
1616
endif()
@@ -19,7 +19,7 @@ endif()
1919
if(NOT DEFINED XPU_XDNN_BASE_URL)
2020
set(XPU_XDNN_BASE_URL_WITHOUT_DATE
2121
"https://klx-sdk-release-public.su.bcebos.com/xdnn/dev")
22-
set(XPU_XDNN_BASE_URL "${XPU_XDNN_BASE_URL_WITHOUT_DATE}/20220919")
22+
set(XPU_XDNN_BASE_URL "${XPU_XDNN_BASE_URL_WITHOUT_DATE}/20220928")
2323
else()
2424
set(XPU_XDNN_BASE_URL "${XPU_XDNN_BASE_URL}")
2525
endif()

cmake/phi.cmake

Lines changed: 17 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ function(kernel_declare TARGET_LIST)
7878
string(
7979
REGEX
8080
MATCH
81-
"(PD_REGISTER_KERNEL|PD_REGISTER_GENERAL_KERNEL)\\([ \t\r\n]*[a-z0-9_]*,[ \t\r\n\/]*[a-z0-9_]*"
81+
"(PD_REGISTER_KERNEL|PD_REGISTER_GENERAL_KERNEL)\\([ \t\r\n]*[a-z0-9_]*,[[ \\\t\r\n\/]*[a-z0-9_]*]?[ \\\t\r\n]*[a-zA-Z]*,[ \\\t\r\n]*[A-Z_]*"
8282
first_registry
8383
"${kernel_impl}")
8484
if(NOT first_registry STREQUAL "")
@@ -89,38 +89,23 @@ function(kernel_declare TARGET_LIST)
8989
continue()
9090
endif()
9191
endif()
92-
# parse the first kernel name
93-
string(REPLACE "PD_REGISTER_KERNEL(" "" kernel_name "${first_registry}")
94-
string(REPLACE "PD_REGISTER_GENERAL_KERNEL(" "" kernel_name
95-
"${kernel_name}")
96-
string(REPLACE "," "" kernel_name "${kernel_name}")
97-
string(REGEX REPLACE "[ \t\r\n]+" "" kernel_name "${kernel_name}")
98-
string(REGEX REPLACE "//cuda_only" "" kernel_name "${kernel_name}")
92+
# parse the registerd kernel message
93+
string(REPLACE "PD_REGISTER_KERNEL(" "" kernel_msg "${first_registry}")
94+
string(REPLACE "PD_REGISTER_GENERAL_KERNEL(" "" kernel_msg
95+
"${kernel_msg}")
96+
string(REPLACE "," ";" kernel_msg "${kernel_msg}")
97+
string(REGEX REPLACE "[ \\\t\r\n]+" "" kernel_msg "${kernel_msg}")
98+
string(REGEX REPLACE "//cuda_only" "" kernel_msg "${kernel_msg}")
99+
100+
list(GET kernel_msg 0 kernel_name)
101+
list(GET kernel_msg 1 kernel_backend)
102+
list(GET kernel_msg 2 kernel_layout)
103+
99104
# append kernel declare into declarations.h
100-
# TODO(chenweihang): default declare ALL_LAYOUT for each kernel
101-
if(${kernel_path} MATCHES "./cpu\/")
102-
file(APPEND ${kernel_declare_file}
103-
"PD_DECLARE_KERNEL(${kernel_name}, CPU, ALL_LAYOUT);\n")
104-
elseif(${kernel_path} MATCHES "./gpu\/")
105-
file(APPEND ${kernel_declare_file}
106-
"PD_DECLARE_KERNEL(${kernel_name}, GPU, ALL_LAYOUT);\n")
107-
elseif(${kernel_path} MATCHES "./xpu\/")
108-
file(APPEND ${kernel_declare_file}
109-
"PD_DECLARE_KERNEL(${kernel_name}, XPU, ALL_LAYOUT);\n")
110-
elseif(${kernel_path} MATCHES "./gpudnn\/")
111-
file(APPEND ${kernel_declare_file}
112-
"PD_DECLARE_KERNEL(${kernel_name}, GPUDNN, ALL_LAYOUT);\n")
113-
elseif(${kernel_path} MATCHES "./kps\/")
114-
file(APPEND ${kernel_declare_file}
115-
"PD_DECLARE_KERNEL(${kernel_name}, KPS, ALL_LAYOUT);\n")
116-
elseif(${kernel_path} MATCHES "./onednn\/")
117-
file(APPEND ${kernel_declare_file}
118-
"PD_DECLARE_KERNEL(${kernel_name}, OneDNN, ALL_LAYOUT);\n")
119-
else()
120-
# deal with device independent kernel, now we use CPU temporaary
121-
file(APPEND ${kernel_declare_file}
122-
"PD_DECLARE_KERNEL(${kernel_name}, CPU, ALL_LAYOUT);\n")
123-
endif()
105+
file(
106+
APPEND ${kernel_declare_file}
107+
"PD_DECLARE_KERNEL(${kernel_name}, ${kernel_backend}, ${kernel_layout});\n"
108+
)
124109
endif()
125110
endforeach()
126111
endfunction()

cmake/python_module.cmake

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,20 @@ function(find_python_module module)
4848
${PY_${module_upper}_VERSION}
4949
PARENT_SCOPE)
5050
endfunction()
51+
52+
function(check_py_version py_version)
53+
string(REPLACE "." ";" version_list ${py_version})
54+
list(LENGTH version_list version_list_len)
55+
if(version_list_len LESS 2)
56+
message(FATAL_ERROR "Please input Python version, eg:3.7 or 3.8 and so on")
57+
endif()
58+
59+
list(GET version_list 0 version_major)
60+
list(GET version_list 1 version_minor)
61+
62+
if((version_major GREATER_EQUAL 3) AND (version_minor GREATER_EQUAL 7))
63+
64+
else()
65+
message(FATAL_ERROR "Paddle only support Python version >=3.7 now!")
66+
endif()
67+
endfunction()

0 commit comments

Comments
 (0)