125 lines · plain
1// RUN: mlir-opt --split-input-file --verify-diagnostics %s | FileCheck %s2 3//===----------------------------------------------------------------------===//4// spirv.ARM.Graph and spirv.ARM.GraphOutputs5//===----------------------------------------------------------------------===//6 7// CHECK: spirv.ARM.Graph {{@.*}}({{%.*}}: !spirv.arm.tensor<14x19xi16>) -> !spirv.arm.tensor<14x19xi16> {8spirv.ARM.Graph @graphAndOutputs(%arg0: !spirv.arm.tensor<14x19xi16>) -> !spirv.arm.tensor<14x19xi16> {9 // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<14x19xi16>10 spirv.ARM.GraphOutputs %arg0 : !spirv.arm.tensor<14x19xi16>11}12 13// -----14 15//===----------------------------------------------------------------------===//16// spirv.ARM.GraphConstant17//===----------------------------------------------------------------------===//18 19// CHECK: spirv.ARM.Graph {{@.*}}() -> !spirv.arm.tensor<2x3xi16> {20spirv.ARM.Graph @graphConstant() -> !spirv.arm.tensor<2x3xi16> {21 // CHECK: [[CONST:%.*]] = spirv.ARM.GraphConstant {graph_constant_id = 42 : i32} : !spirv.arm.tensor<2x3xi16>22 %0 = spirv.ARM.GraphConstant { graph_constant_id = 42 : i32 } : !spirv.arm.tensor<2x3xi16>23 // CHECK: spirv.ARM.GraphOutputs [[CONST:%.*]] : !spirv.arm.tensor<2x3xi16>24 spirv.ARM.GraphOutputs %0 : !spirv.arm.tensor<2x3xi16>25}26// -----27 28//===----------------------------------------------------------------------===//29// spirv.ARM.GraphEntryPoint30//===----------------------------------------------------------------------===//31 32// CHECK: spirv.GlobalVariable [[VARARG0:@.*]] bind(0, 0) : !spirv.ptr<!spirv.arm.tensor<14x19xi16>, UniformConstant>33spirv.GlobalVariable @entrypoint_arg_0 bind(0, 0) : !spirv.ptr<!spirv.arm.tensor<14x19xi16>, UniformConstant>34// CHECK: spirv.GlobalVariable [[VARRES0:@.*]] bind(0, 1) : !spirv.ptr<!spirv.arm.tensor<14x19xi16>, UniformConstant>35spirv.GlobalVariable @entrypoint_res_0 bind(0, 1) : !spirv.ptr<!spirv.arm.tensor<14x19xi16>, UniformConstant>36// CHECK: spirv.ARM.GraphEntryPoint [[GN:@.*]], [[VARARG0]], [[VARRES0]]37spirv.ARM.GraphEntryPoint @entrypoint, @entrypoint_arg_0, @entrypoint_res_038 39// -----40 41//===----------------------------------------------------------------------===//42// spirv.ARM.Graph with no terminator43//===----------------------------------------------------------------------===//44 45// expected-error @+1 {{empty block: expect at least a terminator}}46spirv.ARM.Graph @graphNoterminator(%arg0: !spirv.arm.tensor<14x19xi16>) -> !spirv.arm.tensor<14x19xi16> {47}48 49// -----50 51//===----------------------------------------------------------------------===//52// spirv.ARM.Graph with no result types53//===----------------------------------------------------------------------===//54 55// expected-error @+1 {{'spirv.ARM.Graph' op there should be at least one result}}56spirv.ARM.Graph @graphNoOutputs(%arg0: !spirv.arm.tensor<14x19xi16>) -> () {57}58 59// -----60 61//===----------------------------------------------------------------------===//62// spirv.ARM.GraphConstant outside graph scope63//===----------------------------------------------------------------------===//64 65// expected-error @+1 {{'spirv.ARM.GraphConstant' op failed to verify that op must appear in a spirv.ARM.Graph op's block}}66%0 = spirv.ARM.GraphConstant { graph_constant_id = 42 : i32 } : !spirv.arm.tensor<2x3xi16>67// -----68 69//===----------------------------------------------------------------------===//70// spirv.ARM.GraphOutputs outside graph scope71//===----------------------------------------------------------------------===//72 73%0 = spirv.Constant dense<1> : !spirv.arm.tensor<1xi16>74// expected-error @+1 {{'spirv.ARM.GraphOutputs' op failed to verify that op must appear in a spirv.ARM.Graph op's block}}75spirv.ARM.GraphOutputs %0 : !spirv.arm.tensor<1xi16>76 77// -----78 79//===----------------------------------------------------------------------===//80// spirv.ARM.Graph return type does not match spirv.ARM.GraphOutputs81//===----------------------------------------------------------------------===//82 83spirv.ARM.Graph @graphAndOutputs(%arg0: !spirv.arm.tensor<14x19xi16>) -> !spirv.arm.tensor<5x3xi16> {84 // expected-error @+1 {{type of return operand 0 ('!spirv.arm.tensor<14x19xi16>') doesn't match graph result type ('!spirv.arm.tensor<5x3xi16>')}}85 spirv.ARM.GraphOutputs %arg0 : !spirv.arm.tensor<14x19xi16>86}87 88// -----89 90//===----------------------------------------------------------------------===//91// spirv.ARM.Graph return type does not match number of results in spirv.ARM.GraphOutputs92//===----------------------------------------------------------------------===//93 94spirv.ARM.Graph @graphAndOutputs(%arg0: !spirv.arm.tensor<14x19xi16>) -> (!spirv.arm.tensor<14x19xi16>, !spirv.arm.tensor<14x19xi16>) {95 // expected-error @+1 {{'spirv.ARM.GraphOutputs' op is returning 1 value(s) but enclosing spirv.ARM.Graph requires 2 result(s)}}96 spirv.ARM.GraphOutputs %arg0 : !spirv.arm.tensor<14x19xi16>97}98 99// -----100 101spirv.ARM.Graph @graphAndOutputs(%arg0: !spirv.arm.tensor<14x19xi16>) -> !spirv.arm.tensor<14x19xi16> {102 // expected-error @+1 {{'spirv.ARM.GraphOutputs' op is returning 2 value(s) but enclosing spirv.ARM.Graph requires 1 result(s)}}103 spirv.ARM.GraphOutputs %arg0, %arg0 : !spirv.arm.tensor<14x19xi16>, !spirv.arm.tensor<14x19xi16>104}105 106// -----107 108//===----------------------------------------------------------------------===//109// spirv.ARM.Graph using a non TensorArmType argument110//===----------------------------------------------------------------------===//111 112// expected-error @+1 {{'spirv.ARM.Graph' op type of argument #0 must be a TensorArmType, but got 'i8'}}113spirv.ARM.Graph @graphAndOutputs(%arg0: i8) -> !spirv.arm.tensor<14x19xi16> {114}115 116// -----117 118//===----------------------------------------------------------------------===//119// spirv.ARM.Graph using a non TensorArmType result120//===----------------------------------------------------------------------===//121 122// expected-error @+1 {{'spirv.ARM.Graph' op type of result #0 must be a TensorArmType, but got 'i8'}}123spirv.ARM.Graph @graphAndOutputs(%arg0: !spirv.arm.tensor<14x19xi16>) -> i8 {124}125