@@ -821,3 +821,75 @@ func.func @illegal_storage_type_for_quantized_element_type(%arg0: tensor<4x!quan
821821 %0 = " stablehlo.uniform_dequantize" (%arg0 ) : (tensor <4 x!quant.uniform <si8 :f32 , 1.000000e+00 >>) -> tensor <4 xf32 >
822822 func.return %0 : tensor <4 xf32 >
823823}
824+
825+ // -----
826+
827+ func.func @convolution_c28 (%arg0: tensor <1 x8 x8 x207 xf32 >, %arg1: tensor <3 x3 x207 x16 x!quant.uniform <i8 :f32 , 5.0 :20 >>) -> tensor <1 x8 x8 x16 x!quant.uniform <i8 :f32 , 10.0 :50 >> {
828+ // expected-error@+1 {{not all of operands and result are quantized}}
829+ %0 = stablehlo.convolution (%arg0 , %arg1 )
830+ dim_numbers = [b , 0 , 1 , f ]x [0 , 1 , i , o ]->[b , 0 , 1 , f ],
831+ window = {stride = [1 , 1 ], pad = [[1 , 1 ], [1 , 1 ]], lhs_dilate = [1 , 1 ], rhs_dilate = [1 , 1 ]}
832+ {batch_group_count = 1 : i64 , feature_group_count = 1 : i64 , precision_config = [#stablehlo <precision DEFAULT >, #stablehlo <precision DEFAULT >]} :
833+ (tensor <1 x8 x8 x207 xf32 >, tensor <3 x3 x207 x16 x!quant.uniform <i8 :f32 , 5.0 :20 >>) -> tensor <1 x8 x8 x16 x!quant.uniform <i8 :f32 , 10.0 :50 >>
834+ func.return %0 : tensor <1 x8 x8 x16 x!quant.uniform <i8 :f32 , 10.0 :50 >>
835+ }
836+
837+ // -----
838+
839+ func.func @convolution_c29 (%arg0: tensor <1 x8 x8 x207 x!quant.uniform <i16 :f32 , 2.0 :15 >>, %arg1: tensor <3 x3 x207 x16 x!quant.uniform <i8 :f32 , 5.0 :20 >>) -> tensor <1 x8 x8 x16 x!quant.uniform <i8 :f32 , 10.0 :50 >> {
840+ // expected-error@+1 {{mismatched operand storage types 'i16' and 'i8'}}
841+ %0 = stablehlo.convolution (%arg0 , %arg1 )
842+ dim_numbers = [b , 0 , 1 , f ]x [0 , 1 , i , o ]->[b , 0 , 1 , f ],
843+ window = {stride = [1 , 1 ], pad = [[1 , 1 ], [1 , 1 ]], lhs_dilate = [1 , 1 ], rhs_dilate = [1 , 1 ]}
844+ {batch_group_count = 1 : i64 , feature_group_count = 1 : i64 , precision_config = [#stablehlo <precision DEFAULT >, #stablehlo <precision DEFAULT >]} :
845+ (tensor <1 x8 x8 x207 x!quant.uniform <i16 :f32 , 2.0 :15 >>, tensor <3 x3 x207 x16 x!quant.uniform <i8 :f32 , 5.0 :20 >>) -> tensor <1 x8 x8 x16 x!quant.uniform <i8 :f32 , 10.0 :50 >>
846+ func.return %0 : tensor <1 x8 x8 x16 x!quant.uniform <i8 :f32 , 10.0 :50 >>
847+ }
848+
849+ // -----
850+
851+ func.func @convolution_c30 (%arg0: tensor <1 x8 x8 x207 x!quant.uniform <i8 :f64 , 2.0 :15 >>, %arg1: tensor <3 x3 x207 x16 x!quant.uniform <i8 :f32 , 5.0 :20 >>) -> tensor <1 x8 x8 x16 x!quant.uniform <i8 :f32 , 10.0 :50 >> {
852+ // expected-error@+1 {{mismatched operands and result expressed types}}
853+ %0 = stablehlo.convolution (%arg0 , %arg1 )
854+ dim_numbers = [b , 0 , 1 , f ]x [0 , 1 , i , o ]->[b , 0 , 1 , f ],
855+ window = {stride = [1 , 1 ], pad = [[1 , 1 ], [1 , 1 ]], lhs_dilate = [1 , 1 ], rhs_dilate = [1 , 1 ]}
856+ {batch_group_count = 1 : i64 , feature_group_count = 1 : i64 , precision_config = [#stablehlo <precision DEFAULT >, #stablehlo <precision DEFAULT >]} :
857+ (tensor <1 x8 x8 x207 x!quant.uniform <i8 :f64 , 2.0 :15 >>, tensor <3 x3 x207 x16 x!quant.uniform <i8 :f32 , 5.0 :20 >>) -> tensor <1 x8 x8 x16 x!quant.uniform <i8 :f32 , 10.0 :50 >>
858+ func.return %0 : tensor <1 x8 x8 x16 x!quant.uniform <i8 :f32 , 10.0 :50 >>
859+ }
860+
861+ // -----
862+
863+ func.func @convolution_c31 (%arg0: tensor <1 x8 x8 x207 x!quant.uniform <i8 :f32 , 2.0 :15 >>, %arg1: tensor <3 x3 x207 x16 x!quant.uniform <i8 :f32 :0 , {0.1 :-30 }>>) -> tensor <1 x8 x8 x16 x!quant.uniform <i8 :f32 , 10.0 :50 >> {
864+ // expected-error@+1 {{rhs and result are of mixed per_tensor and per_axis quantized tensor type 'tensor<3x3x207x16x!quant.uniform<i8:f32:0, {1.000000e-01:-30}>>' and 'tensor<1x8x8x16x!quant.uniform<i8:f32, 1.000000e+01:50>>'}}
865+ %0 = stablehlo.convolution (%arg0 , %arg1 )
866+ dim_numbers = [b , 0 , 1 , f ]x [0 , 1 , i , o ]->[b , 0 , 1 , f ],
867+ window = {stride = [1 , 1 ], pad = [[1 , 1 ], [1 , 1 ]], lhs_dilate = [1 , 1 ], rhs_dilate = [1 , 1 ]}
868+ {batch_group_count = 1 : i64 , feature_group_count = 1 : i64 , precision_config = [#stablehlo <precision DEFAULT >, #stablehlo <precision DEFAULT >]} :
869+ (tensor <1 x8 x8 x207 x!quant.uniform <i8 :f32 , 2.0 :15 >>, tensor <3 x3 x207 x16 x!quant.uniform <i8 :f32 :0 , {0.1 :-30 }>>) -> tensor <1 x8 x8 x16 x!quant.uniform <i8 :f32 , 10.0 :50 >>
870+ func.return %0 : tensor <1 x8 x8 x16 x!quant.uniform <i8 :f32 , 10.0 :50 >>
871+ }
872+
873+ // -----
874+
875+ func.func @convolution_c32 (%arg0: tensor <1 x8 x8 x207 x!quant.uniform <i8 :f32 , 2.0 :15 >>, %arg1: tensor <3 x3 x207 x16 x!quant.uniform <i8 :f32 :0 , {0.1 :-30 }>>) -> tensor <1 x8 x8 x16 x!quant.uniform <i8 :f32 :0 , {0.1 :-30 }>> {
876+ // expected-error@+1 {{mismatched kernel_output_feature_dimension 3 and rhs quantized dimension 0}}
877+ %0 = stablehlo.convolution (%arg0 , %arg1 )
878+ dim_numbers = [b , 0 , 1 , f ]x [0 , 1 , i , o ]->[b , 0 , 1 , f ],
879+ window = {stride = [1 , 1 ], pad = [[1 , 1 ], [1 , 1 ]], lhs_dilate = [1 , 1 ], rhs_dilate = [1 , 1 ]}
880+ {batch_group_count = 1 : i64 , feature_group_count = 1 : i64 , precision_config = [#stablehlo <precision DEFAULT >, #stablehlo <precision DEFAULT >]} :
881+ (tensor <1 x8 x8 x207 x!quant.uniform <i8 :f32 , 2.0 :15 >>, tensor <3 x3 x207 x16 x!quant.uniform <i8 :f32 :0 , {0.1 :-30 }>>) -> tensor <1 x8 x8 x16 x!quant.uniform <i8 :f32 :0 , {0.1 :-30 }>>
882+ func.return %0 : tensor <1 x8 x8 x16 x!quant.uniform <i8 :f32 :0 , {0.1 :-30 }>>
883+ }
884+
885+ // -----
886+
887+ func.func @convolution_c33 (%arg0: tensor <1 x8 x8 x207 x!quant.uniform <i8 :f32 , 2.0 :15 >>, %arg1: tensor <3 x3 x207 x16 x!quant.uniform <i8 :f32 :3 , {0.1 :-30 }>>) -> tensor <1 x8 x8 x16 x!quant.uniform <i8 :f32 :0 , {2.0 :-30 }>> {
888+ // expected-error@+1 {{mismatched output_feature_dimension 3 and result quantized dimension 0}}
889+ %0 = stablehlo.convolution (%arg0 , %arg1 )
890+ dim_numbers = [b , 0 , 1 , f ]x [0 , 1 , i , o ]->[b , 0 , 1 , f ],
891+ window = {stride = [1 , 1 ], pad = [[1 , 1 ], [1 , 1 ]], lhs_dilate = [1 , 1 ], rhs_dilate = [1 , 1 ]}
892+ {batch_group_count = 1 : i64 , feature_group_count = 1 : i64 , precision_config = [#stablehlo <precision DEFAULT >, #stablehlo <precision DEFAULT >]} :
893+ (tensor <1 x8 x8 x207 x!quant.uniform <i8 :f32 , 2.0 :15 >>, tensor <3 x3 x207 x16 x!quant.uniform <i8 :f32 :3 , {0.1 :-30 }>>) -> tensor <1 x8 x8 x16 x!quant.uniform <i8 :f32 :0 , {2.0 :-30 }>>
894+ func.return %0 : tensor <1 x8 x8 x16 x!quant.uniform <i8 :f32 :0 , {2.0 :-30 }>>
895+ }
0 commit comments