This is an archive of the discontinued LLVM Phabricator instance.

[mlir] Add block arguments for input/output operands of 'linalg.tiled_loop`.
ClosedPublic

Authored by pifon2a on Apr 23 2021, 10:48 AM.

Diff Detail

Event Timeline

pifon2a created this revision.Apr 23 2021, 10:48 AM
pifon2a requested review of this revision.Apr 23 2021, 10:48 AM
ThomasRaoux accepted this revision.Apr 23 2021, 11:01 AM

Thanks @pifon2a!

mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
2124–2135

Not directly related to this change but I believe we are not supposed to create op from another builder than rewriter in rewrite patterns. It will cause problem if the rewriter later decide this transformation should not happen. I'm not sure there is an easy way to reproduce it.

Could we use rewriter.inlineRegionBefore instead? I think something like that would work instead:

rewriter.eraseBlock(newTiledLoop.getBody());
rewriter.inlineRegionBefore(tiledLoop.region(), newTiledLoop.region(),
                            newTiledLoop.region().end());

Operation* terminator = newTiledLoop.getBody()->getTerminator();
rewriter.setInsertionPoint(terminator);
rewriter.create<linalg::YieldOp>(loc, newYieldArgs);
rewriter.eraseOp(terminator);
This revision is now accepted and ready to land.Apr 23 2021, 11:01 AM

@ThomasRaoux Yes, this is dangerous, if the "inner" builder was created without rewriter.getListener() passed to it.

@ThomasRaoux Yes, this is dangerous, if the "inner" builder was created without rewriter.getListener() passed to it.

Ha missed that, you're right!

This revision was landed with ongoing or failed builds.Apr 23 2021, 11:55 AM
This revision was automatically updated to reflect the committed changes.