This is an archive of the discontinued LLVM Phabricator instance.

[mlir] Avoid cloning ops in SCF parallel conversion to CFG
ClosedPublic

Authored by ftynse on Nov 23 2020, 4:23 AM.

Details

Summary

The existing implementation of the conversion from SCF Parallel operation to
SCF "for" loops in order to further convert those loops to branch-based CFG has
been cloning the loop and reduction body operations into the new loop because
ConversionPatternRewriter was missing support for moving blocks while replacing
their arguments. This functionality now available, use it to implement the
conversion and avoid cloning operations, which may lead to doubling of the IR
size during the conversion.

In addition, this fixes an issue with converting nested SCF "if" conditionals
present in "parallel" operations that would cause the conversion infrastructure
to stop because of the repeated application of the pattern converting "newly"
created "if"s (which were in fact just moved). Arguably, this should be fixed
at the infrastructure level and this fix is a workaround.

Diff Detail

Event Timeline

ftynse created this revision.Nov 23 2020, 4:23 AM
ftynse requested review of this revision.Nov 23 2020, 4:23 AM
herhut accepted this revision.Nov 23 2020, 4:51 AM

Thank you!

This revision is now accepted and ready to land.Nov 23 2020, 4:51 AM
This revision was automatically updated to reflect the committed changes.