This is an archive of the discontinued LLVM Phabricator instance.

[mlir][sparse] fix crashes when the tensor that defines the loop bound can not be found
ClosedPublic

Authored by Peiming on Jun 13 2023, 6:30 PM.

Diff Detail

Event Timeline

Peiming created this revision.Jun 13 2023, 6:30 PM
Herald added a project: Restricted Project. · View Herald Transcript
Peiming requested review of this revision.Jun 13 2023, 6:30 PM
Peiming planned changes to this revision.Jun 13 2023, 6:31 PM
Peiming updated this revision to Diff 531356.Jun 14 2023, 8:36 AM

fix errors.

Peiming updated this revision to Diff 531406.Jun 14 2023, 10:06 AM

add test cases.

K-Wu accepted this revision.Jun 14 2023, 10:14 AM
This revision is now accepted and ready to land.Jun 14 2023, 10:14 AM
aartbik added inline comments.Jun 14 2023, 10:21 AM
mlir/test/Dialect/SparseTensor/sampled_dense_dense_matmul_with_spy.mlir
82 ↗(On Diff #531406)

we should avoid the double reduction and try to get something like this to work (I think bringing in outside values into block should work)

%result = linalg.generic #trait_sampled_dense_dense

  ins(%argA, %argB: tensor<8x8xf64>, tensor<8x8xf64>)
  outs(%argS: tensor<8x8xf64, #SM>) {
    ^bb(%a: f64, %b: f64, %x: f64):
       %sel = sparse_tensor.unary %x : f64 to f64
         present={
            ^bb0(%p: f64):
              sparse_tensor.yield %f1 : f64
         }
         absent={}
       %mul = arith.mulf %a, %b :  f64
       %2 = sparse_tensor.reduce %x, %sel, %f0 : f64 {
          ^bb0(%p: f64, %q: f64):
            %add = arith.addf %p, %mul : f64
            sparse_tensor.yield %add : f64
        }
       linalg.yield %2 : f64
} -> tensor<8x8xf64, #SM>
aartbik requested changes to this revision.Jun 14 2023, 10:22 AM
This revision now requires changes to proceed.Jun 14 2023, 10:22 AM
Peiming updated this revision to Diff 531463.Jun 14 2023, 12:41 PM

update check tests.

aartbik accepted this revision.Jun 14 2023, 12:42 PM
aartbik added inline comments.
mlir/lib/Dialect/SparseTensor/Transforms/LoopEmitter.cpp
547–548

else if () {
}

mlir/lib/Dialect/SparseTensor/Transforms/LoopEmitter.h
82

typo: Optional

This revision is now accepted and ready to land.Jun 14 2023, 12:42 PM
Peiming updated this revision to Diff 531472.Jun 14 2023, 1:08 PM
Peiming marked an inline comment as done.

address comments.

Peiming marked an inline comment as done.Jun 14 2023, 1:12 PM
Peiming updated this revision to Diff 531474.Jun 14 2023, 1:14 PM

cleanup check test.

This revision was landed with ongoing or failed builds.Jun 14 2023, 1:28 PM
This revision was automatically updated to reflect the committed changes.