-
Notifications
You must be signed in to change notification settings - Fork 5.7k
[XPU] add complex
,real
,imag
,conj
op for xpu
#72649
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
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
complex
,real
,imag
op for xpucomplex
,real
,imag
op for 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.
LGTM
dev_ctx.template Alloc<T>(dx, static_cast<size_t>(numel * sizeof(T))); | ||
DenseTensor real = Fill<phi::dtype::Real<T>, Context>( | ||
dev_ctx, common::vectorize<int>(dout.dims()), phi::dtype::Real<T>(0.0)); | ||
int r = xfft_internal::xpu::combine_as_complex( |
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.
xpufftPR:#72477
|
||
#include "paddle/phi/kernels/complex_grad_kernel.h" | ||
|
||
#include "fft/cuComplex.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.
这里是不是需要开启WITH_XPU_XFT
才能编译?那就要考虑以下几件事:
1、现在这个配置,默认是OFF,所以默认情况下就编不过?
2、是否需要像其它宏定义一样,加个判断?比如,如果没定义这个,就走到另外的分支上,报not implemented或者precondition not met。
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.
是的,已修改为打开WITH_XPU_FFT才编译新增加的fft相关的算子,未打开的情况上不编译进去
这样的话不需要报not implemented或者precondition not met,当未编译时使用到相关的算子时,框架会自动fallback回cpu上执行,这样不会报错,使用体验更好一些
reinterpret_cast<cuFloatComplex*>(const_cast<T*>(x.data<T>())), | ||
reinterpret_cast<cuFloatComplex*>(out->data<T>())); | ||
PADDLE_ENFORCE_XDNN_SUCCESS(r, "conj"); | ||
if (std::is_same<T, phi::dtype::complex<float>>::value) { |
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.
可以尝试把is_same::value换成is_same_v
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.
在下个PR中修改,同时conj在xpu3_op_list.cc中少添加的类型也在下个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.
complex
,real
,imag
op for xpucomplex
,real
,imag
,conj
op for xpu
/re-run approval |
PR Category
Operator Mechanism
PR Types
New features
Description
XPU新增
complex
,real
,imag
,conj
四个算子和对应单测Pcard-75624