[all-commits] [llvm/llvm-project] 889f4b: [mlir][sparse] Improve `DimLvlMapParser`'s handlin...

wren romano via All-commits all-commits at lists.llvm.org
Thu Jul 20 15:56:20 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 889f4bf26406d22e24b7e85bb4f6a8eb57d04fb7
      https://github.com/llvm/llvm-project/commit/889f4bf26406d22e24b7e85bb4f6a8eb57d04fb7
  Author: wren romano <2998727+wrengr at users.noreply.github.com>
  Date:   2023-07-20 (Thu, 20 Jul 2023)

  Changed paths:
    M mlir/lib/Dialect/SparseTensor/IR/Detail/DimLvlMapParser.cpp
    M mlir/lib/Dialect/SparseTensor/IR/Detail/DimLvlMapParser.h
    M mlir/lib/Dialect/SparseTensor/IR/Detail/Var.cpp
    M mlir/lib/Dialect/SparseTensor/IR/Detail/Var.h
    M mlir/test/Dialect/SparseTensor/invalid_encoding.mlir

  Log Message:
  -----------
  [mlir][sparse] Improve `DimLvlMapParser`'s handling of variable bindings

This commit comprises a number of related changes:

(1) Reintroduces the semantic distinction between `parseVarUsage` vs `parseVarBinding`, adds documentation explaining the distinction, and adds commentary to the one place that violates the desired/intended semantics.

(2) Improves documentation/commentary about the forward-declaration of level-vars, and about the meaning of the `bool` parameter to `parseLvlSpec`.

(2) Removes the `VarEnv::addVars` method, and instead has `DimLvlMapParser` handle the conversion issues directly.  In particular, the parser now stores and maintains the `{dims,lvls}AndSymbols` arrays, thereby avoiding the O(n^2) behavior of scanning through the entire `VarEnv` for each `parse{Dim,Lvl}Spec` call.  Unfortunately there still remains another source of O(n^2) behavior, namely: the `AsmParser::parseAffineExpr` method will copy the `DimLvlMapParser::{dims,lvls}AndSymbols` arrays into `AffineParser::dimsAndSymbols` on each `parse{Dim,Lvl}Spec` call; but fixing that would require extensive changes to `AffineParser` itself.

Depends On D155532

Reviewed By: Peiming

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




More information about the All-commits mailing list