This is an archive of the discontinued LLVM Phabricator instance.

[mlir] Lower shape.num_elements -> shape.reduce.
ClosedPublic

Authored by pifon2a on Jun 5 2020, 9:55 AM.

Diff Detail

Event Timeline

pifon2a created this revision.Jun 5 2020, 9:55 AM
Herald added a reviewer: silvas. · View Herald Transcript
Herald added a project: Restricted Project. · View Herald Transcript
pifon2a updated this revision to Diff 268856.Jun 5 2020, 9:57 AM

Update the comment.

pifon2a updated this revision to Diff 268864.Jun 5 2020, 10:06 AM

Fix cmake.

silvas accepted this revision.Jun 5 2020, 1:40 PM
silvas added inline comments.
mlir/include/mlir/Dialect/Shape/IR/ShapeOps.td
330

Why this rename? I think "body" sounds better.

mlir/include/mlir/Dialect/Shape/Transforms/Passes.td
15

Can we find a better name for this pass? The goal is to reduce shape ops to other more primitive shape ops. That this can simplify converting to standard is a byproduct but not essential.

Maybe "ShapeToShapeLowering?

mlir/lib/Dialect/Shape/Transforms/LegalizeShapeOpsForExport.cpp
2 ↗(On Diff #268864)

nit: this looks like it got line wrapped.

mlir/lib/Dialect/Shape/Transforms/PassDetail.h
17

Is AtomicRMWOp needed?

jpienaar accepted this revision.Jun 5 2020, 1:59 PM
jpienaar added inline comments.
mlir/include/mlir/Dialect/Shape/Transforms/Passes.h
24

Could we expand here on what the pass does too?

mlir/lib/Dialect/Shape/Transforms/LegalizeShapeOpsForExport.cpp
1 ↗(On Diff #268864)

Could we fit the next along with this line?

28 ↗(On Diff #268864)

Prefer to keep anonymous namespaces small (https://llvm.org/docs/CodingStandards.html#anonymous-namespaces)

This revision is now accepted and ready to land.Jun 5 2020, 1:59 PM
pifon2a updated this revision to Diff 269054.Jun 7 2020, 7:16 AM
pifon2a marked 10 inline comments as done.

Address the comments.

pifon2a added inline comments.Jun 7 2020, 7:21 AM
mlir/include/mlir/Dialect/Shape/IR/ShapeOps.td
330

This is to avoid confusion, since SingleBlockImplicitTerminator generates a getBody() method that return Block*, i.e. body().front() if using the old naming.

scf.for and scf.parallel also call it just region.

mlir/include/mlir/Dialect/Shape/Transforms/Passes.td
15

Naming is hard. Thanks, I like ShapeToShapeLowering!

mlir/lib/Dialect/Shape/Transforms/PassDetail.h
17

well, yes, but not here :)

Thank you, Jacques and Sean!

This revision was automatically updated to reflect the committed changes.

Reverted in a25f5cd70cef ; the build was broken with -DBUILD_SHARED_LIBS=ON