-
Notifications
You must be signed in to change notification settings - Fork 5.7k
[XPU] fix index's datatype, using int64 instead of int, part 2 (g-z) #72519
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提交成功,感谢你对开源项目的贡献! |
e776275
to
9faff6b
Compare
@@ -29,6 +29,8 @@ set(XPU_XBLAS_LIB_NAME "libxpu_blas.so") | |||
set(XPU_XFA_LIB_NAME "libxpu_flash_attention.so") | |||
set(XPU_XPUDNN_LIB_NAME "libxpu_dnn.so") | |||
set(XPU_FFT_LIB_NAME "libcufft.so") | |||
# Avoid deprecated int32 apis: | |||
add_compile_definitions(XPUAPI_NOT_INCLUDE_DEPRECATED) |
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.
不再include int32老接口,参阅内部卡片xpu-paddlepaddle-864
@@ -1075,6 +1075,7 @@ XPUOpMap& get_kl3_ops() { | |||
phi::DataType::BFLOAT16})}, | |||
{"pow2_decay_with_linear_warmup", XPUKernelSet({phi::DataType::FLOAT32})}, | |||
{"prior_box", XPUKernelSet({phi::DataType::FLOAT32})}, | |||
{"prelu", XPUKernelSet({phi::DataType::FLOAT32, phi::DataType::FLOAT16})}, |
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.
顺手绑了一个之前遗留的算子
@@ -39,13 +39,13 @@ void UnfoldGradKernel(const Context& ctx, | |||
const auto& x_dims = x_grad->dims(); | |||
const int batch_size = static_cast<int>(x_dims[0]); | |||
|
|||
int out_height = phi::funcs::CalcOutputSize(x_dims[2], | |||
int out_height = phi::funcs::CalcOutputSize(static_cast<int>(x_dims[2]), |
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.
为什么这里要static_cast?
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/phi/kernels/funcs/unfold_functor.h中对函数CalcOutputSize新增了模板T,能够同时支持int和int64,修改之后再调用时必须将入参统一为int或int64。这里x_dims[2]是int64类型,而kernel_sizes[0]等是int类型
} // namespace phi | ||
#endif | ||
# |
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.
收到,这里漏掉了。单独的#不会影响编译,后续PR一起带上修复
@@ -273,14 +281,17 @@ void RnnGradKernel(const Context& dev_ctx, | |||
hidden_size, | |||
seq_len, | |||
seq_len_tensor, | |||
1, |
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.
这为什么突然+1
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.
bilstm_grad的int接口是老接口,在deprecated.h中。int64接口为新接口,与老接口相比多了一个参数,这里添加1参考了api接口中int调用int64接口的逻辑。
const int64_t col = in_dims[in_dims.size() - 1]; | ||
|
||
int r = | ||
xpu::sorted_topk<XPUType>(dev_ctx.x_context(), |
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.
topk index int64_t版本走了不一样的分支,因此可能需要联系算子加固
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.
算子已加固,参考内部卡片API-BR-394
中链接的PR
@@ -39,13 +39,13 @@ void UnfoldGradKernel(const Context& ctx, | |||
const auto& x_dims = x_grad->dims(); | |||
const int batch_size = static_cast<int>(x_dims[0]); | |||
|
|||
int out_height = phi::funcs::CalcOutputSize(x_dims[2], | |||
int out_height = phi::funcs::CalcOutputSize(static_cast<int>(x_dims[2]), |
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/phi/kernels/funcs/unfold_functor.h中对函数CalcOutputSize新增了模板T,能够同时支持int和int64,修改之后再调用时必须将入参统一为int或int64。这里x_dims[2]是int64类型,而kernel_sizes[0]等是int类型
} // namespace phi | ||
#endif | ||
# |
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一起带上修复
@@ -273,14 +281,17 @@ void RnnGradKernel(const Context& dev_ctx, | |||
hidden_size, | |||
seq_len, | |||
seq_len_tensor, | |||
1, |
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.
bilstm_grad的int接口是老接口,在deprecated.h中。int64接口为新接口,与老接口相比多了一个参数,这里添加1参考了api接口中int调用int64接口的逻辑。
nullptr, | ||
nullptr, | ||
nullptr, | ||
nullptr, | ||
nullptr, | ||
nullptr, | ||
i_f_g_o, | ||
c); | ||
c, |
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.
同理,两个xpu::Activation_t类型的参数也是新旧接口的差异
const int64_t col = in_dims[in_dims.size() - 1]; | ||
|
||
int r = | ||
xpu::sorted_topk<XPUType>(dev_ctx.x_context(), |
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.
算子已加固,参考内部卡片API-BR-394
中链接的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
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 error message
/re-run approval |
PR Category
Custom Device
PR Types
Bug fixes
Description
Fix index's datatype, using int64 instead of int, part 2 (g-z)