159 lines · plain
1// RUN: mlir-opt %s -split-input-file -verify-diagnostics2 3func.func @tile_row_height() {4 // expected-error@+1 {{'amx.tile_zero' op bad row height: 17}}5 %0 = amx.tile_zero : !amx.tile<17x16xbf16>6 return7}8 9// -----10 11func.func @tile_col_width() {12 // expected-error@+1 {{'amx.tile_zero' op bad column width: 65}}13 %0 = amx.tile_zero : !amx.tile<16x65xi8>14 return15}16 17// -----18 19func.func @tile_element_type() {20 // expected-error@+1 {{failed to verify 'elementType'}}21 %0 = amx.tile_zero : !amx.tile<8x8xi16>22 return23}24 25// -----26 27func.func @tile_rank() {28 // expected-error@+1 {{'amx.tile_zero' op result #0 must be tile of}}29 %0 = amx.tile_zero : !amx.tile<32xi8>30 return31}32 33// -----34 35func.func @tile_col_4_byte_multiple() {36 // expected-error@+1 {{'amx.tile_zero' op bad column width: 5}}37 %0 = amx.tile_zero : !amx.tile<16x5xi8>38 return39}40 41// -----42 43func.func @load_base_tile_size(%arg0: memref<?x?xf32>) {44 %0 = arith.constant 0 : index45 // expected-error@+1 {{'amx.tile_load' op bad column width: 68}}46 %1 = amx.tile_load %arg0[%0, %0] : memref<?x?xf32> into !amx.tile<16x17xf32>47 return48}49 50// -----51 52func.func @store_base_tile_size(%arg0: memref<?x?xf32>, %arg1: !amx.tile<16x17xf32>) {53 %0 = arith.constant 0 : index54 // expected-error@+1 {{'amx.tile_store' op bad column width: 68}}55 amx.tile_store %arg0[%0, %0], %arg1 : memref<?x?xf32>, !amx.tile<16x17xf32>56 return57}58 59// -----60 61func.func @load_base_index_size(%arg0: memref<?x?xf32>) {62 %0 = arith.constant 0 : index63 // expected-error@+1 {{'amx.tile_load' op requires 2 indices}}64 %1 = amx.tile_load %arg0[%0] : memref<?x?xf32> into !amx.tile<16x16xf32>65 return66}67 68// -----69 70func.func @store_base_index_size(%arg0: memref<?x?xf32>, %arg1: !amx.tile<16x16xf32>) {71 %0 = arith.constant 0 : index72 // expected-error@+1 {{'amx.tile_store' op requires 2 indices}}73 amx.tile_store %arg0[%0], %arg1 : memref<?x?xf32>, !amx.tile<16x16xf32>74 return75}76 77// -----78 79func.func @load_base_rank(%arg0: memref<?xf32>) {80 %0 = arith.constant 0 : index81 // expected-error@+1 {{'amx.tile_load' op requires at least 2D memref}}82 %1 = amx.tile_load %arg0[%0] : memref<?xf32> into !amx.tile<16x16xf32>83 return84}85 86// -----87 88func.func @store_base_rank(%arg0: memref<?xf32>, %arg1: !amx.tile<16x16xf32>) {89 %0 = arith.constant 0 : index90 // expected-error@+1 {{'amx.tile_store' op requires at least 2D memref}}91 amx.tile_store %arg0[%0], %arg1 : memref<?xf32>, !amx.tile<16x16xf32>92 return93}94 95// -----96 97func.func @load_base_non_unit_stride(%arg0: memref<?x?xf32, strided<[?, ?]>>) {98 %0 = arith.constant 0 : index99 // expected-error@+1 {{'amx.tile_load' op requires memref with unit innermost stride}}100 %1 = amx.tile_load %arg0[%0, %0]101 : memref<?x?xf32, strided<[?, ?]>> into !amx.tile<16x16xf32>102 return103}104 105// -----106 107func.func @store_base_non_unit_stride(%arg0: memref<?x?xf32, strided<[?, ?]>>,108 %arg1: !amx.tile<16x16xf32>) {109 %0 = arith.constant 0 : index110 // expected-error@+1 {{'amx.tile_store' op requires memref with unit innermost stride}}111 amx.tile_store %arg0[%0, %0], %arg1112 : memref<?x?xf32, strided<[?, ?]>>, !amx.tile<16x16xf32>113 return114}115 116// -----117 118func.func @mulf_shape() {119 %0 = amx.tile_zero : !amx.tile<8x8xbf16>120 %1 = amx.tile_zero : !amx.tile<8x8xbf16>121 %2 = amx.tile_zero : !amx.tile<4x4xf32>122 // expected-error@+1 {{'amx.tile_mulf' op bad mult shape: 4 x 4 x 4}}123 %3 = amx.tile_mulf %0, %1, %2 : !amx.tile<8x8xbf16>, !amx.tile<8x8xbf16>, !amx.tile<4x4xf32>124 return125}126 127// -----128 129func.func @mulf_type_combination() {130 %0 = amx.tile_zero : !amx.tile<8x8xbf16>131 %1 = amx.tile_zero : !amx.tile<4x8xf16>132 %2 = amx.tile_zero : !amx.tile<8x4xf32>133 // expected-error@+1 {{'amx.tile_mulf' op unsupported type combination}}134 %3 = amx.tile_mulf %0, %1, %2 : !amx.tile<8x8xbf16>, !amx.tile<4x8xf16>, !amx.tile<8x4xf32>135 return136}137 138// -----139 140func.func @muli_shape() {141 %0 = amx.tile_zero : !amx.tile<8x8xi8>142 %1 = amx.tile_zero : !amx.tile<8x8xi8>143 %2 = amx.tile_zero : !amx.tile<4x4xi32>144 // expected-error@+1 {{'amx.tile_muli' op bad mult shape: 4 x 4 x 2}}145 %3 = amx.tile_muli %0, %1, %2 : !amx.tile<8x8xi8>, !amx.tile<8x8xi8>, !amx.tile<4x4xi32>146 return147}148 149// -----150 151func.func @muli_type_combination() {152 %0 = amx.tile_zero : !amx.tile<8x16xi8>153 %1 = amx.tile_zero : !amx.tile<8x16xi32>154 %2 = amx.tile_zero : !amx.tile<2x2xi32>155 // expected-error@+1 {{'amx.tile_muli' op operand #1 must be tile of 8-bit signless integer values}}156 %3 = amx.tile_muli %0, %1, %2 : !amx.tile<8x16xi8>, !amx.tile<8x16xi32>, !amx.tile<2x2xi32>157 return158}159