(1) migrates the encoding from TensorDialect into the new SparseTensorDialect
(2) replaces dictionary-based storage and builders with struct-like data
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Looks great!
One thing still missing is to enforce the invariant on the SparseTensorEncodingAttr with a verify() method.
The verifyEncoding is really about "is this attribute compatible with a given tensor", but the SparseTensorEncodingAttr also has it own invariants as a standalone construct. For example:
The dimLevelType size should match the dimOrdering size, and the dimOrdering should be a permutation (i.e. only a subset of the AffineMap are possible).
mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensorAttrDefs.td | ||
---|---|---|
17 | Can you wrap this at 80 characters? |
Yes, that is a good idea. Right now we verify through parsing and IR's verification, but this will add a level of verification on the pure constructor.
Added...
add an explicit verifier that is shared between other
verification paths, but also used by e.g. constructor
mlir/lib/Dialect/SparseTensor/IR/SparseTensorDialect.cpp | ||
---|---|---|
114–118 | Oh, that is brilliant. Thanks for pointing this out. Much nicer! |
Can you wrap this at 80 characters?