Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

third-party lib offline compilation support for mkldnn flashattn gtest #54319

Merged
merged 3 commits into from
Jun 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,15 @@
path = third_party/eigen3
url = https://gitlab.com/libeigen/eigen.git
ignore = dirty
[submodule "third_party/mkldnn"]
path = third_party/mkldnn
url = https://github.com/oneapi-src/oneDNN.git
ignore = dirty
[submodule "third_party/flashattn"]
path = third_party/flashattn
url = https://github.com/PaddlePaddle/flash-attention.git
GreatV marked this conversation as resolved.
Show resolved Hide resolved
ignore = dirty
[submodule "third_party/gtest"]
path = third_party/gtest
url = https://github.com/google/googletest.git
ignore = dirty
7 changes: 3 additions & 4 deletions cmake/external/flashattn.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ add_definitions(-DPADDLE_WITH_FLASHATTN)
set(FLASHATTN_PREFIX_DIR ${THIRD_PARTY_PATH}/flashattn)
set(FLASHATTN_SOURCE_SUBDIR csrc/flash_attn)
set(FLASHATTN_INSTALL_DIR ${THIRD_PARTY_PATH}/install/flashattn)
set(FLASHATTN_REPOSITORY ${GIT_URL}/PaddlePaddle/flash-attention.git)
set(SOURCE_DIR ${PADDLE_SOURCE_DIR}/third_party/flashattn)
set(FLASHATTN_TAG 18106c1ba0ccee81b97ca947397c08a141815a47)

set(FLASHATTN_INCLUDE_DIR
Expand Down Expand Up @@ -69,9 +69,8 @@ endif()

ExternalProject_Add(
extern_flashattn
${EXTERNAL_PROJECT_LOG_ARGS} ${SHALLOW_CLONE}
GIT_REPOSITORY ${FLASHATTN_REPOSITORY}
GIT_TAG ${FLASHATTN_TAG}
${EXTERNAL_PROJECT_LOG_ARGS}
SOURCE_DIR ${SOURCE_DIR}
PREFIX ${FLASHATTN_PREFIX_DIR}
SOURCE_SUBDIR ${FLASHATTN_SOURCE_SUBDIR}
UPDATE_COMMAND ""
Expand Down
14 changes: 6 additions & 8 deletions cmake/external/gtest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ set(GTEST_INSTALL_DIR ${THIRD_PARTY_PATH}/install/gtest)
set(GTEST_INCLUDE_DIR
"${GTEST_INSTALL_DIR}/include"
CACHE PATH "gtest include directory." FORCE)
set(GTEST_REPOSITORY ${GIT_URL}/google/googletest.git)
set(SOURCE_DIR ${PADDLE_SOURCE_DIR}/third_party/gtest)
set(GTEST_TAG release-1.8.1)
set(GTEST_SOURCE_DIR ${THIRD_PARTY_PATH}/gtest/src/extern_gtest)
include_directories(${GTEST_INCLUDE_DIR})
Expand Down Expand Up @@ -69,14 +69,13 @@ if(NOT WIN32 AND ${CMAKE_CXX_COMPILER_VERSION} VERSION_GREATER 12.0)
# See: [Why calling some `git` commands before `patch`?]
set(GTEST_PATCH_COMMAND
git checkout -- . && git checkout ${GTEST_TAG} && patch -Nd
${GTEST_SOURCE_DIR}/googletest/src < ${native_src})
${SOURCE_DIR}/googletest/src < ${native_src})
endif()
if(WIN32)
ExternalProject_Add(
extern_gtest
${EXTERNAL_PROJECT_LOG_ARGS} ${SHALLOW_CLONE}
GIT_REPOSITORY ${GTEST_REPOSITORY}
GIT_TAG ${GTEST_TAG}
${EXTERNAL_PROJECT_LOG_ARGS}
SOURCE_DIR ${SOURCE_DIR}
DEPENDS ${GTEST_DEPENDS}
PREFIX ${GTEST_PREFIX_DIR}
UPDATE_COMMAND ""
Expand Down Expand Up @@ -106,9 +105,8 @@ if(WIN32)
else()
ExternalProject_Add(
extern_gtest
${EXTERNAL_PROJECT_LOG_ARGS} ${SHALLOW_CLONE}
GIT_REPOSITORY ${GTEST_REPOSITORY}
GIT_TAG ${GTEST_TAG}
${EXTERNAL_PROJECT_LOG_ARGS}
SOURCE_DIR ${SOURCE_DIR}
DEPENDS ${GTEST_DEPENDS}
PREFIX ${GTEST_PREFIX_DIR}
UPDATE_COMMAND ""
Expand Down
7 changes: 3 additions & 4 deletions cmake/external/mkldnn.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ set(MKLDNN_INSTALL_DIR ${THIRD_PARTY_PATH}/install/mkldnn)
set(MKLDNN_INC_DIR
"${MKLDNN_INSTALL_DIR}/include"
CACHE PATH "mkldnn include directory." FORCE)
set(MKLDNN_REPOSITORY ${GIT_URL}/oneapi-src/oneDNN.git)
set(SOURCE_DIR ${PADDLE_SOURCE_DIR}/third_party/mkldnn)
set(MKLDNN_TAG 2089770c4818be8933c5e9d1dd3cbaeba1457667)

# Introduce variables:
Expand Down Expand Up @@ -69,9 +69,8 @@ endif()

ExternalProject_Add(
${MKLDNN_PROJECT}
${EXTERNAL_PROJECT_LOG_ARGS} ${SHALLOW_CLONE}
GIT_REPOSITORY ${MKLDNN_REPOSITORY}
GIT_TAG ${MKLDNN_TAG}
${EXTERNAL_PROJECT_LOG_ARGS}
SOURCE_DIR ${SOURCE_DIR}
DEPENDS ${MKLDNN_DEPENDS}
PREFIX ${MKLDNN_PREFIX_DIR}
UPDATE_COMMAND ""
Expand Down
1 change: 1 addition & 0 deletions third_party/flashattn
Submodule flashattn added at 18106c
1 change: 1 addition & 0 deletions third_party/gtest
Submodule gtest added at 2fe3bd
1 change: 1 addition & 0 deletions third_party/mkldnn
Submodule mkldnn added at 208977