Skip to content

Commit

Permalink
Merge branch 'PaddlePaddle:develop' into typing
Browse files Browse the repository at this point in the history
  • Loading branch information
Asthestarsfalll authored Apr 24, 2024
2 parents d48f92f + 71fd732 commit 4151556
Show file tree
Hide file tree
Showing 1,637 changed files with 27,049 additions and 29,013 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
python/requirements.txt @phlrain @jzhang533 @kolinwei
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,6 @@ option(
SANITIZER_TYPE
"Choose the type of sanitizer, options are: Address, Leak, Memory, Thread, Undefined"
OFF)
option(WITH_LITE "Compile Paddle Fluid with Lite Engine" OFF)
option(WITH_CINN "Compile PaddlePaddle with CINN" OFF)
option(WITH_NCCL "Compile PaddlePaddle with NCCL support" ON)
option(WITH_RCCL "Compile PaddlePaddle with RCCL support" ON)
Expand Down
4 changes: 2 additions & 2 deletions cmake/cinn.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ if(WITH_MKL)
target_link_libraries(cinnapi cinn_mklml)
add_dependencies(cinnapi cinn_mklml)
if(WITH_ONEDNN)
target_link_libraries(cinnapi ${MKLDNN_LIB})
target_link_libraries(cinnapi ${ONEDNN_LIB})
add_dependencies(cinnapi ${ONEDNN_PROJECT})
endif()
endif()
Expand Down Expand Up @@ -239,7 +239,7 @@ function(gen_cinncore LINKTYPE)
target_link_libraries(${CINNCORE_TARGET} cinn_mklml)
add_dependencies(${CINNCORE_TARGET} cinn_mklml)
if(WITH_ONEDNN)
target_link_libraries(${CINNCORE_TARGET} ${MKLDNN_LIB})
target_link_libraries(${CINNCORE_TARGET} ${ONEDNN_LIB})
add_dependencies(${CINNCORE_TARGET} ${ONEDNN_PROJECT})
endif()
endif()
Expand Down
230 changes: 0 additions & 230 deletions cmake/external/lite.cmake

This file was deleted.

66 changes: 33 additions & 33 deletions cmake/external/onednn.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ include(ExternalProject)

set(ONEDNN_PROJECT "extern_onednn")
set(ONEDNN_PREFIX_DIR ${THIRD_PARTY_PATH}/onednn)
set(MKLDNN_INSTALL_DIR ${THIRD_PARTY_PATH}/install/onednn)
set(MKLDNN_INC_DIR
"${MKLDNN_INSTALL_DIR}/include"
set(ONEDNN_INSTALL_DIR ${THIRD_PARTY_PATH}/install/onednn)
set(ONEDNN_INC_DIR
"${ONEDNN_INSTALL_DIR}/include"
CACHE PATH "oneDNN include directory." FORCE)
set(SOURCE_DIR ${PADDLE_SOURCE_DIR}/third_party/onednn)

Expand All @@ -30,12 +30,12 @@ if(CMAKE_INSTALL_LIBDIR MATCHES ".*lib64$")
set(LIBDIR "lib64")
endif()

message(STATUS "Set ${MKLDNN_INSTALL_DIR}/${LIBDIR} to runtime path")
message(STATUS "Set ${ONEDNN_INSTALL_DIR}/${LIBDIR} to runtime path")
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_RPATH}"
"${MKLDNN_INSTALL_DIR}/${LIBDIR}")
"${ONEDNN_INSTALL_DIR}/${LIBDIR}")

