[all-commits] [llvm/llvm-project] d37aff: [mlir][sparse] add a sparse_tensor.print operation...

Aart Bik via All-commits all-commits at lists.llvm.org
Wed Feb 28 12:33:39 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d37affb06f2709ee46a86568a77ae6fea7fb4424
      https://github.com/llvm/llvm-project/commit/d37affb06f2709ee46a86568a77ae6fea7fb4424
  Author: Aart Bik <39774503+aartbik at users.noreply.github.com>
  Date:   2024-02-28 (Wed, 28 Feb 2024)

  Changed paths:
    M mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensorOps.td
    M mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorRewriting.cpp
    A mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_print.mlir

  Log Message:
  -----------
  [mlir][sparse] add a sparse_tensor.print operation (#83321)

This operation is mainly used for testing and debugging purposes but
provides a very convenient way to quickly inspect the contents of a
sparse tensor (all components over all stored levels).

Example:

[ [ 1, 0, 2, 0, 0, 0, 0, 0 ],
  [ 0, 0, 0, 0, 0, 0, 0, 0 ],
  [ 0, 0, 0, 0, 0, 0, 0, 0 ],
  [ 0, 0, 3, 4, 0, 5, 0, 0 ]

when stored sparse as DCSC prints as

---- Sparse Tensor ----
nse = 5
pos[0] : ( 0, 4,  )
crd[0] : ( 0, 2, 3, 5,  )
pos[1] : ( 0, 1, 3, 4, 5,  )
crd[1] : ( 0, 0, 3, 3, 3,  )
values : ( 1, 2, 3, 4, 5,  )
----



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list