252
|
1 // RUN: mlir-opt %s -split-input-file -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' | FileCheck %s
|
173
|
2
|
|
3 // -----
|
|
4 // CHECK-LABEL: redundant_scast
|
236
|
5 func.func @redundant_scast() -> tensor<4xi8> {
|
|
6 // CHECK-NEXT: arith.constant dense<10> : tensor<4xi8>
|
173
|
7 // CHECK-NEXT: return
|
236
|
8 %cst = arith.constant dense<5> : tensor<4xi8>
|
173
|
9 %1 = "quant.scast"(%cst) : (tensor<4xi8>) -> tensor<4x!quant.uniform<u8:f32, 7.812500e-03:128>>
|
|
10 %2 = "quant.scast"(%1) : (tensor<4x!quant.uniform<u8:f32, 7.812500e-03:128>>) -> tensor<4xi8>
|
236
|
11 %3 = arith.addi %2, %2 : tensor<4xi8>
|
173
|
12 return %3 : tensor<4xi8>
|
|
13 }
|
|
14
|
|
15 // -----
|
|
16 // CHECK-LABEL: non_redundant_scast
|
236
|
17 func.func @non_redundant_scast() -> tensor<4x!quant.uniform<u8:f32, 7.812500e-03:128>> {
|
|
18 // CHECK-NEXT: arith.constant dense<5> : tensor<4xi8>
|
173
|
19 // CHECK-NEXT: scast
|
|
20 // CHECK-NEXT: return
|
236
|
21 %cst = arith.constant dense<5> : tensor<4xi8>
|
173
|
22 %1 = "quant.scast"(%cst) : (tensor<4xi8>) -> tensor<4x!quant.uniform<u8:f32, 7.812500e-03:128>>
|
|
23 return %1 : tensor<4x!quant.uniform<u8:f32, 7.812500e-03:128>>
|
|
24 }
|