Skip to content

Commit 9a82b0e

Browse files
authored
Merge branch 'develop' into add_pd_op
2 parents 95d254c + 461fbd1 commit 9a82b0e

File tree

1,549 files changed

+24037
-13373
lines changed

Some content is hidden

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

1,549 files changed

+24037
-13373
lines changed

_typos.toml

Lines changed: 6 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ extend-exclude = [
1212
anc = 'anc'
1313
arange = "arange"
1414
astroid = 'astroid'
15+
ba = 'ba'
16+
cacl = 'cacl'
17+
CANN = 'CANN'
18+
Clas = 'Clas'
19+
clen = 'clen'
20+
cll = 'cll'
1521
dout = "dout"
1622
eles = 'eles'
1723
grad = "grad"
@@ -24,84 +30,17 @@ UE = "UE"
2430
unpacket = "unpacket"
2531

2632
# These words need to be fixed
27-
Acceses = 'Acceses'
28-
accessable = 'accessable'
29-
accesss = 'accesss'
30-
accoding = 'accoding'
31-
accurary = 'accurary'
32-
Accuarcy = 'Accuarcy'
33-
actived = 'actived'
34-
acitve = 'acitve'
35-
actualy = 'actualy'
36-
actural = 'actural'
37-
Actural = 'Actural'
38-
assigend = 'assigend'
39-
assined = 'assined'
40-
assgin = 'assgin'
41-
axises = 'axises'
42-
Axises = 'Axises'
43-
aixs = 'aixs'
44-
beacuse = 'beacuse'
45-
becasue = 'becasue'
46-
Becasue = 'Becasue'
47-
becuase = 'becuase'
4833
blokc = 'blokc'
4934
blcok = 'blcok'
5035
bootom = 'bootom'
5136
bondary = 'bondary'
5237
branchs = 'branchs'
53-
Broardcast = 'Broardcast'
54-
Bradcast = 'Bradcast'
55-
Boardcast = 'Boardcast'
56-
Buitin = 'Buitin'
57-
buitlin = 'buitlin'
58-
buitin = 'buitin'
59-
builded = 'builded'
60-
ba = 'ba'
6138
cahe = 'cahe'
6239
Caculate = 'Caculate'
6340
caculate = 'caculate'
6441
calcualtion = 'calcualtion'
65-
cacl = 'cacl'
66-
cll = 'cll'
67-
candiate = 'candiate'
68-
cadidate = 'cadidate'
69-
connot = 'connot'
70-
CANN = 'CANN'
71-
Cann = 'Cann'
72-
cann = 'cann'
73-
vart = 'vart'
7442
checkings = 'checkings'
7543
childs = 'childs'
76-
Chunck = 'Chunck'
77-
clen = 'clen'
78-
Clas = 'Clas'
79-
clas = 'clas'
80-
compability = 'compability'
81-
compatiblity = 'compatiblity'
82-
Compitable = 'Compitable'
83-
compatable = 'compatable'
84-
compitable = 'compitable'
85-
compling = 'compling'
86-
comple = 'comple'
87-
complition = 'complition'
88-
complext = 'complext'
89-
compsite = 'compsite'
90-
configurated = 'configurated'
91-
configed = 'configed'
92-
confict = 'confict'
93-
conjuction = 'conjuction'
94-
conect = 'conect'
95-
consequtive = 'consequtive'
96-
consistant = 'consistant'
97-
contraints = 'contraints'
98-
contruction = 'contruction'
99-
consructor = 'consructor'
100-
comsume = 'comsume'
101-
Continer = 'Continer'
102-
contenst = 'contenst'
103-
conter = 'conter'
104-
ontext = 'ontext'
10544
Continous = 'Continous'
10645
contibute = 'contibute'
10746
controled = 'controled'
@@ -149,13 +88,6 @@ defind = 'defind'
14988
defeine = 'defeine'
15089
defition = 'defition'
15190
defination = 'defination'
152-
delet = 'delet'
153-
dependecies = 'dependecies'
154-
dependecy = 'dependecy'
155-
decprecated = 'decprecated'
156-
derivated = 'derivated'
157-
descripor = 'descripor'
158-
deserailize = 'deserailize'
15991
Destory = 'Destory'
16092
DEIVCE = 'DEIVCE'
16193
dictionnary = 'dictionnary'
@@ -426,7 +358,6 @@ Normlized = 'Normlized'
426358
normlize = 'normlize'
427359
noraml = 'noraml'
428360
numer = 'numer'
429-
Numberic = 'Numberic'
430361
occured = 'occured'
431362
Ocurred = 'Ocurred'
432363
occures = 'occures'
@@ -435,7 +366,6 @@ fo = 'fo'
435366
offets = 'offets'
436367
offseted = 'offseted'
437368
OLT = 'OLT'
438-
olny = 'olny'
439369
pn = 'pn'
440370
Operants = 'Operants'
441371
operants = 'operants'
@@ -454,13 +384,11 @@ orginal = 'orginal'
454384
onces = 'onces'
455385
outter = 'outter'
456386
outpus = 'outpus'
457-
outputing = 'outputing'
458387
outout = 'outout'
459388
ouput = 'ouput'
460389
outpout = 'outpout'
461390
ouptut = 'ouptut'
462391
Ouput = 'Ouput'
463-
ouside = 'ouside'
464392
overriden = 'overriden'
465393
Overide = 'Overide'
466394
overide = 'overide'

cmake/cinn.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ cinn_cc_library(
160160
${cinnapi_src}
161161
DEPS
162162
glog
163+
python
163164
${llvm_libs}
164165
param_proto
165166
auto_schedule_proto

cmake/cinn/core.cmake

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@ function(cinn_cc_library TARGET_NAME)
1919
endif()
2020

2121
if(cinn_cc_library_DEPS)
22-
if("${cinn_cc_library_DEPS};" MATCHES "python;")
23-
list(REMOVE_ITEM cinn_cc_library_DEPS python)
24-
add_dependencies(${TARGET_NAME} python)
25-
endif()
2622
target_link_libraries(${TARGET_NAME} ${cinn_cc_library_DEPS})
2723
add_dependencies(${TARGET_NAME} ${cinn_cc_library_DEPS})
2824
endif()

cmake/external/brpc.cmake

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,23 @@ set(prefix_path
4848
"${THIRD_PARTY_PATH}/install/gflags|${THIRD_PARTY_PATH}/install/leveldb|${THIRD_PARTY_PATH}/install/snappy|${THIRD_PARTY_PATH}/install/gtest|${THIRD_PARTY_PATH}/install/protobuf|${THIRD_PARTY_PATH}/install/zlib|${THIRD_PARTY_PATH}/install/glog"
4949
)
5050

51+
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND ${CMAKE_CXX_COMPILER_VERSION}
52+
VERSION_GREATER_EQUAL 13.0)
53+
file(TO_NATIVE_PATH ${PADDLE_SOURCE_DIR}/patches/brpc/http2.h.patch
54+
http2_h_patch)
55+
set(BRPC_PATCH_COMMAND_GCC13 git apply ${http2_h_patch})
56+
endif()
57+
5158
# If minimal .a is need, you can set WITH_DEBUG_SYMBOLS=OFF
5259
ExternalProject_Add(
5360
extern_brpc
5461
${EXTERNAL_PROJECT_LOG_ARGS}
5562
SOURCE_DIR ${BRPC_SOURCE_DIR}
5663
PREFIX ${BRPC_PREFIX_DIR}
5764
UPDATE_COMMAND ""
65+
PATCH_COMMAND
66+
COMMAND git checkout -- . && git checkout ${BRPC_TAG}
67+
COMMAND ${BRPC_PATCH_COMMAND_GCC13}
5868
CMAKE_ARGS -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
5969
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
6070
-DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}

cmake/external/flashattn.cmake

Lines changed: 103 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,20 @@ if(WITH_ROCM)
8080
else()
8181

8282
add_definitions(-DPADDLE_WITH_FLASHATTN)
83+
option(FA_BUILD_WITH_CACHE "Download cache so files from bos" ON)
8384

8485
set(FLASHATTN_PREFIX_DIR ${THIRD_PARTY_PATH}/flashattn)
8586
set(FLASHATTN_SOURCE_SUBDIR csrc)
8687
set(FLASHATTN_INSTALL_DIR ${THIRD_PARTY_PATH}/install/flashattn)
8788
set(SOURCE_DIR ${PADDLE_SOURCE_DIR}/third_party/flashattn)
88-
set(FLASHATTN_TAG 5fc132ac11e78d26471ca09e5ba0cd817c3424d8)
89+
90+
# get FA git commit
91+
execute_process(
92+
COMMAND git rev-parse HEAD
93+
WORKING_DIRECTORY ${SOURCE_DIR}
94+
OUTPUT_VARIABLE FLASHATTN_TAG
95+
OUTPUT_STRIP_TRAILING_WHITESPACE)
96+
message(STATUS "flashattn git commit: ${FLASHATTN_TAG}")
8997

9098
set(FLASHATTN_INCLUDE_DIR
9199
"${FLASHATTN_INSTALL_DIR}/include"
@@ -166,6 +174,99 @@ else()
166174
endif()
167175
endforeach()
168176

177+
set(BASE_URL
178+
"https://xly-devops.bj.bcebos.com/gpups/flash-attention/cu${FA_NVCC_ARCH_BIN}"
179+
)
180+
set(TAR_FILE_NAME "flashattn_libs_${FLASHATTN_TAG}.tar")
181+
set(TAR_FILE_URL "${BASE_URL}/${TAR_FILE_NAME}")
182+
set(FA_BUILD_DIR "${FLASHATTN_PREFIX_DIR}/src/extern_flashattn-build/")
183+
set(CACHE_TAR_PATH "${FA_BUILD_DIR}/${TAR_FILE_NAME}")
184+
set(CACHE_TAR_DIR "${FA_BUILD_DIR}/flashattn_libs_${FLASHATTN_TAG}")
185+
186+
set(SKIP_BUILD_FA OFF)
187+
if(FA_BUILD_WITH_CACHE)
188+
189+
message(STATUS "Downloading ${TAR_FILE_URL} to ${CACHE_TAR_PATH}")
190+
file(
191+
DOWNLOAD "${TAR_FILE_URL}" "${CACHE_TAR_PATH}"
192+
STATUS DOWNLOAD_STATUS
193+
LOG DOWNLOAD_LOG)
194+
list(GET DOWNLOAD_STATUS 0 DOWNLOAD_RESULT)
195+
196+
if(DOWNLOAD_RESULT EQUAL 0)
197+
message(STATUS "Download Successful")
198+
199+
file(MAKE_DIRECTORY ${FA_BUILD_DIR})
200+
201+
execute_process(
202+
COMMAND ${CMAKE_COMMAND} -E tar xf ${CACHE_TAR_PATH}
203+
WORKING_DIRECTORY ${FA_BUILD_DIR}
204+
RESULT_VARIABLE TAR_RESULT)
205+
206+
if(NOT TAR_RESULT EQUAL 0)
207+
message(FATAL_ERROR "Failed to extract ${CACHE_TAR_PATH}")
208+
endif()
209+
210+
file(STRINGS ${CACHE_TAR_DIR}/MD5.txt FILE_MD5)
211+
212+
# Strip any leading or trailing whitespace
213+
string(STRIP ${FILE_MD5} FILE_MD5)
214+
215+
file(MD5 ${CACHE_TAR_DIR}/fa_libs.tar FILE_MD5_ACTUAL)
216+
217+
message(STATUS "Expected MD5: ${FILE_MD5}")
218+
message(STATUS "Actual MD5: ${FILE_MD5_ACTUAL}")
219+
220+
if(NOT "${FILE_MD5}" STREQUAL "${FILE_MD5_ACTUAL}")
221+
message(
222+
FATAL_ERROR "MD5 checksum mismatch! The download may be corrupted.")
223+
else()
224+
message(STATUS "MD5 checksum verified successfully.")
225+
endif()
226+
227+
execute_process(
228+
COMMAND ${CMAKE_COMMAND} -E tar xf ${CACHE_TAR_DIR}/fa_libs.tar
229+
WORKING_DIRECTORY ${CACHE_TAR_DIR}
230+
RESULT_VARIABLE TAR_RESULT)
231+
232+
if(NOT TAR_RESULT EQUAL 0)
233+
message(FATAL_ERROR "Failed to extract ${CACHE_TAR_PATH}/fa_libs.tar")
234+
endif()
235+
236+
file(GLOB_RECURSE SO_FILES "${CACHE_TAR_DIR}/fa_libs/*.so")
237+
foreach(so_file ${SO_FILES})
238+
message(STATUS "Copy ${so_file} to ${FA_BUILD_DIR}")
239+
message(STATUS "Copy ${so_file} to ${FLASHATTN_LIB_DIR}")
240+
file(COPY "${so_file}" DESTINATION "${FA_BUILD_DIR}")
241+
file(COPY "${so_file}" DESTINATION "${FLASHATTN_LIB_DIR}")
242+
endforeach()
243+
244+
file(REMOVE_RECURSE ${CACHE_TAR_DIR})
245+
message(STATUS "Extraction completed in ${FA_BUILD_DIR}")
246+
247+
set(SKIP_BUILD_FA ON)
248+
249+
elseif(DOWNLOAD_RESULT EQUAL 6)
250+
message(
251+
STATUS
252+
"Could not resolve host. The given remote host was not resolvable.")
253+
elseif(DOWNLOAD_RESULT EQUAL 7)
254+
message(STATUS "Failed to connect to host.")
255+
elseif(DOWNLOAD_RESULT EQUAL 22)
256+
message(
257+
STATUS
258+
"HTTP page not retrieved. The requested URL was not found or a server returned a 4xx (client error) or 5xx (server error) response."
259+
)
260+
elseif(DOWNLOAD_RESULT EQUAL 28)
261+
message(
262+
STATUS
263+
"Operation timeout. The specified time-out period was reached according to the conditions."
264+
)
265+
else()
266+
message(STATUS "An error occurred. Error code: ${DOWNLOAD_RESULT}")
267+
endif()
268+
endif()
269+
169270
ExternalProject_Add(
170271
extern_flashattn
171272
${EXTERNAL_PROJECT_LOG_ARGS}
@@ -196,13 +297,13 @@ else()
196297
-DCMAKE_JOB_POOLS:STRING=compile=${FA_JOB_POOLS_COMPILE}
197298
-DNVCC_ARCH_BIN=${FA_NVCC_ARCH_BIN}
198299
-DWITH_FLASHATTN_V3=${WITH_FLASHATTN_V3}
300+
-DSKIP_BUILD_FA=${SKIP_BUILD_FA}
199301
${EXTERNAL_OPTIONAL_ARGS}
200302
CMAKE_CACHE_ARGS
201303
-DCMAKE_BUILD_TYPE:STRING=${THIRD_PARTY_BUILD_TYPE}
202304
-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON
203305
-DCMAKE_INSTALL_PREFIX:PATH=${FLASHATTN_INSTALL_DIR}
204306
BUILD_BYPRODUCTS ${BUILD_BYPRODUCTS_LIST})
205-
206307
endif()
207308

208309
message(STATUS "flash-attn library: ${FLASHATTN_LIBRARIES}")

cmake/external/openblas.cmake

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,11 @@ set(CBLAS_INSTALL_DIR ${THIRD_PARTY_PATH}/install/openblas)
1919
set(CBLAS_SOURCE_DIR ${PADDLE_SOURCE_DIR}/third_party/openblas)
2020
set(CBLAS_TAG v0.3.7)
2121

22-
# Why use v0.3.18? The IDG business line encountered a random openblas error,
23-
# which can be resolved after upgrading openblas.
24-
# And why compile when gcc>8.2? Please refer to
25-
# https://github.com/spack/spack/issues/19932#issuecomment-733452619
26-
# v0.3.18 only support gcc>=8.3 or gcc>=7.4
27-
if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
28-
AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 8.2
22+
if(UNIX
23+
AND NOT APPLE
24+
AND NOT WITH_ROCM
2925
AND NOT WITH_XPU)
30-
# We only compile with openblas 0.3.18 when gcc >= 8.3
31-
set(CBLAS_TAG v0.3.18)
26+
set(CBLAS_TAG v0.3.28)
3227
endif()
3328

3429
if(APPLE AND WITH_ARM)

0 commit comments

Comments
 (0)