-
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
[XPU]add support for XHPC #59895
[XPU]add support for XHPC #59895
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
chenrunzhe seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
${CMAKE_SOURCE_DIR}/tools/xpu/get_xpti_dependence.sh ${XPU_XPTI_URL} | ||
${XPU_XPTI_DIR_NAME} | ||
DOWNLOAD_NO_PROGRESS 1 | ||
UPDATE_COMMAND "" | ||
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${XPU_INSTALL_ROOT} | ||
CMAKE_CACHE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${XPU_INSTALL_ROOT} | ||
BUILD_BYPRODUCTS ${XPU_API_LIB} | ||
BUILD_BYPRODUCTS ${XPU_API_LIB} BUILD_BYPORDUCTS ${XPU_XBLAS_LIB} |
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.
pre-commit格式检查的时候自动改的
cmake/external/xpu.cmake
Outdated
@@ -206,6 +237,11 @@ if(WITH_XPTI) | |||
target_link_libraries(xpulib ${XPU_XPTI_LIB}) | |||
endif() | |||
|
|||
if(WITH_XPU_XHPC) | |||
target_link_libraries(xpulib ${XPU_API_LIB} ${XPU_RT_LIB} ${XPU_XBLAS_LIB}) | |||
target_link_libraries(xpulib ${XPU_API_LIB} ${XPU_RT_LIB} ${XPU_XFA_LIB}) |
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.
241行和242行可以拼接在一起么?
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.
另外,和225-234行这一堆可以拼接在一起么?
这么多不同的并且是“正交”的编译选项,看看有没有更优雅的方式进行组合。
tools/xpu/pack_paddle_depence.sh
Outdated
cp -r output/${XHPC_DIR_NAME}/xblas/so/* xpu/lib/ | ||
|
||
cp -r output/${XHPC_DIR_NAME}/xdnn/include/* xpu/include/ | ||
cp -r output/${XHPC_DIR_NAME}/xdnn/so/* xpu/lib |
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.
53-54行的这两个cp,是否依赖下面60-61行的mkdir(对应原版38-39行的mkdir)?
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.
已修改
else() | ||
target_link_libraries(xpulib ${XPU_API_LIB} ${XPU_RT_LIB}) | ||
endif() | ||
target_link_libraries(xpulib ${XPU_API_LIB} ${XPU_RT_LIB} ${XPU_BKCL_LIB} |
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.
这里的修改是直接删掉了原版的各种if-else么?
不开xccl以及不开xft的话会有问题么?
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.
不开xccl和xft时,对应的变量${XPU_XFT_LIB}${XPU_BKCL_LIB}直接为空值,不会对编译造成影响
shutil.copy(env_dict.get("XPU_XBLAS_LIB"), libs_path) | ||
package_data['paddle.libs'] += [env_dict.get("XPU_XBLAS_LIB_NAME")] | ||
shutil.copy(env_dict.get("XPU_XFA_LIB"), libs_path) | ||
package_data['paddle.libs'] += [env_dict.get("XPU_XFA_LIB_NAME")] |
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.
注意看一下,python/setup.py.in
以及python/env_dict.py.in
是否也有需要改的?
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.
LGTM
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.
LGTM for CMakeLists.txt
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.
LGTM
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.
LGTM for setup.py.in
PR types
New features
PR changes
Others
Description
添加了paddle与XHPC共同编译的相关代码。
XHPC是包含xdnn,xBLAS,flash-attention三个库产出的合集包,提供了一些特定的高性能算子。后续在paddle中使用例如fc_fusion、fc_batched、flash_attention_fwd等算子,都会从这些库里调用。
使用XHPC时需要在cmake时开启-DWITH_XPU_XHPC=ON,由于XHPC依赖于特定版本的XDNN,因此开启该选项后paddle会使用XHPC中的xdnn库进行编译。与xdnn一样,可以在xpu.cmake中通过修改日期拉取不同版本的XHPC产出。
不开-DWITH_XPU_XHPC时编译过程和以前一样,会使用XDNN在bos上的产出编译。