Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Unit Tests
Event Timeline
@jpienaar Jacques, I put this pattern to Transform directory, because I am not really converting Shape Ops inside the reduction operator. The only thing that changes here is just the reduce op "expanded" as a loop.
I am also not completely happy with how I named the pass. So, suggestions are very-very welcome.
| mlir/include/mlir/Dialect/Shape/Transforms/Passes.td | ||
|---|---|---|
| 19 | All dialects share the same "namespace" of pass names, so I recommend calling it shape-* to avoid naming conflicts with other dialect passes. Also, lower-reduce-to-scf and lower-shape-to-shape would be my name preferences so it is consistent at a glance what are lowering passes. | |
| mlir/lib/Dialect/Shape/Transforms/ExpandReduce.cpp | ||
| 41 ↗ | (On Diff #270237) | llvm naming convention is extentTensor |
| 52 ↗ | (On Diff #270237) | should this use b instead of rewriter? |
| 57 ↗ | (On Diff #270237) | can you use mlir::inlineRegion for this? |
| mlir/lib/Dialect/Shape/Transforms/ExpandReduce.cpp | ||
|---|---|---|
| 57 ↗ | (On Diff #270237) | I am not sure that would look nicer since I need to convert shape.yield to scf.yield after inlining. Also blocks have different signatures. I would prefer to leave it as it is. |
Nice to see this become a thing!
| mlir/lib/Dialect/Shape/Transforms/ShapeToSCFLowering.cpp | ||
|---|---|---|
| 1 | Should this live in Conversion/ShapeToSCF? Only transformations within a dialect are in transforms IIUC. | |
| 46 | This should be dim %extent, 0 and not rank. The rank of the extent tensor is always 1 (as it is a vector). | |
| 62 | clone with a mapping already does this for you. | |
| 65 | Can this be done with makeArrayRef? | |
| mlir/lib/Dialect/Shape/Transforms/ShapeToSCFLowering.cpp | ||
|---|---|---|
| 1 | Yes, and it should not be called "lowering". That name was deprecated long time ago. | |
| mlir/lib/Dialect/Shape/Transforms/ShapeToSCFLowering.cpp | ||
|---|---|---|
| 1 | Can you update the docs https://mlir.llvm.org/getting_started/Glossary/#lowering ? I was not aware of that deprecation. | |
| mlir/lib/Dialect/Shape/Transforms/ShapeToSCFLowering.cpp | ||
|---|---|---|
| 65 | if we could lookup arrays of values, then yes. | |
| mlir/include/mlir/Conversion/ShapeToSCF/ShapeToSCF.h | ||
|---|---|---|
| 14 ↗ | (On Diff #270754) | If I remember correctly, the using namespace mlir variant is preferred in LLVM. |
Neat!
| mlir/include/mlir/Conversion/ShapeToSCF/ShapeToSCF.h | ||
|---|---|---|
| 14 ↗ | (On Diff #270754) | Only for uses, not definitions. |
All dialects share the same "namespace" of pass names, so I recommend calling it shape-* to avoid naming conflicts with other dialect passes.
Also, lower-reduce-to-scf and lower-shape-to-shape would be my name preferences so it is consistent at a glance what are lowering passes.