Verify unranked -> ranked casts and casts of dynamic sizes/offset/strides to static ones.
Depends On D138647
Paths
| Differential D138671
[mlir][memref] Add runtime verification for memref::CastOp ClosedPublic Authored by springerm on Nov 24 2022, 7:12 AM.
Details Summary Verify unranked -> ranked casts and casts of dynamic sizes/offset/strides to static ones. Depends On D138647
Diff Detail
Event Timelinespringerm added a child revision: D138775: [mlir] Support SSA values in runtime op verification errors.Nov 28 2022, 12:08 AM Comment Actions Looks good to me. But can we add more tests. For example, the case below, here c2 should be verified by your code but c3 should fail, right? func.func @c1(%m: memref<?x?xf32>) -> memref<*xf32> { %0 = memref.cast %m : memref<?x?xf32> to memref<*xf32> return %0 : memref<*xf32> } func.func @c2(%m: memref<*xf32>) -> memref<?x?xf32> { %0 = memref.cast %m : memref<*xf32> to memref<?x?xf32> return %0 : memref<?x?xf32> } func.func @c3(%m: memref<*xf32>) -> memref<?xf32> { %0 = memref.cast %m : memref<*xf32> to memref<?xf32> return %0 : memref<?xf32> } func.func @main() { %a = memref.alloc() : memref<5x5xf32> %c = memref.cast %a : memref<5x5xf32> to memref<?x?xf32> %res = func.call @c1(%c) : (memref<?x?xf32>) -> memref<*xf32> func.call @c2(%res) : (memref<*xf32>) -> (memref<?x?xf32>) func.call @c3(%res) : (memref<*xf32>) -> (memref<?xf32>) return } Also, runtime error text does not tell me which code/location fails. It prints the following text for example. I am not sure you can print the location correctly, but can we at least print the problematic IR? This revision is now accepted and ready to land.Jan 6 2023, 5:32 AM This revision was landed with ongoing or failed builds.Jan 6 2023, 5:39 AM Closed by commit rG5eee80ce5ef0: [mlir][memref] Add runtime verification for memref::CastOp (authored by springerm). · Explain Why This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 480028 mlir/lib/Dialect/MemRef/Transforms/RuntimeOpVerification.cpp
mlir/test/Dialect/MemRef/runtime-verification.mlir
mlir/test/Integration/Dialect/Memref/cast-runtime-verification.mlir
|