[MLIR] adding affine parallel conversion to scf parallel in lower affine pass
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
mlir/lib/Conversion/AffineToStandard/AffineToStandard.cpp | ||
---|---|---|
360 | Nit: use backticks instead of quotes. | |
370–385 | This is all lacking comments - please add some. | |
mlir/test/Conversion/AffineToStandard/lower-affine.mlir | ||
626–630 | The test cases are insufficient - please include one with non-trivial affine map bounds. |
mlir/lib/Conversion/AffineToStandard/AffineToStandard.cpp | ||
---|---|---|
377 | Please avoid names like step1. Also, avoid auto here. |
mlir/lib/Conversion/AffineToStandard/AffineToStandard.cpp | ||
---|---|---|
373 | Still not checking if expandAffineMap returns no value, here and below. |
mlir/test/Conversion/AffineToStandard/lower-affine.mlir | ||
---|---|---|
675 | No need to capture A5, it's unused. |
Can you please update the commit title to "[MLIR] Add lowering for affine.parallel to scf.parallel"? (Updating the commit via arc won't automatically update the title here - please hit edit here to update as well.)
Please address the comments before submitting.
@bondhugula, sorry, I thought this was relanding of a rolled back change
mlir/lib/Conversion/AffineToStandard/AffineToStandard.cpp | ||
---|---|---|
377 | Nit: upperBoundValue sounds like it's a _single_ value whereas is a vector of values. This got me confused down the line where the loop is created from upperBoundValue, lowerBoundValue (singular) and steps (plural). | |
382 | Please call steps.reserve before calling push_back in a loop when you know the number of elements to be inserted. | |
383–384 | Nit: would it be possible to construct a ConstantOp and pass it an attribute without extracting its value? Something like rewriter.create<ConstantOp>(loc, step)? Loop bounds are already of index type. | |
mlir/test/Conversion/AffineToStandard/lower-affine.mlir | ||
640 | +1. Also for @dot, I assumed it was a dot product. |
Renamed from dot to affine_parallel.
Renamed from lowerBoundValue to lowerBoundTuple to make it plural.
Used steps.reserve.
Not able to use rewriter.create<ConstantOp>(loc, step).
mlir/lib/Conversion/AffineToStandard/AffineToStandard.cpp | ||
---|---|---|
380 | Actually, do you expect it to never fail (it will fail on quasi-affine maps, for example)? Otherwise, you can just return failure() from the pattern. |
mlir/lib/Conversion/AffineToStandard/AffineToStandard.cpp | ||
---|---|---|
380 | Did you mean quasi-affine or semi-affine? expandAffineMap returns an Optional but doesn't document when it is expected to have a value nor is it obvious from either the declaration or even immediately from the implementation! Goes to show how important documentation is! Do you know who the author of this is - could we have the doc comment updated? Return values like these must be documented without fail. |
mlir/lib/Conversion/AffineToStandard/AffineToStandard.cpp | ||
---|---|---|
380 | In theory, we could expand any affine map, but I'm guessing semi-affine maps (where the RHS of the floordiv/ceildiv/mod is a symbol) are perhaps unsupported by expandAffineMap and so this would fail in those cases. So, for completeness sake, we should return failure for now and add a comment that in theory, it's always guaranteed to succeed if expandAffineMap is extended. |
mlir/test/Conversion/AffineToStandard/lower-affine.mlir | ||
---|---|---|
675 | Nit: You can drop the %{{.*}} as well. |
Nit: use backticks instead of quotes.