We allow the omission of a map in memref.reinterpret_cast under the assumption, that the cast might cast to an identity layout. This change adds verification that the static knowledge that is present in the reinterpret_cast supports this assumption.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp | ||
---|---|---|
1166 | Can you just replace the condition by: if (isStrided(resultType)) ? |
mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp | ||
---|---|---|
1166 | Good point, I combined the two cases. I was not aware that getStridesAndOffset also works for identity maps. But of course it needs to. |
Nice cleanup!
mlir/test/mlir-cpu-runner/copy.mlir | ||
---|---|---|
38–40 | This looks pretty dangerous. |
Side note: I think we could also drop memref.view and just use this instead.
This would be a good starter task.
mlir/test/Dialect/MemRef/canonicalize.mlir | ||
---|---|---|
154 | doesn't this fundamentally break the ability to do the "stride-0" trick? |
Thanks!
mlir/test/Dialect/MemRef/canonicalize.mlir | ||
---|---|---|
154 | We never do the stride-0 trick in the static case, so the 0 is always a dynamic value. Because we cannot express the static case properly. It would require an affine map with a 0 constant (otherwise the type is a lie). The stride-0 trick if fishy anyway and we need to move away from it. | |
mlir/test/mlir-cpu-runner/copy.mlir | ||
38–40 | I prefer this form, as it makes it explicit what strides we have. This is just to test that the copy honors that information. |
Can you just replace the condition by: if (isStrided(resultType)) ?