Memrefs with affine_map in the results of normalizable operation were
not normalized by --normalize-memrefs option. This patch normalizes
them.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
@bondhugula @avarmapml I found the results(returend memref) of normalizable operation were not normalized by --normalize-memrefs.
In test case, %1 was not normalized. This patch fixes it.
%1 = "test.op_norm_ret"(%arg0, %arg1) : (memref<1x32768xf32>, memref<1x16x14x14xf32, #map1>) -> (memref<1x16x14x14xf32, #map1>)
Could you review this patch?
Hi @imaihal, thank you for this patch.
The function normalizeFuncOpMemRefs has become quite long and I believe it'd be better to split the logic into modular sub-functions.
AllocOps, function arguments, result types, and external functions are being addressed within and maybe we can have separate functions for each of them.
Not sure if this change should go into this patch, maybe @bondhugula can say better.
mlir/lib/Transforms/NormalizeMemRefs.cpp | ||
---|---|---|
397 | Comment should be terminated with a full stop. |
mlir/lib/Transforms/NormalizeMemRefs.cpp | ||
---|---|---|
391–455 | This is a really long lambda. Please outline. |
Thanks for adding this support. Some minor comments. I'll be able to review post the refactoring.
mlir/lib/Transforms/NormalizeMemRefs.cpp | ||
---|---|---|
392 | You don't need dyn_cast here - !isa<CallOp>(op) will do. | |
mlir/test/Transforms/normalize-memrefs-ops.mlir | ||
95 | Nit: consider using map_tile. | |
mlir/test/lib/Dialect/Test/TestOps.td | ||
656 | -> ... of an op that has normalizable memref results. |
@bondhugula @avarmapml Thanks for your comments! I updated the code to reflect your comments. I moved part of code in the lambda to Util.cpp. Could you review again?
mlir/lib/Transforms/NormalizeMemRefs.cpp | ||
---|---|---|
391–455 | I moved part of the code to newly created function in Util.cpp. So, I think the lambda is not so long now. Also, I wrote comments about the outline at the top. | |
397 | I wrote comments more in newly created function in Util.cpp. |
mlir/include/mlir/Transforms/Utils.h | ||
---|---|---|
149–150 ↗ | (On Diff #296336) | This has just one user and functionality specific to normalize-memrefs. Why is it exposed? |
mlir/include/mlir/Transforms/Utils.h | ||
---|---|---|
149–150 ↗ | (On Diff #296336) | I moved the function to NormalizedMemrefs |
mlir/test/Transforms/normalize-memrefs-ops.mlir | ||
---|---|---|
99 | I also fixed other variables from [a-z0-9]* to .* in this file. |
@bondhugula Thanks for your review. I reflected your comments. Could you commit this patch if you don't have any other comments? I don't have commit access.
You don't need dyn_cast here - !isa<CallOp>(op) will do.