1// RUN: mlir-opt %s -enable-arm-streaming -verify-diagnostics | FileCheck %s 2// RUN: mlir-opt %s -enable-arm-streaming=streaming-mode=streaming-locally -verify-diagnostics | FileCheck %s -check-prefix=CHECK-LOCALLY 3// RUN: mlir-opt %s -enable-arm-streaming=streaming-mode=streaming-compatible -verify-diagnostics | FileCheck %s -check-prefix=CHECK-COMPATIBLE 4// RUN: mlir-opt %s -enable-arm-streaming=za-mode=new-za -verify-diagnostics | FileCheck %s -check-prefix=CHECK-ENABLE-ZA 5// RUN: mlir-opt %s -enable-arm-streaming=if-required-by-ops -verify-diagnostics | FileCheck %s -check-prefix=IF-REQUIRED 6// RUN: mlir-opt %s -enable-arm-streaming=if-scalable-and-supported -verify-diagnostics | FileCheck %s -check-prefix=IF-SCALABLE 7 8// CHECK-LABEL: @arm_streaming 9// CHECK-SAME: attributes {arm_streaming} 10// CHECK-LOCALLY-LABEL: @arm_streaming 11// CHECK-LOCALLY-SAME: attributes {arm_locally_streaming} 12// CHECK-COMPATIBLE-LABEL: @arm_streaming 13// CHECK-COMPATIBLE-SAME: attributes {arm_streaming_compatible} 14// CHECK-ENABLE-ZA-LABEL: @arm_streaming 15// CHECK-ENABLE-ZA-SAME: attributes {arm_new_za, arm_streaming} 16func.func @arm_streaming() { return } 17 18// CHECK-LABEL: @not_arm_streaming 19// CHECK-SAME: attributes {enable_arm_streaming_ignore} 20// CHECK-LOCALLY-LABEL: @not_arm_streaming 21// CHECK-LOCALLY-SAME: attributes {enable_arm_streaming_ignore} 22// CHECK-COMPATIBLE-LABEL: @not_arm_streaming 23// CHECK-COMPATIBLE-SAME: attributes {enable_arm_streaming_ignore} 24// CHECK-ENABLE-ZA-LABEL: @not_arm_streaming 25// CHECK-ENABLE-ZA-SAME: attributes {enable_arm_streaming_ignore} 26func.func @not_arm_streaming() attributes {enable_arm_streaming_ignore} { return } 27 28// CHECK-LABEL: @requires_arm_streaming 29// CHECK-SAME: attributes {arm_streaming} 30// IF-REQUIRED: @requires_arm_streaming 31// IF-REQUIRED-SAME: attributes {arm_streaming} 32func.func @requires_arm_streaming() { 33 %tile = arm_sme.get_tile : vector<[4]x[4]xi32> 34 return 35} 36 37// CHECK-LABEL: @does_not_require_arm_streaming 38// CHECK-SAME: attributes {arm_streaming} 39// IF-REQUIRED: @does_not_require_arm_streaming 40// IF-REQUIRED-NOT: arm_streaming 41func.func @does_not_require_arm_streaming() { return } 42 43// IF-SCALABLE-LABEL: @contains_scalable_vectors 44// IF-SCALABLE-SAME: attributes {arm_streaming} 45func.func @contains_scalable_vectors(%vec: vector<[4]xf32>) -> vector<[4]xf32> { 46 %0 = arith.addf %vec, %vec : vector<[4]xf32> 47 return %0 : vector<[4]xf32> 48} 49 50// IF-SCALABLE-LABEL: @no_scalable_vectors 51// IF-SCALABLE-NOT: arm_streaming 52func.func @no_scalable_vectors(%vec: vector<4xf32>) -> vector<4xf32> { 53 %0 = arith.addf %vec, %vec : vector<4xf32> 54 return %0 : vector<4xf32> 55} 56 57// IF-SCALABLE-LABEL: @contains_gather 58// IF-SCALABLE-NOT: arm_streaming 59func.func @contains_gather(%base: memref<?xf32>, %v: vector<[4]xindex>, %mask: vector<[4]xi1>, %pass_thru: vector<[4]xf32>) -> vector<[4]xf32> { 60 %c0 = arith.constant 0 : index 61 %0 = vector.gather %base[%c0][%v], %mask, %pass_thru : memref<?xf32>, vector<[4]xindex>, vector<[4]xi1>, vector<[4]xf32> into vector<[4]xf32> 62 return %0 : vector<[4]xf32> 63} 64 65// IF-SCALABLE-LABEL: @contains_scatter 66// IF-SCALABLE-NOT: arm_streaming 67func.func @contains_scatter(%base: memref<?xf32>, %v: vector<[4]xindex>,%mask: vector<[4]xi1>, %value: vector<[4]xf32>) 68{ 69 %c0 = arith.constant 0 : index 70 vector.scatter %base[%c0][%v], %mask, %value : memref<?xf32>, vector<[4]xindex>, vector<[4]xi1>, vector<[4]xf32> 71 return 72} 73