This is an archive of the discontinued LLVM Phabricator instance.

[mlir][sparse] Avoid generating DimOp in conversion passes.
ClosedPublic

Authored by Peiming on Sep 9 2022, 10:29 AM.

Diff Detail

Event Timeline

Peiming created this revision.Sep 9 2022, 10:29 AM
Herald added a project: Restricted Project. · View Herald Transcript
Peiming requested review of this revision.Sep 9 2022, 10:29 AM
aartbik accepted this revision.Sep 9 2022, 10:45 AM
This revision is now accepted and ready to land.Sep 9 2022, 10:45 AM
aartbik added inline comments.Sep 9 2022, 10:46 AM
mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorConversion.cpp
1171

oh wait, remove this comment part.

Peiming updated this revision to Diff 459126.Sep 9 2022, 10:54 AM

Address comments + avoid generating dimOp in codegen pass as well

Peiming updated this revision to Diff 459132.Sep 9 2022, 11:01 AM

remove redundant cast

aartbik accepted this revision.Sep 9 2022, 11:02 AM
aartbik added inline comments.
mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorCodegen.cpp
79

Use /// for top level comment

79

Use "s" form.

Gets the dimension
or

Returns the dimension....

80

not sure if we need this much detail for short a short helper, but okay if you prefer it this way

(but use returns in that case)

378

People often prefer the success on main path

if (!sz)

return failure();

rewriter.replaceOp(op, *sz);
return success();

is is also slightly shorter

516

I would not use inline comment for this, but attached comment

assert(sz); // this is for sure a sparse tensor

And I forgot to say: nice work! clean way to avoid the rewriting old ops problem!

Peiming updated this revision to Diff 459133.Sep 9 2022, 11:06 AM
Peiming marked 6 inline comments as done.

address comments from Aart

This revision was landed with ongoing or failed builds.Sep 9 2022, 11:08 AM
This revision was automatically updated to reflect the committed changes.