38 lines · plain
1// RUN: mlir-opt %s -generate-runtime-verification \2// RUN: -expand-strided-metadata \3// RUN: -test-cf-assert \4// RUN: -convert-to-llvm | \5// RUN: mlir-runner -e main -entry-point-result=void \6// RUN: -shared-libs=%mlir_runner_utils 2>&1 | \7// RUN: FileCheck %s8 9// RUN: mlir-opt %s -generate-runtime-verification \10// RUN: -expand-strided-metadata \11// RUN: -test-cf-assert \12// RUN: -convert-to-llvm="allow-pattern-rollback=0" \13// RUN: -reconcile-unrealized-casts | \14// RUN: mlir-runner -e main -entry-point-result=void \15// RUN: -shared-libs=%mlir_runner_utils 2>&1 | \16// RUN: FileCheck %s17 18// Put memref.copy in a function, otherwise the memref.cast may fold.19func.func @memcpy_helper(%src: memref<?xf32>, %dest: memref<?xf32>) {20 memref.copy %src, %dest : memref<?xf32> to memref<?xf32>21 return22}23 24func.func @main() {25 %alloca1 = memref.alloca() : memref<4xf32>26 %alloca2 = memref.alloca() : memref<5xf32>27 %cast1 = memref.cast %alloca1 : memref<4xf32> to memref<?xf32>28 %cast2 = memref.cast %alloca2 : memref<5xf32> to memref<?xf32>29 30 // CHECK: ERROR: Runtime op verification failed31 // CHECK-NEXT: memref.copy %{{.*}}, %{{.*}} : memref<?xf32> to memref<?xf32>32 // CHECK-NEXT: ^ size of 0-th source/target dim does not match33 // CHECK-NEXT: Location: loc({{.*}})34 call @memcpy_helper(%cast1, %cast2) : (memref<?xf32>, memref<?xf32>) -> ()35 36 return37}38