xref: /llvm-project/mlir/test/Dialect/Quant/Bytecode/types.mlir (revision bb0bbed610d86ba155f9c066c23038f7f34e2dbb)
1// RUN: mlir-opt -emit-bytecode %s | mlir-opt | FileCheck %s
2
3//===----------------------------------------------------------------------===//
4// AnyQuantized
5//===----------------------------------------------------------------------===//
6
7// CHECK-LABEL: parseAnyFullySpecified
8module @parseAnyFullySpecified attributes {
9  // CHECK: bytecode.test = !quant.any<i8<-8:7>:f32>
10  bytecode.test = !quant.any<i8<-8:7>:f32>
11} {}
12
13// CHECK-LABEL: parseAnyNoExpressedType
14module @parseAnyNoExpressedType attributes {
15  // CHECK: bytecode.test = !quant.any<i8<-8:7>>
16  bytecode.test = !quant.any<i8<-8:7>>
17} {}
18
19// CHECK-LABEL: parseAnyOnlyStorageType
20module @parseAnyOnlyStorageType attributes {
21  // CHECK: bytecode.test = !quant.any<i8<-8:7>>
22  bytecode.test = !quant.any<i8<-8:7>>
23} {}
24
25//===----------------------------------------------------------------------===//
26// CalibratedQuantized
27//===----------------------------------------------------------------------===//
28
29// CHECK-LABEL: parseCalibrated
30module @parseCalibrated attributes {
31  // CHECK: !quant.calibrated<f32<-0.998:1.232100e+00>>
32  bytecode.test = !quant.calibrated<f32<-0.998:1.2321>>
33} {}
34
35//===----------------------------------------------------------------------===//
36// UniformQuantized
37//===----------------------------------------------------------------------===//
38
39// CHECK-LABEL: parseUniformPerLayer
40module @parseUniformPerLayer attributes {
41  // CHECK: !quant.uniform<i8<-8:7>:f32, 9.987200e-01:127>
42  bytecode.test = !quant.uniform<i8<-8:7>:f32, 9.987200e-01:127>
43} {}
44
45//===----------------------------------------------------------------------===//
46// UniformQuantizedPerAxis
47//===----------------------------------------------------------------------===//
48
49// CHECK-LABEL: parseUniformPerAxisScaleZero
50module @parseUniformPerAxisScaleZero attributes {
51  // CHECK: !quant.uniform<u8:f32:1, {2.000000e+02:-120,9.987200e-01:127}>
52  bytecode.test = !quant.uniform<u8:f32:1, {2.000000e+02:-120,9.987200e-01:127}>
53} {}
54
55// CHECK-LABEL: parseUniformPerAxisScaleNoZero
56module @parseUniformPerAxisScaleNoZero attributes {
57  // CHECK: !quant.uniform<i8:f32:1, {2.000000e+02,9.987200e-01}>
58  bytecode.test = !quant.uniform<i8:f32:1, {2.0e+2,0.99872}>
59} {}
60
61// CHECK-LABEL: parseUniformPerAxisMixed
62module @parseUniformPerAxisMixed attributes {
63  // CHECK: !quant.uniform<i8:f32:1, {2.000000e+02,9.987200e-01:120}>
64  bytecode.test = !quant.uniform<i8:f32:1, {2.0e+2,0.99872:120}>
65} {}
66
67