[all-commits] [llvm/llvm-project] 849529: [mlir][sparse] fix performance bug in matmul with ...

PeimingLiu via All-commits all-commits at lists.llvm.org
Tue Feb 28 13:02:31 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 849529ba8a2e155cd90b0641bcf20bc566222db6
      https://github.com/llvm/llvm-project/commit/849529ba8a2e155cd90b0641bcf20bc566222db6
  Author: Peiming Liu <peiming at google.com>
  Date:   2023-02-28 (Tue, 28 Feb 2023)

  Changed paths:
    M mlir/lib/Dialect/SparseTensor/Transforms/Sparsification.cpp
    M mlir/test/Dialect/SparseTensor/sparse_2d.mlir
    M mlir/test/Dialect/SparseTensor/sparse_kernels.mlir
    M mlir/test/Dialect/SparseTensor/sparse_sddmm.mlir

  Log Message:
  -----------
  [mlir][sparse] fix performance bug in matmul with a sparse rhs due to suboptimal iteration graphs.

While dense tensors support random accesses, it is critical to visit them in a row-major order for better cache locality. However, we previously consider dense inputs and outputs together when computing constraints for building iteration graph, it could lead us to less efficient iteration graphs.

This patch adds a new `SortMask::kIncludeDenseInput` to treat dense inputs/outputs separately when building iteration graph, thus increasing the chance for use to construct a better iteration graph.

A more fine-grained approach is to treat each input separately.

Note, related to:
 https://github.com/llvm/llvm-project/issues/51651

Reviewed By: aartbik

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




More information about the All-commits mailing list