brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.4 KiB · 33ff93e Raw
171 lines · plain
1// RUN: mlir-opt %s -split-input-file -verify-diagnostics2 3!qalias = !quant.uniform<i8:f32, 1.0>4func.func @dcast_scalar(%arg0: !qalias) {5  %0 = quant.dcast %arg0 : !qalias to f326  return7}8 9// -----10 11!qalias = !quant.uniform<i8:f32, 1.0>12func.func @dcast_ranked(%arg0: tensor<2x?x4x!qalias>) {13  %0 = quant.dcast %arg0 : tensor<2x?x4x!qalias> to tensor<2x?x4xf32>14  return15}16 17// -----18 19!qalias = !quant.uniform<i8:f32, 1.0>20func.func @dcast_unranked(%arg0: tensor<*x!qalias>) {21  %0 = quant.dcast %arg0 : tensor<*x!qalias> to tensor<*xf32>22  return23}24 25// -----26 27!qalias = !quant.uniform<i8:f32:2, {1.0, 2.0, 3.0}>28func.func @dcast_per_axis_static(%arg0: tensor<1x2x3x!qalias>) {29  %0 = quant.dcast %arg0 : tensor<1x2x3x!qalias> to tensor<1x2x3xf32>30  return31}32 33// -----34 35!qalias = !quant.uniform<i8:f32:2, {1.0, 2.0, 3.0}>36func.func @dcast_per_axis_dynamic(%arg0: tensor<?x?x?x!qalias>) {37  %0 = quant.dcast %arg0 : tensor<?x?x?x!qalias> to tensor<?x?x?xf32>38  return39}40 41// -----42 43!qalias = !quant.uniform<i8:f32:2, {1.0, 2.0, 3.0}>44func.func @dcast_per_axis_unranked(%arg0: tensor<*x!qalias>) {45  %0 = quant.dcast %arg0 : tensor<*x!qalias> to tensor<*xf32>46  return47}48 49// -----50 51!qalias = !quant.uniform<i8:f32, 1.0>52func.func @qcast_scalar(%arg0: f32) {53  %0 = quant.qcast %arg0 : f32 to !qalias54  return55}56 57// -----58 59!qalias = !quant.uniform<i8:f32, 1.0>60func.func @qcast_ranked(%arg0: tensor<2x?x4xf32>) {61  %0 = quant.qcast %arg0 : tensor<2x?x4xf32> to tensor<2x?x4x!qalias>62  return63}64 65// -----66 67!qalias = !quant.uniform<i8:f32, 1.0>68func.func @qcast_unranked(%arg0: tensor<*xf32>) {69  %0 = quant.qcast %arg0 : tensor<*xf32> to tensor<*x!qalias>70  return71}72 73// -----74 75!qalias = !quant.uniform<i8:f32:2, {1.0, 2.0, 3.0}>76func.func @qcast_per_axis_static(%arg0: tensor<1x2x3xf32>) {77  %0 = quant.qcast %arg0 : tensor<1x2x3xf32> to tensor<1x2x3x!qalias>78  return79}80 81// -----82 83!qalias = !quant.uniform<i8:f32:2, {1.0, 2.0, 3.0}>84func.func @qcast_per_axis_dynamic(%arg0: tensor<?x?x?xf32>) {85  %0 = quant.qcast %arg0 : tensor<?x?x?xf32> to tensor<?x?x?x!qalias>86  return87}88 89// -----90 91!qalias = !quant.uniform<i8:f32:2, {1.0, 2.0, 3.0}>92func.func @qcast_per_axis_unranked(%arg0: tensor<*xf32>) {93  %0 = quant.qcast %arg0 : tensor<*xf32> to tensor<*x!qalias>94  return95}96 97// -----98 99!qalias = !quant.uniform<i8:f32, 1.0>100func.func @scast_scalar(%arg0: i8) {101  %0 = quant.scast %arg0 : i8 to !qalias102  %1 = quant.scast %0 : !qalias to i8103  return104}105 106// -----107 108!qalias = !quant.uniform<i8:f32, 1.0>109func.func @scast_ranked(%arg0: tensor<2x?x4xi8>) {110  %0 = quant.scast %arg0 : tensor<2x?x4xi8> to tensor<2x?x4x!qalias>111  %1 = quant.scast %0 : tensor<2x?x4x!qalias> to tensor<2x?x4xi8>112  return113}114 115// -----116 117!qalias = !quant.uniform<i8:f32, 1.0>118func.func @scast_unranked(%arg0: tensor<*xi8>) {119  %0 = quant.scast %arg0 : tensor<*xi8> to tensor<*x!qalias>120  %1 = quant.scast %0 : tensor<*x!qalias> to tensor<*xi8>121  return122}123 124// -----125 126!qalias = !quant.uniform<i8:f32:2, {1.0, 2.0, 3.0}>127func.func @scast_per_axis_static(%arg0: tensor<1x2x3xi8>) {128  %0 = quant.scast %arg0 : tensor<1x2x3xi8> to tensor<1x2x3x!qalias>129  %1 = quant.scast %0 : tensor<1x2x3x!qalias> to tensor<1x2x3xi8>130  return131}132 133// -----134 135!qalias = !quant.uniform<i8:f32:2, {1.0, 2.0, 3.0}>136func.func @scast_per_axis_dynamic(%arg0: tensor<?x?x?xi8>) {137  %0 = quant.scast %arg0 : tensor<?x?x?xi8> to tensor<?x?x?x!qalias>138  %1 = quant.scast %0 : tensor<?x?x?x!qalias> to tensor<?x?x?xi8>139  return140}141 142// -----143 144!qalias = !quant.uniform<i8:f32:2, {1.0, 2.0, 3.0}>145func.func @scast_per_axis_unranked(%arg0: tensor<*xi8>) {146  %0 = quant.scast %arg0 : tensor<*xi8> to tensor<*x!qalias>147  %1 = quant.scast %0 : tensor<*x!qalias> to tensor<*xi8>148  return149}150 151// -----152 153!qalias = !quant.uniform<u8:f32:{0:1,1:2},154    {{2.000000e+02:120,9.987200e-01:127}, {2.000000e+02,9.987200e-01}}>155func.func @sub_channel_quantization(%arg0: tensor<2x4xi8>) -> tensor<2x4xi8> {156  %0 = quant.scast %arg0 : tensor<2x4xi8> to tensor<2x4x!qalias>157  %1 = quant.dcast %0 : tensor<2x4x!qalias> to tensor<2x4xf32>158  %2 = quant.qcast %1 : tensor<2x4xf32> to tensor<2x4x!qalias>159  %3 = quant.scast %2 : tensor<2x4x!qalias> to tensor<2x4xi8>160  return %3 : tensor<2x4xi8>161}162 163// -----164 165!qalias = !quant.uniform<u8:f32:{0:1,1:2},166    {{2.000000e+02:120,9.987200e-01:127}, {2.000000e+02,9.987200e-01}}>167func.func @sub_channel_quantization_with_unknown_dims(%arg0: tensor<2x?xf32>) {168  %0 = quant.qcast %arg0 : tensor<2x?xf32> to tensor<2x?x!qalias>169  return170}171