-
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
【Sparse】add some kernels(csr*dense->csr, dense*dense->csr) of SparseTensor matmul #42935
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
b9ca201
to
1c86c1c
Compare
e73c7c6
to
f2aa2f0
Compare
cf56517
to
dc128d8
Compare
100c8fa
to
eb2d869
Compare
paddle/fluid/pybind/eager_method.cc
Outdated
@@ -1777,6 +1777,8 @@ PyMethodDef variable_methods[] = { | |||
METH_VARARGS | METH_KEYWORDS, NULL}, | |||
{"cols", (PyCFunction)(void (*)(void))tensor_method_get_non_zero_cols, | |||
METH_VARARGS | METH_KEYWORDS, NULL}, | |||
{"is_dense", (PyCFunction)(void (*)(void))tensor_method_is_dense, |
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.
已删除
@@ -0,0 +1,113 @@ | |||
/* Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved. |
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/sparse...,目录已经有sparse信息了,文件名不需要再重复一遍,略显冗余
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.
去掉了,后续统一与dense kernel保持一致文件命名风格,不加前缀
#include "paddle/phi/kernels/copy_kernel.h" | ||
#include "paddle/phi/kernels/empty_kernel.h" | ||
#include "paddle/phi/kernels/funcs/sparse/sparse_blas.h" | ||
#include "paddle/phi/kernels/sparse/sparse_mm_kernel.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.
头文件要在最上面,这里头文件顺序不太对
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.
cu文件会被pre-commit自动按字母序修改,所以cu没办法保持full_kernel.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.
加空行隔开也不行吗,之前是可以的
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.
试了下不行,看了下其他cu,应该都没成功
#include "paddle/phi/kernels/empty_kernel.h" | ||
#include "paddle/phi/kernels/funcs/sparse/sparse_blas.h" | ||
#include "paddle/phi/kernels/sparse/sparse_mm_grad_kernel.h" | ||
#include "paddle/phi/kernels/transpose_kernel.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.
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.
已修改头文件规范,thx~
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 名称建议修改一下mm -> matmul
已修改,thx~ |
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
e964b42
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
…tmul (PaddlePaddle#42935) * add some kernel(csr*dense->csr, dense*dense->csr) of SparseTensor matmul * fix CI * fix CI * fix comment * fix comment
PR types
New features
PR changes
APIs
Describe
稀疏矩阵乘系列一共7个API,14个计算Kernel,本PR增加其中2个:
paddle.incubate.sparse.matmul
通用稀疏矩阵乘,支持 sparse与sparse运算、sparse与dense交互运算 等常规运算
paddle.incubate.sparse.masked_matmul
特殊矩阵乘,相当于 dense矩阵乘、mask稀疏采样 两个操作的叠加,在某些模型使用