This is an archive of the discontinued LLVM Phabricator instance.

[mlir] Introduce callback-based builders for AffineForOp
ClosedPublic

Authored by ftynse on Jun 12 2020, 11:47 AM.

Details

Summary

Similarly to scf::ForOp, introduce additional function_ref arguments to
AffineForOp::build that can be used to populate the body of the loop during
its construction. Provide compatibility functions for constructing affine loop
nests using edsc::ScopedContext.

edsc::AffineLoopNestBuilder and reletad functionality is now deprecated and
will be removed soon, users are expected to switch to affineLoopNestBuilder
that provides similar functionality with a simpler OpBuilder-based
implementation.

Depends On D81753

Diff Detail

Event Timeline

ftynse created this revision.Jun 12 2020, 11:47 AM
Herald added a project: Restricted Project. · View Herald Transcript
rriddle accepted this revision.Jun 12 2020, 11:55 AM
rriddle added inline comments.
mlir/lib/Dialect/Affine/EDSC/Builders.cpp
106

You could use m_Constant(IntegerAttr*) or m_ConstantInt(APInt*) instead here.

mlir/lib/Dialect/Affine/IR/AffineOps.cpp
1209–1215

nit: Can we rename this bodyBuilderFn? It was slightly confusing seeing bodyBuilder and builder next to each other.

This revision is now accepted and ready to land.Jun 12 2020, 11:55 AM
ftynse updated this revision to Diff 270695.Jun 15 2020, 2:42 AM
ftynse marked 2 inline comments as done.

Address review

ftynse added inline comments.Jun 15 2020, 2:44 AM
mlir/lib/Dialect/Affine/EDSC/Builders.cpp
106

I thought about that, but it turns out to be more verbose than what I currently have.

nicolasvasilache accepted this revision.Jun 15 2020, 3:20 AM
This revision was automatically updated to reflect the committed changes.