This is an archive of the discontinued LLVM Phabricator instance.

[mlir][sparse] Introducing a new sparse_tensor.foreach operator.
ClosedPublic

Authored by Peiming on Sep 22 2022, 2:53 PM.

Diff Detail

Event Timeline

Peiming created this revision.Sep 22 2022, 2:53 PM
Herald added a project: Restricted Project. · View Herald Transcript
Peiming requested review of this revision.Sep 22 2022, 2:53 PM
aartbik added inline comments.Sep 22 2022, 2:59 PM
mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensorOps.td
191

let's make a new "section" for this. e.g. iteration, or something like that

Peiming updated this revision to Diff 462322.Sep 22 2022, 3:29 PM

move into a new section

Peiming updated this revision to Diff 462341.Sep 22 2022, 3:46 PM

rename section

aartbik added inline comments.Sep 22 2022, 3:56 PM
mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensorOps.td
733

in a sparse tensor -> in the given sparse tensor

739

coordination -> coordinates

741

I think you can remove 741/743 since that really only applies to the memory related ops that do something on the side.
It is pretty obvious that a foreach does something more than produce one value ;-)

752

typo: tenosr -> tensor

mlir/lib/Dialect/SparseTensor/IR/SparseTensorDialect.cpp
459

static_cast

462

unsigned i

Peiming added inline comments.Sep 22 2022, 4:13 PM
mlir/lib/Dialect/SparseTensor/IR/SparseTensorDialect.cpp
462

surprisingly, getRank() return int64_t

Peiming updated this revision to Diff 462351.Sep 22 2022, 4:18 PM
Peiming marked 5 inline comments as done.

address comments

aartbik added inline comments.Sep 22 2022, 4:33 PM
mlir/lib/Dialect/SparseTensor/IR/SparseTensorDialect.cpp
462

Oh, but then use int64_t please, also use the idiom

for (int64_t i = 0, e = t.getRank(); i < e; i++)
Peiming updated this revision to Diff 462354.Sep 22 2022, 4:37 PM

Change type in loops

Peiming marked 2 inline comments as done.Sep 22 2022, 4:37 PM
aartbik accepted this revision.Sep 22 2022, 4:41 PM
This revision is now accepted and ready to land.Sep 22 2022, 4:41 PM
Peiming updated this revision to Diff 462355.Sep 22 2022, 4:45 PM

address comments