[all-commits] [llvm/llvm-project] 2c3326: [mlir][sparse] Add lowering for unary and binary ops

Jim Kitchen via All-commits all-commits at lists.llvm.org
Tue May 3 13:51:06 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 2c33266084602a046736bfa0caf441de313a6682
      https://github.com/llvm/llvm-project/commit/2c33266084602a046736bfa0caf441de313a6682
  Author: Jim Kitchen <jim22k at gmail.com>
  Date:   2022-05-03 (Tue, 03 May 2022)

  Changed paths:
    M mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensorOps.td
    M mlir/include/mlir/Dialect/SparseTensor/Utils/Merger.h
    M mlir/lib/Dialect/SparseTensor/Transforms/Sparsification.cpp
    M mlir/lib/Dialect/SparseTensor/Utils/Merger.cpp
    A mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_binary.mlir
    M mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_matrix_ops.mlir
    A mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_unary.mlir
    M mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_vector_ops.mlir

  Log Message:
  -----------
  [mlir][sparse] Add lowering for unary and binary ops

Adding lowering for Unary and Binary required several changes due to
their unique nature of containing custom code for different "regions"
of the sparse structure being operated on. Along with a Kind, a pointer
to the Operation is passed along to be merged once the lattice
structure is figured out.

The original operation is maintained, as it is required for subsequent
lattice decisions. However, sparse_tensor.binary has some branches
are considered as fully handled and therefore are marked with as
kBinaryBranch to distinguish them.

A unique aspect of the custom code is that sometimes the desired result
is no result at all -- i.e. a user wants overlapping sparse entries to
become empty in the output. The solution to this is to return an
uninitialized Value(), which is checked and handled elsewhere in the
code and results in nothing being written to the output tensor for that
case.

Reviewed By: aartbik

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




More information about the All-commits mailing list