This is an archive of the discontinued LLVM Phabricator instance.

[mlir][Affine] Revisit and simplify composeAffineMapAndOperands.
ClosedPublic

Authored by nicolasvasilache on Jan 18 2021, 10:09 AM.

Details

Summary

In prehistorical times, AffineApplyOp was allowed to produce multiple values.
This allowed the creation of intricate SSA use-def chains.
AffineApplyNormalizer was originally introduced as a means of reusing the AffineMap::compose method to write SSA use-def chains.
Unfortunately, symbols that were produced by an AffineApplyOp needed to be promoted to dims and reordered for the mathematical composition to be valid.

Since then, single result AffineApplyOp became the law of the land but the original assumptions were not revisited.

This revision revisits these assumptions and retires AffineApplyNormalizer.

Diff Detail

Event Timeline

nicolasvasilache requested review of this revision.Jan 18 2021, 10:09 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 18 2021, 10:09 AM
ThomasRaoux accepted this revision.Jan 18 2021, 9:33 PM

Thanks @nicolasvasilache! I'm don't know this code in details but the changes look like a great clean up to me.

mlir/lib/Dialect/Affine/IR/AffineOps.cpp
1771

nit: are all those formatting changes intended? It looks like the previous code was fitting in 80 col?

This revision is now accepted and ready to land.Jan 18 2021, 9:33 PM
ftynse accepted this revision.Jan 19 2021, 1:00 AM
ftynse added inline comments.
mlir/lib/Dialect/Affine/IR/AffineOps.cpp
578

LogicalResult

623–630

Nit: some top-level doc?

624

Nit: why pointer rather than reference?

664

This compares actual underlying vectors. Does not seem to be a correctness problems because dim/symbol expressions are unique, but probably less efficient. How about comparing pointers instead?

nicolasvasilache marked 5 inline comments as done.

Address.

mlir/lib/Dialect/Affine/IR/AffineOps.cpp
624

prehistoric API, not looking to change it in this CL ..

1771

def not intentional .. sigh internal tooling..

This revision was landed with ongoing or failed builds.Jan 19 2021, 5:56 AM
This revision was automatically updated to reflect the committed changes.
mlir/lib/IR/AffineMap.cpp