Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.
7062 Discussions

Do we have plan for sparse matrix for int8?

sakula
Beginner
1,621 Views

When I use pytorch with mkl.

I got addmm_out_sparse_csr_impl_mkl" not implemented for 'Byte' error.

And it seems that sparse.mm doesn't support int8 type.

0 Kudos
7 Replies
VarshaS_Intel
Moderator
1,590 Views

Hi,


Thanks for posting in Intel Communities.


Could you please let us know the OS details, Intel Pytorch version, and Intel MKL version you are using?


And also, could you please provide us with the sample reproducer code and the steps you have followed to reproduce the error at our end?


It would be great if you could please elaborate on your issue.


Thanks & Regards,

Varsha


0 Kudos
sakula
Beginner
1,586 Views

 

import torch
a =torch.zeros(128, 12288*4, dtype=torch.uint8)                                                                                                                                                                                                                                                                                                                              
                                                                                                                                                                                                           
a = a.to_sparse_csr()                                                                                                                                                                                      
# b = torch.rand(12288*4, 4096, dtype=torch.int8)                                                                                                                                                          
b = torch.randint(high=255, size=(12288*4,12288), dtype=torch.uint8)                                                                                                                                       
torch.sparse.mm(a,b)

The error is "addmm_out_sparse_csr_impl_mkl" not implemented for 'Byte' 

Versions

PyTorch version: 2.0.1+cu117
Is debug build: False
CUDA used to build PyTorch: 11.7
ROCM used to build PyTorch: N/A

OS: CentOS Linux 7 (Core) (x86_64)
GCC version: (GCC) 9.3.0
Clang version: Could not collect
CMake version: version 3.26.3
Libc version: glibc-2.17

MKL version: 2.7.3

oneAPI 2022.2

Versions of relevant libraries:
[pip3] intel-extension-for-pytorch==2.0.100
[pip3] numpy==1.24.1
[pip3] torch==2.0.1
[pip3] torch-scatter==2.1.1
[pip3] torch-sparse==0.6.17
[pip3] torchaudio==2.0.2
[pip3] torchvision==0.15.2
[pip3] triton==2.0.0
[conda] intel-extension-for-pytorch 2.0.100 pypi_0 pypi
[conda] numpy 1.24.1 pypi_0 pypi
[conda] torch 2.0.1 pypi_0 pypi
[conda] torch-scatter 2.1.1 pypi_0 pypi
[conda] torch-sparse 0.6.17 pypi_0 pypi
[conda] torchaudio 2.0.2 pypi_0 pypi
[conda] torchvision 0.15.2 pypi_0 pypi
[conda] triton 2.0.0 pypi_0 pypi

0 Kudos
VarshaS_Intel
Moderator
1,520 Views

Hi,

 

Thanks for the information.

 

At our end, when we tried to run the sample reproducer code provided by you using Intel Python 3.9, PyTorch 2.0, and Intel MKL(2023.1), we got the following error:

" /root/code.py:4: UserWarning: Sparse CSR tensor support is in beta state. If you miss a functionality in the sparse tensor support, please submit a feature request to https://github.com/pytorch/pytorch/issues. (Triggered internally at /build/pytorch/aten/src/ATen/SparseCsrTensorImpl.cpp:54.)

 a = a.to_sparse_csr()". 

Please find the below screenshot:

VarshaS_Intel_0-1687449647419.png

Could you please help with the error and also could you please let us know the steps you followed to reproduce your error?

 

Thanks & Regards,

Varsha

 

 

0 Kudos
VarshaS_Intel
Moderator
1,480 Views

Hi,


We have not heard back from you. Could you please provide us with the details and update on your issue?


Thanks & Regards,

Varsha



0 Kudos
VarshaS_Intel
Moderator
1,442 Views

Hi,


We have not heard back from you. Could you please provide us with the details and update on your issue?


Thanks & Regards,

Varsha


0 Kudos
sakula
Beginner
1,432 Views

Sorry, I have solved this problem with latest pytorch. 
Thanks for your help!!

0 Kudos
VarshaS_Intel
Moderator
1,417 Views

Hi,


It’s great to know that the issue has been resolved. Thanks for sharing the solution with us. In case you run into any other issues please feel free to create a new thread.


Have a Good Day!


Thanks & Regards,

Varsha


0 Kudos
Reply