brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.5 KiB · 499db4c Raw
34 lines · plain
1// RUN: mlir-opt %s -transform-interpreter -split-input-file -verify-diagnostics2 3func.func @non_elementwise(%arg0: memref<2x3xf32>, %arg1: memref<3x4xf32>, %arg2: memref<2x4xf32>) {4  // expected-error @below {{only elementwise flattening is supported}}5  linalg.matmul ins(%arg0, %arg1 : memref<2x3xf32>, memref<3x4xf32>) outs(%arg2: memref<2x4xf32>)6  return7}8 9module attributes {transform.with_named_sequence} {10  transform.named_sequence @__transform_main(%arg1: !transform.any_op {transform.readonly}) {11    %0 = transform.structured.match interface{LinalgOp} in %arg1 : (!transform.any_op) -> !transform.any_op12    %flattened = transform.structured.flatten_elementwise %013      : (!transform.any_op) -> !transform.any_op14    transform.yield15  }16}17 18// -----19 20func.func @unsupported_memref(%arg0: memref<32x7xf32, strided<[7, 2]>>, %arg1: memref<32x7xf32, strided<[7, 2]>>, %arg2: memref<32x7xf32, strided<[7, 2]>>) {21  // expected-error @below {{attempted to flatten, but failed}}22    linalg.map {arith.addf} ins(%arg0, %arg1: memref<32x7xf32, strided<[7, 2]>>, memref<32x7xf32, strided<[7, 2]>>) outs(%arg2: memref<32x7xf32, strided<[7, 2]>>)23    return24}25 26module attributes {transform.with_named_sequence} {27  transform.named_sequence @__transform_main(%arg1: !transform.any_op {transform.readonly}) {28    %0 = transform.structured.match interface{LinalgOp} in %arg1 : (!transform.any_op) -> !transform.any_op29    %flattened = transform.structured.flatten_elementwise %030      : (!transform.any_op) -> !transform.any_op31    transform.yield32  }33}34