[all-commits] [llvm/llvm-project] 6b88c8: [mlir][sparse] Start migration to new surface synt...

Aart Bik via All-commits all-commits at lists.llvm.org
Thu Jun 29 11:32:25 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 6b88c852b649a4eb3e0eb01efea88f5bac360f1a
      https://github.com/llvm/llvm-project/commit/6b88c852b649a4eb3e0eb01efea88f5bac360f1a
  Author: Aart Bik <ajcbik at google.com>
  Date:   2023-06-29 (Thu, 29 Jun 2023)

  Changed paths:
    M mlir/lib/Dialect/SparseTensor/IR/CMakeLists.txt
    A mlir/lib/Dialect/SparseTensor/IR/Detail/DimLvlMap.cpp
    A mlir/lib/Dialect/SparseTensor/IR/Detail/DimLvlMap.h
    A mlir/lib/Dialect/SparseTensor/IR/Detail/DimLvlMapParser.cpp
    A mlir/lib/Dialect/SparseTensor/IR/Detail/DimLvlMapParser.h
    A mlir/lib/Dialect/SparseTensor/IR/Detail/LvlTypeParser.cpp
    A mlir/lib/Dialect/SparseTensor/IR/Detail/LvlTypeParser.h
    A mlir/lib/Dialect/SparseTensor/IR/Detail/TemplateExtras.h
    A mlir/lib/Dialect/SparseTensor/IR/Detail/Var.cpp
    A mlir/lib/Dialect/SparseTensor/IR/Detail/Var.h
    M mlir/lib/Dialect/SparseTensor/IR/SparseTensorDialect.cpp
    M mlir/test/Dialect/SparseTensor/roundtrip_encoding.mlir
    M utils/bazel/llvm-project-overlay/mlir/BUILD.bazel

  Log Message:
  -----------
  [mlir][sparse] Start migration to new surface syntax for STEA

We are in the progress of migrating to a much improved surface syntax for the Sparse Tensor Encoding Attribute (STEA).

You can see a preview of this in the StableHLO RFC at

 https://github.com/openxla/stablehlo/blob/main/rfcs/20230210-sparsity.md

//**This design is courtesy Wren Romano.**//

This initial revision
(1) Introduces the first version of a new parser written by Wren Romano
(2) Introduces a simple "migration plan" using NEW_SYNTAX on the STEA, which will allow us to test the new parser with new examples, as well as migrate existing examples over without the need to rewrite them all

This first "drop" merely provides the entry points to parse the new syntax. The parser is still under active development. For example, we need to address the "lookahead" issue when parsing the lvl spec (viz. do we see l0 = d0 or a direct d0). Another larger task is to actually implement "affine" parsing (since the MLIR affine parser is not accessible in other parts of the tree).

EXAMPLE:

Currently, CSR looks like

  #CSR = #sparse_tensor.encoding<{
    lvlTypes = ["dense","compressed"],
    dimToLvl = affine_map<(i,j) -> (i,j)>
  }>

but you can "force" the new parser with

  #CSR = #sparse_tensor.encoding<{
    NEW_SYNTAX =
    (d0, d1) -> (l0 = d0 : dense, l1 = d1 : compressed)
  }>

Reviewed By: Peiming

Differential Revision: https://reviews.llvm.org/D153997




More information about the All-commits mailing list