This is an archive of the discontinued LLVM Phabricator instance.

[mlir][sparse] support sparse tensor element type conversion in codegen path
ClosedPublic

Authored by Peiming on Feb 22 2023, 11:04 AM.

Diff Detail

Event Timeline

Peiming created this revision.Feb 22 2023, 11:04 AM
Herald added a project: Restricted Project. · View Herald Transcript
Peiming requested review of this revision.Feb 22 2023, 11:04 AM
Peiming updated this revision to Diff 499602.Feb 22 2023, 11:29 AM

minor cleanup.

aartbik added inline comments.Feb 22 2023, 11:59 AM
mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensorAttrDefs.td
263

indice -> index

mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorCodegen.cpp
1043

I think it reads a bit easier if you swap if/else

so

// Fold the trivial conversion case.
if (retElemTp == srcElemTp && encDst == encSrc) {
  rewriter.replaceOp(op, adaptor.getSource());
  return success();
}
// BIt more documentation on your code
.... your new code
  return success();
Peiming updated this revision to Diff 499624.Feb 22 2023, 12:28 PM
Peiming marked 2 inline comments as done.

address comments.

mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorCodegen.cpp
1043

Indeed it does!

aartbik accepted this revision.Feb 23 2023, 9:25 AM
aartbik added inline comments.
mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorCodegen.cpp
1037–1096

please document the earlier two return cases more prominently

// Different bitwidths should be handled by rewriting
if ()
   return failure
// Fold trivial 
if () 
 return success()
// Your code
This revision is now accepted and ready to land.Feb 23 2023, 9:25 AM
Peiming updated this revision to Diff 499897.Feb 23 2023, 9:28 AM

address comments.

This revision was landed with ongoing or failed builds.Feb 23 2023, 9:50 AM
This revision was automatically updated to reflect the committed changes.