It is to use the methods in LinalgInterfaces.cpp for additional static shape verification to match the shaped operands and loop on linalgOps. If I used the existing methods, I would face circular dependency linking issue. Now we can use them as methods of LinalgOp.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Unit Tests
Time | Test | |
---|---|---|
50 ms | x64 debian > Flang.Semantics::resolve102.f90 |
Event Timeline
Please provide a rationale for making this change in the commit description. Why is it necessary? Is there any op that will customize the behavior and why can't it do so by overloading the functions instead?
Inho is going to add static shape verification for Linalg structured ops. E.g., verify if the shapes match the loops for conv op. He is going to use these methods in the change. To reuse methods in
verifyStructuredOpInterface, we have to move methods out of Utils.h. Otherwise, there will be circular dependency. We already have some similar interface methods like getShapesToLoopsMap, etc. I think it makes sense to move static version to interface methods.
Inho, could you provide more context to commit description and fix the title? Please also fix the build.
The below link has an overview of writing a good change descriptions, please take a look: https://google.github.io/eng-practices/review/developer/cl-descriptions.html
mlir/include/mlir/Dialect/Linalg/IR/LinalgInterfaces.td | ||
---|---|---|
197–234 | I think they are not for "loop types handling". Maybe move them to "Linalg generalization hooks."? |
- Updating D98163: #Enter a commit message. # Moved fectored getStaticLoopRanges and getStaticShape methods to LinalgInterfaces.td #
- Enter a brief description of the changes included in this update.
- The first line is used as subject, next lines as comment.
Moved getStaticShape and getStaticLoopRanges method to Linalg Generlization Hooks part.n LinalgInterfaces.td
This is to use these methods in LinalgInterfaces.cpp for additional static shape verification to match the shapes and loops. If I used existing methods, circular dependency issue happened. Now we can use the methods with linalgOp.getStaticLoopRanges().
Sorry for confusing commit message. It was my first change request here, so the interface was not familiar for me. I didn't know how to update the revision at the moment, now I updated it.
Thanks
mlir/include/mlir/Dialect/Linalg/IR/LinalgInterfaces.td | ||
---|---|---|
197–234 | I moved it, could you look at it again? |
mlir/include/mlir/Dialect/Linalg/IR/LinalgInterfaces.td | ||
---|---|---|
1129 | Let's follow other places -- adding a blank line right before the comment. | |
1132 | Please also update the comment. In the past, we did return -1 which indicated to dynamic dim. Now we have ShapeType::kDynamicSize, so let's use it in the comment instead. | |
1139–1145 | Do we need to get the operation and cast to LinalgOp? I thought getShapedOperands is a class method which can be access directly? | |
1152 | ditto | |
1160 | ditto |
- Updating D98163: Moved getStaticLoopRanges and getStaticShape methods to LinalgInterfaces.td to add static shape verification #
- Enter a brief description of the changes included in this update.
- The first line is used as subject, next lines as comment.
Reflected request changes
mlir/include/mlir/Dialect/Linalg/IR/LinalgInterfaces.td | ||
---|---|---|
1139–1145 | Oh right, I had to check it beforehand,, thanks. And also I think linalgOp is not used in getStaticLoopRanges method, so I removed it. |
mlir/include/mlir/Dialect/Linalg/IR/LinalgInterfaces.td | ||
---|---|---|
1113 | I think this -1 should also be ShapeType::kDynamicSize? |
- Updating D98163: Moved getStaticLoopRanges and getStaticShape methods to LinalgInterfaces.td to add static shape verification #
- Enter a brief description of the changes included in this update.
- The first line is used as subject, next lines as comment
Changed -1 to ShapedType::kDynamicSize in comment
mlir/include/mlir/Dialect/Linalg/IR/LinalgInterfaces.td | ||
---|---|---|
1113–1114 | It is too long, we have to format it a bit. Returns the statically-known loop ranges. Composes `getShapesToLoopsMap()` with the result of `getStaticShape`. Returns None if `getShapesToLoopsMap()` fails. Returns ShapeType::kDynamicSize for non-statically-known loop ranges. |
- Updating D98163: Moved getStaticLoopRanges and getStaticShape methods to LinalgInterfaces.td to add static shape verification #
- Enter a brief description of the changes included in this update.
- The first line is used as subject, next lines as comment.
reformating
- Updating D98163: Moved getStaticLoopRanges and getStaticShape methods to LinalgInterfaces.td to add static shape verification #
- Enter a brief description of the changes included in this update.
- The first line is used as subject, next lines as comment.
Reverted the test file
I think they are not for "loop types handling". Maybe move them to "Linalg generalization hooks."?