Repository navigation
Description
This tracking is meant to list the main improvements we'll be focusing on for sparse tensors, and then mapping them to the releases they should land in. Please note: these are estimates and indicate current prioritization and require effort - don't rely on this, things may still shift around.
The fill-value proposal (pytorch/rfcs#8) has a good description of the different interpretations of sparse tensors: linear algebra (where unspecified values are assumed to be 0), graph algorithms (where sparse structure indicates nodes/edges), and calculus (where non-zero fill values are needed). The description of application-level use cases for each of those interpretations is still TODO.
1.7 1.8 release
Sparse documentation updates:
- rewrite the torch.sparse main doc page #44635: review and update all content on https://pytorch.org/docs/stable/sparse.html --> PR rewrite the torch.sparse main doc page #44635
- Then update the "This API is in beta, ..." warning at the top of the docs. Feature classification may still be "beta", but API should be stable. Add performance-related note instead.
- Add an overview using tables of all operators in PyTorch, and show whether they support sparse tensors on CPU, on CUDA, and have autograd support.
1.8 release
- CSR/GCS format (see
RFC-0002: Proposed Roadmap for torch.sparse matrix multiplication rfcs#4, [WIP] Sparse GCS layout implementation and sparse matrix multiplication. #44190, RFC-0008: CSR and DM storage formats rfcs#13, Add CSR (compressed sparse row) layout for sparse tensors #50937, ) - Performance benchmarks for matrix-matrix and matrix-vector ops (dense-sparse, sparse-sparse, and compare to dense-dense) (see matmul performance benchmarks #51647)
- Benchmarking framework for sparse that's easy to extend when sparse support is added to new operators (see Sparse benchmarking utils #48397)
- Sparse test infrastructure improvements (see here for details) - PR Refactor sparse unary ops tests #49158
- Add sparse tensor support for all element-wise functions that map 0 to 0 (this is low-hanging fruit)
- sspaddmm yields inconsistent results #45113
- Unify matrix multiplications operations #45897
- Backpropagation for sparse matrix indexing is problematic (colab provided) #45996
- [Feature request] create sparse coo matrix w/o index check #14945
- Create public API to replace use of
_indices,_values,_nnz. See Add optional coalesce argument to values(), indices(), and to a new method nse() #45695.
1.9 release
- fill-value support in COO and GCS sparse tensors (see RFC-0004: Adding fill value property to PyTorch sparse tensors rfcs#8)
- extend fill-value support to all functions currently supporting sparse
To (re)assess
- Block sparse tensors, [feature request] Implementing Block Sparse Operations #9222
Relevant but blocked
- Sparse-Dense elementwise Multiplication, [Feature Request] Sparse-Dense elementwise Multiplication #3158
CSR sparse tensors
-
Add CSR (compressed sparse row) layout for sparse tensors #50937 Sparse tensor CSR layout, CPU only
-
Sparse tensor CSR layout for CUDA #56485 Sparse tensor CSR layout for CUDA
-
CSR sparse tensor: ops not implemented yet
- Addition of sparse CSR tensors is not yet implemented #59060 Addition of sparse CSR tensor
- csr_sparse @ csr_sparse op
-
Testing CSR support
- Modernize test-suite in sparse tensor CSR support #56371 - modernize CSR test-suite
- Eliminate global usage of torch.set_default_dtype in sparse test scripts #56369 - eliminate global usage of torch.set_default_dtype
-
cuSPARSE backend: Sparse CSR layout GPU backend tracking issue #60854
-
MKL backend: Sparse CSR layout CPU backend tracking issue #60858
cc @ezyang @gchanan @zou3519 @vincentqb @aocsa @nikitaved @pearu @v0dro @mruberry
Activity
ngimel commentedon Oct 15, 2020
I suggest adding #14945 to 1.8, performance of
sparse_coo_tensorcall is very bad, we should either fix it or expose unsafe version to python, or, preferably, both.rgommers commentedon Oct 15, 2020
Added to the list, and cleared stale assignee so someone else can pick it up.
pearu commentedon Oct 22, 2020
Suggest adding #45695 to 1.8, the PR is about replacing
_indices()withindices(coalesce=False)and introducingnsemethod.pearu commentedon Nov 3, 2020
Re removing "This API is in beta, ..." statement from the docs: IIUC, the API consists of methods for (i) creating tensors with sparse layout and (ii) accessing format-specific data of a tensor. For COO tensors we have (i)
torch.sparse_coo_tensorand (ii)torch.Tensor.{values, indices}. For other formats (to appear, like GCS), there may be ambiguities with this API, especially, with the (ii) part. So, I think the API needs to remain beta until we have a plan (if and) how PyTorch can be extended to support other storage formats.ngimel commentedon Dec 14, 2020
For sparse test gaps, see #48807 - no tests for
coalescefor different dtypes, add_out is tested for bfloat16 specifically instead of a general tests for dtypes https://github.com/pytorch/pytorch/pull/48807/files#diff-bf009aed03d333c6a63253630fed4465ba5f7e025029fe2a22919759c38beb6dL1305rgommers commentedon Dec 14, 2020
Cc @vfdev-5, who is looking at structural sparse testing improvements.
aocsa commentedon Dec 14, 2020
And I am working on benchmarking utils for sparse tensors here, #48397
matmul performance benchmarks (pytorch#51647)
matmul performance benchmarks (pytorch#51647)