-
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
[PHI kernels] Bind XPU kernels #53336
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
❌ The PR is not created using PR's template. You can refer to this Demo. |
340f508
to
fe7ccaa
Compare
int r; | ||
if (index_type == phi::DataType::INT32) { | ||
auto index_data = const_cast<int *>(index.data<int>()); | ||
xpu::VectorParam<int> indices{ |
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.
这里为啥要把const去掉?
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里的VectorParam里的xpu数据需要非const的指针~
7dd470e
to
a4a6765
Compare
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 const_cast
@@ -434,6 +434,7 @@ PD_REGISTER_KERNEL(values_csr, | |||
kernel->InputAt(0).SetDataLayout(phi::DataLayout::SPARSE_CSR); | |||
} | |||
|
|||
#if !defined(PADDLE_WITH_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.
为什么要加这行判断
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.
因为sparse下面,cpu和xpu的sparse_coo_tensor都是绑定的同一个SparseCooTensorKernel,如果同时编译的话会产生重复绑定报错。另外因为这个kernel可以根据输入Backend产生一个包含了两个dense_tensors的coo_tensor,所以cpu和xpu可以共用一个kernel~
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.
cpu和xpu的sparse_coo_tensor都是绑定的同一个SparseCooTensorKernel,如果同时编译的话会产生重复绑定报错
感觉不太合理啊,别的kernel之前好像没有类似问题?
@@ -552,7 +558,8 @@ XPUOpMap& get_kl2_ops() { | |||
{"reciprocal_grad", | |||
XPUKernelSet({phi::DataType::FLOAT32, phi::DataType::FLOAT16})}, | |||
{"reduce_max_grad", XPUKernelSet({phi::DataType::FLOAT32})}, | |||
{"reduce_max", XPUKernelSet({phi::DataType::FLOAT32})}, | |||
{"reduce_max", |
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.
ok
@@ -668,6 +677,14 @@ XPUOpMap& get_kl2_ops() { | |||
XPUKernelSet({phi::DataType::FLOAT32, phi::DataType::FLOAT16})}, | |||
{"softplus", XPUKernelSet({phi::DataType::FLOAT32})}, | |||
{"softplus_grad", XPUKernelSet({phi::DataType::FLOAT32})}, | |||
{"sparse_coo_tensor", |
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.
这个sparse_coo_tensor是根据Backend产生不同的coo_tensor,但不会对数据进行处理,这样的话还需要单测吗?
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/paddle/fluid/tests/unittests/test_sparse_utils_op.py
cpu/gpu的,可以参考
…al_bool, scatter_grad_float32, nearest_interp_int64 kernels
Sorry to inform you that a4a6765's CIs have passed for more than 7 days. To prevent PR conflicts, you need to re-run all CIs manually. |
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
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 const_cast
PR types
Others
PR changes
OPs
Description
Bind sparse_coo_tensor, reduce_max/max_int32, range/arange_int32, equal_bool, scatter_grad_float32, nearest_interp_int64 kernels