This is an archive of the discontinued LLVM Phabricator instance.

[MLIR] Fix affine analysis methods for affine.parallel
ClosedPublic

Authored by bondhugula on Jan 8 2023, 10:04 PM.

Details

Summary

Drop unnecessary bailout in checkMemRefAccessDependence in the presence of
surrounding affine.parallel ops. When the affine.parallel op was added, affine
analysis methods weren't extended to account for it. Fix this and allow memref
dependence check to work in the presence of affine.parallel ops in the mix.

Rename isForInductionVar -> isAffineForInductionVar, getLoopIVs ->
getAffineForIVs to avoid confusion since that's what they were.

Diff Detail

Event Timeline

bondhugula created this revision.Jan 8 2023, 10:04 PM
bondhugula requested review of this revision.Jan 8 2023, 10:04 PM

Drop unrelated NFC.

Lewuathe accepted this revision.Jan 9 2023, 10:58 PM
Lewuathe added inline comments.
mlir/test/Transforms/memref-dependence-check.mlir
1068–1069

nit: The function name should be like dependent_parallel or something like that.

This revision is now accepted and ready to land.Jan 9 2023, 10:58 PM
bondhugula marked an inline comment as done.

Update test case func name.

mlir/test/Transforms/memref-dependence-check.mlir
1068–1069

Thanks for noticing, done.

This revision was landed with ongoing or failed builds.Jan 11 2023, 10:17 PM
This revision was automatically updated to reflect the committed changes.

The test coverage for the addition of an affine.parallel does not seem enough to me. Could you please add tests for cases with more than 1 induction vars in affine.parallel?

mlir/lib/Dialect/Affine/Analysis/AffineAnalysis.cpp
308–313

If a affine.parallel has multiple induction variables, is the operation counted multiple times? The expected behavior is non-obvious to me and should be documented according to me.