-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
compile phi/backends into one static library #44373
Merged
zhiqiu
merged 7 commits into
PaddlePaddle:develop
from
zhiqiu:dev/refine_backends_cmake
Jul 19, 2022
Merged
Changes from 6 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
60a032a
compile into one static library
zhiqiu 902a808
fix xpu compile
zhiqiu 64b433d
fix xpu compile
zhiqiu 613b43c
fix inference compile
zhiqiu c4f9abd
fix inference compile
zhiqiu a52d4f5
add custom test
zhiqiu 8f64a78
revert one file
zhiqiu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,61 +1,58 @@ | ||
add_subdirectory(dynload) | ||
|
||
add_subdirectory(cpu) | ||
|
||
add_subdirectory(custom) | ||
set(BACKENDS_SRCS all_context.cc cpu/cpu_context.cc) | ||
set(BACKENDS_DEPS enforce place flags) | ||
|
||
if(WITH_GPU OR WITH_ROCM) | ||
add_subdirectory(gpu) | ||
list(APPEND BACKENDS_SRCS gpu/gpu_context.cc gpu/gpu_info.cc | ||
gpu/gpu_resources.cc) | ||
if(WITH_GPU) | ||
list(APPEND BACKENDS_SRCS gpu/cuda/cuda_info.cc) | ||
endif() | ||
if(WITH_ROCM) | ||
list(APPEND BACKENDS_SRCS gpu/rocm/rocm_info.cc) | ||
endif() | ||
list(APPEND BACKENDS_DEPS phi_dynload_cuda) | ||
endif() | ||
|
||
if(WITH_XPU) | ||
add_subdirectory(xpu) | ||
list(APPEND BACKENDS_SRCS xpu/xpu_context.cc xpu/xpu_info.cc) | ||
endif() | ||
|
||
if(WITH_MKLDNN) | ||
add_subdirectory(onednn) | ||
list(APPEND BACKENDS_SRCS onednn/onednn_context.cc) | ||
list(APPEND BACKENDS_DEPS mkldnn) | ||
endif() | ||
|
||
cc_library( | ||
phi_context | ||
SRCS all_context.cc | ||
DEPS device_context cpu_context) | ||
|
||
if(WITH_XPU) | ||
add_dependencies(phi_context xpu_context) | ||
if(WITH_CUSTOM_DEVICE) | ||
list( | ||
APPEND | ||
BACKENDS_SRCS | ||
callback_manager.cc | ||
device_guard.cc | ||
stream.cc | ||
event.cc | ||
device_base.cc | ||
device_manager.cc | ||
custom/custom_context.cc | ||
custom/custom_device.cc) | ||
endif() | ||
|
||
if(WITH_GPU) | ||
add_dependencies(phi_context gpu_context) | ||
endif() | ||
add_library(phi_backends "${BACKENDS_SRCS}") | ||
target_link_libraries(phi_backends ${BACKENDS_DEPS}) | ||
|
||
# for inference library | ||
get_property(phi_modules GLOBAL PROPERTY PHI_MODULES) | ||
set(phi_modules ${phi_modules} phi_backends) | ||
set_property(GLOBAL PROPERTY PHI_MODULES "${phi_modules}") | ||
|
||
if(WITH_CUSTOM_DEVICE) | ||
add_dependencies(phi_context custom_context) | ||
cc_library( | ||
callback_manager | ||
SRCS callback_manager.cc | ||
DEPS enforce place) | ||
cc_library( | ||
device_guard | ||
SRCS device_guard.cc | ||
DEPS enforce place) | ||
cc_library( | ||
stream | ||
SRCS stream.cc | ||
DEPS callback_manager) | ||
cc_library( | ||
event | ||
SRCS event.cc | ||
DEPS enforce place) | ||
cc_library( | ||
device_base | ||
SRCS device_base.cc | ||
DEPS stream event callback_manager device_guard device_context flags) | ||
cc_library( | ||
device_manager | ||
SRCS device_manager.cc | ||
DEPS custom_device) | ||
set(GLOB_DEV_LIB | ||
device_manager custom_device | ||
CACHE INTERNAL "Global DEV library") | ||
cc_test( | ||
custom_device_test | ||
SRCS custom/custom_device_test.cc | ||
DEPS phi_backends phi_device_context) | ||
cc_test( | ||
capi_test | ||
SRCS custom/capi_test.cc | ||
DEPS phi_capi) | ||
endif() |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里是需要删掉的吗
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
嗯嗯,后续考虑删除