-
Notifications
You must be signed in to change notification settings - Fork 269
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
【Hackathon 5th No.110】为 Paddle 增强 sparse.matmul API #721
Conversation
## PyTorch | ||
Pytorch 的稀疏矩阵乘法的实现代码的位置在 `pytorch/aten/src/ATen/native/sparse/SparseMatMul.cpp`。 | ||
|
||
函数 `sparse_matmul_kernel` 在计算稀疏矩阵乘法时,会将两个相乘的矩阵统一为 `CSR` 模式,再进行计算,得到 `CSR` 模式的计算结果。如果想要获得 `COO` 模式的计算结果,需将 `CSR` 模式转化为 `COO` 模式。 |
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.
好的已修改
|
||
```cpp | ||
template <typename scalar_t> | ||
void sparse_matmul_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.
竞品的COO*COO、CSR*CSR的实现方式写详细一些,比如调用了什么库实现
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.
好的已修改
|
||
|
||
## TensorFlow | ||
TensorFlow 的稀疏矩阵乘法的实现代码的位置在 `tensorflow\core\kernels\sparse\sparse_mat_mul_op.cc`。 |
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.
COO*COO、CSR*CSR分开写一下
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.
|
||
API 主要通过调用 `cudaSparse` 库完成计算实现,目前暂不需要开发 CPU kernel。 | ||
|
||
`cudaSparse` 库的 `cusparseSpGEMM` 只支持 `CSR*CSR` 模式,在计算 `COO*COO` 模式时,需要进行 `COO` 和 `CSR` 模式之间的转换。 |
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.
Done.
题目:链接