brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.5 KiB · 3d0f276 Raw
78 lines · plain
1// RUN: mlir-opt -verify-diagnostics %s | mlir-opt | FileCheck %s2 3// CHECK-LABEL: tloadstore4// CHECK:      %[[x:.*]] = amx.tile_load %{{.*}}[%{{.*}}], %{{.*}} :5// CHECK-SAME:   memref<?xbf16> into !amx.tile<16x32xbf16>6// CHECK:      %[[y:.*]] = amx.tile_load %{{.*}}[%{{.*}}, %{{.*}}], %{{.*}} :7// CHECK-SAME:   memref<?x?xbf16> into !amx.tile<16x32xbf16>8// CHECK:      %[[z:.*]] = amx.tile_load %{{.*}}[%{{.*}}, %{{.*}}] :9// CHECK-SAME:   memref<?x?xbf16, strided<[64, 1]>> into !amx.tile<16x32xbf16>10// CHECK:      amx.tile_store %{{.*}}[%{{.*}}], %[[z]], %{{.*}} :11// CHECK-SAME:   memref<?xbf16>, !amx.tile<16x32xbf16>12// CHECK:      amx.tile_store %{{.*}}[%{{.*}}, %{{.*}}], %[[x]], %{{.*}} :13// CHECK-SAME:   memref<?x?xbf16>, !amx.tile<16x32xbf16>14// CHECK:      amx.tile_store %{{.*}}[%{{.*}}, %{{.*}}], %[[y]] :15// CHECK-SAME:   memref<?x?xbf16, strided<[64, 1]>>, !amx.tile<16x32xbf16>16func.func @tloadstore(%stride: index,17    %arg0: memref<?xbf16>,18    %arg1: memref<?x?xbf16>,19    %arg2: memref<?x?xbf16, strided<[64, 1]>>) {20  %0 = arith.constant 0 : index21  %c64 = arith.constant 64 : index22  %1 = amx.tile_load %arg0[%0], %stride : memref<?xbf16> into !amx.tile<16x32xbf16>23  %2 = amx.tile_load %arg1[%0, %0], %stride : memref<?x?xbf16> into !amx.tile<16x32xbf16>24  %3 = amx.tile_load %arg2[%0, %0] : memref<?x?xbf16, strided<[64, 1]>> into !amx.tile<16x32xbf16>25  amx.tile_store %arg0[%0], %3, %stride : memref<?xbf16>, !amx.tile<16x32xbf16>26  amx.tile_store %arg1[%0, %0], %1, %stride : memref<?x?xbf16>, !amx.tile<16x32xbf16>27  amx.tile_store %arg2[%0, %0], %2 : memref<?x?xbf16, strided<[64, 1]>>, !amx.tile<16x32xbf16>28  return29}30 31// CHECK-LABEL: tzero32// CHECK: amx.tile_zero : !amx.tile<16x16xbf16>33// CHECK: amx.tile_store %{{.*}}[%{{.*}}, %{{.*}}], %{{.*}} : memref<?x?xbf16>, !amx.tile<16x16xbf16>34func.func @tzero(%arg0: memref<?x?xbf16>) {35  %0 = arith.constant 0 : index36  %1 = amx.tile_zero : !amx.tile<16x16xbf16>37  amx.tile_store %arg0[%0, %0], %1 : memref<?x?xbf16>, !amx.tile<16x16xbf16>38  return39}40 41// CHECK-LABEL: tmulf42// CHECK: %[[x:.*]] = amx.tile_load %{{.*}}[%{{.*}}, %{{.*}}] : memref<?x?xbf16> into !amx.tile<16x32xbf16>43// CHECK: %[[z:.*]] = amx.tile_load %{{.*}}[%{{.*}}, %{{.*}}] : memref<?x?xf32> into !amx.tile<16x16xf32>44// CHECK: %[[m:.*]] = amx.tile_mulf %[[x]], %[[x]], %[[z]] : !amx.tile<16x32xbf16>, !amx.tile<16x32xbf16>, !amx.tile<16x16xf32>45// CHECK: amx.tile_store %{{.*}}[%{{.*}}, %{{.*}}], %[[m]] : memref<?x?xf32>, !amx.tile<16x16xf32>46func.func @tmulf(%arg0: memref<?x?xbf16>, %arg1: memref<?x?xf32>) {47  %0 = arith.constant 0 : index48  %1 = amx.tile_load %arg0[%0, %0] : memref<?x?xbf16> into !amx.tile<16x32xbf16>49  %2 = amx.tile_load %arg1[%0, %0] : memref<?x?xf32> into !amx.tile<16x16xf32>50  %3 = amx.tile_mulf %1, %1, %2 : !amx.tile<16x32xbf16>, !amx.tile<16x32xbf16>, !amx.tile<16x16xf32>51  amx.tile_store %arg1[%0, %0], %3 : memref<?x?xf32>, !amx.tile<16x16xf32>52  return53}54 55// CHECK-LABEL: tmuli56// CHECK: %[[x:.*]] = amx.tile_load %{{.*}}[%{{.*}}, %{{.*}}] : memref<?x?xi8> into !amx.tile<16x64xi8>57// CHECK: %[[y:.*]] = amx.tile_load %{{.*}}[%{{.*}}, %{{.*}}] : memref<?x?xi8> into !amx.tile<16x64xi8>58// CHECK: %[[z:.*]] = amx.tile_load %{{.*}}[%{{.*}}, %{{.*}}] : memref<?x?xi32> into !amx.tile<16x16xi32>59// CHECK: %[[m:.*]] = amx.tile_muli %[[x]] zext, %[[y]] zext, %[[z]] : !amx.tile<16x64xi8>, !amx.tile<16x64xi8>, !amx.tile<16x16xi32>60// CHECK: amx.tile_store %{{.*}}[%{{.*}}, %{{.*}}], %[[m]] : memref<?x?xi32>, !amx.tile<16x16xi32>61// Verify the parsing/printing of the sign-extension annotation.62// CHECK: amx.tile_muli %{{.*}}, %{{.*}} zext, %{{.*}}63// CHECK: amx.tile_muli %{{.*}} zext, %{{.*}}, %{{.*}}64// CHECK: amx.tile_muli %{{.*}}, %{{.*}}, %{{.*}}65func.func @tmuli(%arg0: memref<?x?xi8>, %arg1: memref<?x?xi8>, %arg2: memref<?x?xi32>) {66  %0 = arith.constant 0 : index67  %1 = amx.tile_load %arg0[%0, %0] : memref<?x?xi8> into !amx.tile<16x64xi8>68  %2 = amx.tile_load %arg1[%0, %0] : memref<?x?xi8> into !amx.tile<16x64xi8>69  %3 = amx.tile_load %arg2[%0, %0] : memref<?x?xi32> into !amx.tile<16x16xi32>70  %4 = amx.tile_muli %1 zext, %2 zext, %3 : !amx.tile<16x64xi8>, !amx.tile<16x64xi8>, !amx.tile<16x16xi32>71  amx.tile_store %arg2[%0, %0], %4 : memref<?x?xi32>, !amx.tile<16x16xi32>72  // Verify the various `zext` combinations.73  %5 = amx.tile_muli %1, %2 zext, %3 : !amx.tile<16x64xi8>, !amx.tile<16x64xi8>, !amx.tile<16x16xi32>74  %6 = amx.tile_muli %1 zext, %2, %3 : !amx.tile<16x64xi8>, !amx.tile<16x64xi8>, !amx.tile<16x16xi32>75  %7 = amx.tile_muli %1, %2, %3 : !amx.tile<16x64xi8>, !amx.tile<16x64xi8>, !amx.tile<16x16xi32>76  return77}78