include_directories(${MKLDNN_INC_DIR}
include_directories(${ONEDNN_INC_DIR}
)# For oneDNN code to include internal headers.

if(NOT WIN32)
Expand All @@ -47,21 +47,21 @@ if(NOT WIN32)
set(ONEDNN_CXXFLAG "${CMAKE_CXX_FLAGS} ${ONEDNN_FLAG}")
set(ONEDNN_CXXFLAG_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
set(ONEDNN_CFLAG_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
set(MKLDNN_LIB
"${MKLDNN_INSTALL_DIR}/${LIBDIR}/libdnnl.so"
set(ONEDNN_LIB
"${ONEDNN_INSTALL_DIR}/${LIBDIR}/libdnnl.so"
CACHE FILEPATH "oneDNN library." FORCE)
else()
set(ONEDNN_CXXFLAG "${CMAKE_CXX_FLAGS} /EHsc")
set(ONEDNN_CFLAG "${CMAKE_C_FLAGS}")
string(REPLACE "/O2 " "" ONEDNN_CFLAG_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
string(REPLACE "/O2 " "" ONEDNN_CXXFLAG_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
set(MKLDNN_LIB
"${MKLDNN_INSTALL_DIR}/bin/mkldnn.lib"
set(ONEDNN_LIB
"${ONEDNN_INSTALL_DIR}/bin/mkldnn.lib"
CACHE FILEPATH "oneDNN library." FORCE)
endif()

if(LINUX)
set(BUILD_BYPRODUCTS_ARGS ${MKLDNN_LIB})
set(BUILD_BYPRODUCTS_ARGS ${ONEDNN_LIB})
else()
set(BUILD_BYPRODUCTS_ARGS "")
endif()
Expand All @@ -82,62 +82,62 @@ ExternalProject_Add(
-DCMAKE_C_FLAGS=${ONEDNN_CFLAG}
-DCMAKE_C_FLAGS_DEBUG=${CMAKE_C_FLAGS_DEBUG}
-DCMAKE_C_FLAGS_RELEASE=${ONEDNN_CFLAG_RELEASE}
-DCMAKE_INSTALL_PREFIX=${MKLDNN_INSTALL_DIR}
-DCMAKE_INSTALL_PREFIX=${ONEDNN_INSTALL_DIR}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
-DDNNL_BUILD_TESTS=OFF
-DDNNL_BUILD_EXAMPLES=OFF
CMAKE_CACHE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${MKLDNN_INSTALL_DIR}
CMAKE_CACHE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${ONEDNN_INSTALL_DIR}
BUILD_BYPRODUCTS ${BUILD_BYPRODUCTS_ARGS})

message(STATUS "OneDNN library: ${MKLDNN_LIB}")
message(STATUS "OneDNN library: ${ONEDNN_LIB}")
add_definitions(-DPADDLE_WITH_DNNL)
# copy the real so.0 lib to install dir
# it can be directly contained in wheel or capi
if(WIN32)
set(MKLDNN_SHARED_LIB ${MKLDNN_INSTALL_DIR}/bin/mkldnn.dll)
set(ONEDNN_SHARED_LIB ${ONEDNN_INSTALL_DIR}/bin/mkldnn.dll)

file(TO_NATIVE_PATH ${MKLDNN_INSTALL_DIR} NATIVE_MKLDNN_INSTALL_DIR)
file(TO_NATIVE_PATH ${MKLDNN_SHARED_LIB} NATIVE_MKLDNN_SHARED_LIB)
file(TO_NATIVE_PATH ${ONEDNN_INSTALL_DIR} NATIVE_ONEDNN_INSTALL_DIR)
file(TO_NATIVE_PATH ${ONEDNN_SHARED_LIB} NATIVE_ONEDNN_SHARED_LIB)

add_custom_command(
OUTPUT ${MKLDNN_LIB}
COMMAND (copy ${NATIVE_MKLDNN_INSTALL_DIR}\\bin\\dnnl.dll
${NATIVE_MKLDNN_SHARED_LIB} /Y)
COMMAND dumpbin /exports ${MKLDNN_INSTALL_DIR}/bin/mkldnn.dll >
${MKLDNN_INSTALL_DIR}/bin/exports.txt
COMMAND echo LIBRARY mkldnn > ${MKLDNN_INSTALL_DIR}/bin/mkldnn.def
COMMAND echo EXPORTS >> ${MKLDNN_INSTALL_DIR}/bin/mkldnn.def
OUTPUT ${ONEDNN_LIB}
COMMAND (copy ${NATIVE_ONEDNN_INSTALL_DIR}\\bin\\dnnl.dll
${NATIVE_ONEDNN_SHARED_LIB} /Y)
COMMAND dumpbin /exports ${ONEDNN_INSTALL_DIR}/bin/mkldnn.dll >
${ONEDNN_INSTALL_DIR}/bin/exports.txt
COMMAND echo LIBRARY mkldnn > ${ONEDNN_INSTALL_DIR}/bin/mkldnn.def
COMMAND echo EXPORTS >> ${ONEDNN_INSTALL_DIR}/bin/mkldnn.def
COMMAND
echo off && (for
/f
"skip=19 tokens=4"
%A
in
(${MKLDNN_INSTALL_DIR}/bin/exports.txt)
(${ONEDNN_INSTALL_DIR}/bin/exports.txt)
do
echo
%A
>>
${MKLDNN_INSTALL_DIR}/bin/mkldnn.def) && echo on
COMMAND lib /def:${MKLDNN_INSTALL_DIR}/bin/mkldnn.def /out:${MKLDNN_LIB}
${ONEDNN_INSTALL_DIR}/bin/mkldnn.def) && echo on
COMMAND lib /def:${ONEDNN_INSTALL_DIR}/bin/mkldnn.def /out:${ONEDNN_LIB}
/machine:x64
COMMENT "Generate mkldnn.lib manually--->"
DEPENDS ${ONEDNN_PROJECT}
VERBATIM)
add_custom_target(onednn_cmd ALL DEPENDS ${MKLDNN_LIB})
add_custom_target(onednn_cmd ALL DEPENDS ${ONEDNN_LIB})
else()
set(MKLDNN_SHARED_LIB ${MKLDNN_INSTALL_DIR}/libdnnl.so.3)
set(ONEDNN_SHARED_LIB ${ONEDNN_INSTALL_DIR}/libdnnl.so.3)
add_custom_command(
OUTPUT ${MKLDNN_SHARED_LIB}
COMMAND ${CMAKE_COMMAND} -E copy ${MKLDNN_LIB} ${MKLDNN_SHARED_LIB}
OUTPUT ${ONEDNN_SHARED_LIB}
COMMAND ${CMAKE_COMMAND} -E copy ${ONEDNN_LIB} ${ONEDNN_SHARED_LIB}
DEPENDS ${ONEDNN_PROJECT})
add_custom_target(onednn_cmd ALL DEPENDS ${MKLDNN_SHARED_LIB})
add_custom_target(onednn_cmd ALL DEPENDS ${ONEDNN_SHARED_LIB})
endif()

# generate a static dummy target to track onednn dependencies
# for cc_library(xxx SRCS xxx.c DEPS onednn)
generate_dummy_static_lib(LIB_NAME "onednn" GENERATOR "onednn.cmake")

target_link_libraries(onednn ${MKLDNN_LIB} ${MKLML_IOMP_LIB})
target_link_libraries(onednn ${ONEDNN_LIB} ${MKLML_IOMP_LIB})
add_dependencies(onednn ${ONEDNN_PROJECT} onednn_cmd)
Loading

0 comments on commit 4151556

Please sign in to comment.