llvm-project/mlir
Feng Liu 03b48999b6 Add support to constant sparse tensor / vector attribute
The SparseElementsAttr uses (COO) Coordinate List encoding to represents a
sparse tensor / vector. Specifically, the coordinates and values are stored as
two dense elements attributes. The first dense elements attribute is a 2-D
attribute with shape [N, ndims], which contains the indices of the elements
with nonzero values in the constant vector/tensor. The second elements
attribute is a 1-D attribute list with shape [N], which supplies the values for
each element in the first elements attribute. ndims is the rank of the
vector/tensor and N is the total nonzero elements.

The syntax is:

`sparse<` (tensor-type | vector-type)`, ` indices-attribute-list, values-attribute-list `>`

Example: a sparse tensor

sparse<vector<3x4xi32>, [[0, 0], [1, 2]], [1, 2]> represents the dense tensor

[[1, 0, 0, 0]
 [0, 0, 2, 0]
 [0, 0, 0, 0]]

PiperOrigin-RevId: 217764319
2019-03-29 13:32:55 -07:00
..
include/mlir Add support to constant sparse tensor / vector attribute 2019-03-29 13:32:55 -07:00
lib Add support to constant sparse tensor / vector attribute 2019-03-29 13:32:55 -07:00
test Add support to constant sparse tensor / vector attribute 2019-03-29 13:32:55 -07:00
tools [MLIR] Basic infrastructure for vectorization test 2019-03-29 13:32:13 -07:00
utils Rename affineint type to index type. The name 'index' may not be perfect, but is better than the old name. Here is some justification: 2019-03-29 13:24:16 -07:00
.clang-format [mlir] add .clang-format 2019-03-29 12:41:43 -07:00
LICENSE.TXT Continue sketching out basic infrastructure, including an input and output 2019-03-29 12:23:51 -07:00