-
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 XPU plugin support #55101
[XPU] Add XPU plugin support #55101
Conversation
…ce of the fusion ops based on hand-written xpu micro kernels.
你的PR提交成功,感谢你对开源项目的贡献! |
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
|
||
#pragma once | ||
#include "xpu/xdnn.h" | ||
|
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.
这个东西和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.
XFT 作为昆仑独立的加速库,用于支持 transformer 类大模型的融合算子,而 plugin 是作为 Paddle 内置的库,是对 XDNN 和 XFT 的补充,主要用于支持 Paddle 模型的特殊算子(例如各业务的自定义算子),并改变目前只有图优化一种手段且核函数依赖昆仑排期的现状,Paddle 可自行开发适合模型的简单融合算子的核函数,例如多个 eltwise XDNN API 合并成一个核函数的调用可减少访存开销,降低带宽需求提升模型整体性能。
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.
这种业务定制的融合放入paddle开源仓中是否合适?
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.
业务模型在非保密情况下,对于通用子结构的融合及融合算子放在开源repo没问题;对于保密情况,可通过paddle自定义算子由业务方或paddle内部管理。
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 printf
@@ -0,0 +1,379 @@ | |||
cmake_minimum_required(VERSION 3.16) |
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.
这里是3.16,但是api无论是2.6产出还是master主干上,都是要求3.20,是否会有影响呢
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.
不影响的,测试过没有问题的,我们不是编译 XDNN,只是编译 plugin 哈~
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.
嗯嗯这里确实没有编译xdnn的逻辑,抱歉我刚才没有说清楚,就是plugin是xdnn其中的一个小模块,这个小模块在xdnn中要求cmake3.20,如果测试没问题就ok
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.
plugin是xdnn可独立编译的模块,它的CMakeLists.txt部分代码引用了XDNN的CMakeLists.txt,目前我们测试下来,cmake 3.16是没问题的。
mkdir build | ||
cd build | ||
cmake -DCMAKE_VERBOSE_MAKEFILE=ON -DBUILD_STANDALONE=ON .. | ||
make |
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.
编译逻辑转移到cmakelist里,确实更符合paddle语法规范。
但是后续api plugin仍会有升级,这样较大的改动,会使得后续升级花费更多时间
请问是不再有后续升级计划呢,还是打算后续升级后再比对着改写?
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.
嗯嗯联编走cmake。是这样的,我不确定我观察的这里的代码对不对,就是原本的xdnn中plugin是通过一个脚本+cmake一起编译的,但是我看这里把xdnn plugin中脚本的编译逻辑改到cmakelist里了,编译直接走cmake,也就意味着和xdnn中plugin代码有了较大区别,在后续xdnn plugin升级中,估计还是保持脚本+ cmakelist这样的编译方式,后续如果那边plugin有升级,则需要比对着那边的脚本+cmakelist改着加到这里cmakelist里,使得升级花更多时间。所以想问一下以后是否是没有升级的打算了呢
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.
xdnn中的plugin的编译确实是bash脚本+CMakeLists.txt,但是bash脚本只是下载和配置xtdk、xre等工具链和依赖库,最终编译还是依赖 plugin/CMakeLists.txt,我这次提交的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
PR types
Function optimization
PR changes
Others
Description
Add XPU plugin to support the customized ops and improve the performance of the fusion ops based on hand-written xpu micro kernels.
Pcard-72642