-
Notifications
You must be signed in to change notification settings - Fork 5.7k
[XPU] update StridedCopyKernel #72030
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] update StridedCopyKernel #72030
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
// 下述XPU算子有性能问题,因此暂时禁用掉,改成“先拷贝到CPU,按照CPU算子逻辑计算,再拷贝回XPU”的临时方案 | ||
/* |
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 repo里暂时没有中文注释,换成英文吧~
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.
done
|
||
// CPU buffer for out | ||
char* output_on_cpu = new char[out->Holder()->size()]; | ||
memory_utils::Copy(CPUPlace(), |
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.
这里需要Wait一下吗?我看底层用的是xpu_memcpy_async。
一般,在Kernel中我们使用phi::Copy,如果给phi::Copy传入Stream则代表不blocking,如果stream为Nullptr,表示需要Blocking。
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.
如单独沟通,继续保留使用memory_utils::Copy
,并且补充了同步操作。
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
* [XPU] update StridedCopyKernel * fix ut env * follow comments
PR Category
Custom Device
PR Types
Performance
Description
目前
phi::StridedCopyKernel
的XPU实现中,会使用xpu::strided_copy
函数。该函数有严重的性能问题,因此暂时禁用掉,改成“先拷贝到CPU,按照CPU算子逻辑计算,再拷贝回XPU”的临时方案。由于有其它一批XPU下面的单测,仅能在
export FLAGS_use_stride_kernel=0
的时候通过,因此本PR先修改了test_setitem_appendix
单个单测的运行时环境变量。