This commit addresses the issue of lowering affine.for and affine.parallel having return values. Relevant test cases are also added.
Signed-off-by: Prateek Gupta <prateek@polymagelabs.com>
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Unit Tests
| Time | Test | |
|---|---|---|
| 260 ms | x64 windows > LLVM.CodeGen/XCore::threads.ll |
Event Timeline
Thanks for working on this! Just some minor comments from my side, some of them unrelated to the patch, for my understanding :)
| mlir/lib/Conversion/AffineToStandard/AffineToStandard.cpp | ||
|---|---|---|
| 368 | value of identity value -> identity value? | |
| 384 | Wouldn't this return be unreachable? | |
| 467 | nit: please, compute the upper bound only once: for (unsigned i = 0, end = reductions.size(); i < end... | |
| mlir/test/Conversion/AffineToStandard/lower-affine.mlir | ||
| 34 | Unrelated question: is affine analysis able to reason about reductions in this form? I remember a discussion about using mem2reg <--> reg2mem. Has there been any progress on that from? | |
| 51 | Sorry, a bit unrelated but, while at this... Could we modernize this code and add the special string // ----- for separation and enable -split-input-file? | |
First update referring to the comments. Corrected the Optional arguments issue. Also fixed minor issues related to code comments and other optimizations.
| mlir/lib/Conversion/AffineToStandard/AffineToStandard.cpp | ||
|---|---|---|
| 384 | Changed the Optional arguments. | |
Mostly minor comments.
| mlir/lib/Conversion/AffineToStandard/AffineToStandard.cpp | ||
|---|---|---|
| 387–388 | Nit: This comment could be made more accurate. Return the value obtained by applying the reduction operation kind associated with a binary AtomicRMWKind op` to lhs and rhs` | |
| 457 | Nit: Operation -> operation | |
| 462 | Use /* ... =*/nullptr for the last argument. | |
| 464 | Rephrase -> "Copy the body of the affine.parallel op"? | |
| 472 | You don't need mlir::. | |
| 481 | Nit: resultReduction -> reductionResult ? | |
| mlir/test/Conversion/AffineToStandard/lower-affine.mlir | ||
| 34 | UNRELATED: Not really. The affine passes haven't been reviewed to handle reduction values where appropriate. | |
| 51 | This I suspect may require some non-trivial updates to the test cases. Let's do this in an NFC patch to not confuse this history. | |
| 706 | These test cases don't have return values. I assume you just added them for additional safety so that the changes don't break these cases? | |
| mlir/test/Conversion/AffineToStandard/lower-affine.mlir | ||
|---|---|---|
| 706 | Yes! | |
value of identity value -> identity value?
a Atomic -> an Atomic?