Skip to content

Commit a1880bd

Browse files
Sunny-Anandchentong319tungldMike EssenmacherAlexandreEichenberger
authored
[Do not merge in main]Fix link and test models. (#2940)
* Change lowering of onnx.IF to Krnl (#2932) * implementation Signed-off-by: chentong319 <[email protected]> * test case change Signed-off-by: chentong319 <[email protected]> * format Signed-off-by: chentong319 <[email protected]> * add test for If back Signed-off-by: chentong319 <[email protected]> * format Signed-off-by: chentong319 <[email protected]> --------- Signed-off-by: chentong319 <[email protected]> Co-authored-by: Tung D. Le <[email protected]> Signed-off-by: Sunny-Anand <[email protected]> * Update c style cast to c++ style cast (#2934) Signed-off-by: Mike Essenmacher <[email protected]> Signed-off-by: Sunny-Anand <[email protected]> * Change c style cast to c++ style cast (#2936) Signed-off-by: Mike Essenmacher <[email protected]> Signed-off-by: Sunny-Anand <[email protected]> * Add coding practices for onnx-mlir (#2935) Signed-off-by: Mike Essenmacher <[email protected]> Signed-off-by: Sunny-Anand <[email protected]> * try to use new buffer deallocation (#2919) * implementation Signed-off-by: Chen Tong <[email protected]> * comments Signed-off-by: Chen Tong <[email protected]> * format Signed-off-by: Chen Tong <[email protected]> --------- Signed-off-by: Chen Tong <[email protected]> Co-authored-by: Tung D. Le <[email protected]> Co-authored-by: Alexandre Eichenberger <[email protected]> Signed-off-by: Sunny-Anand <[email protected]> * fix requirements.txt link Signed-off-by: Sunny-Anand <[email protected]> * Reuse input buffer in lowering to krnl (#2939) * first step Signed-off-by: chentong319 <[email protected]> * cpu Signed-off-by: chentong319 <[email protected]> * options Signed-off-by: chentong319 <[email protected]> * unify Signed-off-by: chentong319 <[email protected]> * simd Signed-off-by: chentong319 <[email protected]> * comments Signed-off-by: chentong319 <[email protected]> * lit test Signed-off-by: chentong319 <[email protected]> * fix test Signed-off-by: chentong319 <[email protected]> * format Signed-off-by: chentong319 <[email protected]> * response Signed-off-by: chentong319 <[email protected]> --------- Signed-off-by: chentong319 <[email protected]> Signed-off-by: Sunny-Anand <[email protected]> * Fix GroupNorm to support Opset21 (#2928) * Group norm for opset 21 * Testing phase * Fix GroupNorm to support Opset21 --------- Signed-off-by: hamptonm1 <[email protected]> Co-authored-by: Megan Hampton <[email protected]> Signed-off-by: Sunny-Anand <[email protected]> * Update Ops documentation for ONNX 1.16.2 (#2942) * Update Ops documentation for ONNX 1.16.2 * Fix format --------- Co-authored-by: Megan Hampton <[email protected]> Signed-off-by: Sunny-Anand <[email protected]> * LLVM/StableHLO Upgrade eaa95a1 (#2943) Co-authored-by: Megan Hampton <[email protected]> Signed-off-by: Sunny-Anand <[email protected]> * added support for no-zero-point quantization (#2938) Signed-off-by: Alexandre Eichenberger <[email protected]> Co-authored-by: Tung D. Le <[email protected]> Signed-off-by: Sunny-Anand <[email protected]> * update with main Signed-off-by: Sunny-Anand <[email protected]> --------- Signed-off-by: chentong319 <[email protected]> Signed-off-by: Sunny-Anand <[email protected]> Signed-off-by: Mike Essenmacher <[email protected]> Signed-off-by: Chen Tong <[email protected]> Signed-off-by: hamptonm1 <[email protected]> Signed-off-by: Alexandre Eichenberger <[email protected]> Signed-off-by: Sunny Anand <[email protected]> Co-authored-by: Tong Chen <[email protected]> Co-authored-by: Tung D. Le <[email protected]> Co-authored-by: Mike Essenmacher <[email protected]> Co-authored-by: Alexandre Eichenberger <[email protected]> Co-authored-by: hamptonm1 <[email protected]> Co-authored-by: Megan Hampton <[email protected]>
1 parent 02f45b0 commit a1880bd

27 files changed

+774
-178
lines changed

docs/BuildOnLinuxOSX.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Firstly, install MLIR (as a part of LLVM-Project):
1515
``` bash
1616
git clone -n https://github.com/llvm/llvm-project.git
1717
# Check out a specific branch that is known to work with ONNX-MLIR.
18-
cd llvm-project && git checkout f142f8afe21bceb00fb495468aa0b5043e98c419 && cd ..
18+
cd llvm-project && git checkout eaa95a1c2bd38332c1a4e634595f29d22b28ffea && cd ..
1919
```
2020

2121
[same-as-file]: <> (utils/build-mlir.sh)

docs/BuildOnWindows.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ Install MLIR (as a part of LLVM-Project):
5252
```shell
5353
git clone -n https://github.com/llvm/llvm-project.git
5454
# Check out a specific branch that is known to work with ONNX-MLIR.
55-
cd llvm-project && git checkout f142f8afe21bceb00fb495468aa0b5043e98c419 && cd ..
55+
cd llvm-project && git checkout eaa95a1c2bd38332c1a4e634595f29d22b28ffea && cd ..
5656
```
5757

5858
[same-as-file]: <> (utils/build-mlir.cmd)

docs/Dialects/onnx.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3589,6 +3589,63 @@ where the mean and variance are computed per instance per group of channels, and
35893589
groups `num_groups` should be divisible by the number of channels so that there are
35903590
an equal number of channels per group.
35913591

3592+
The overall computation has two stages: the first stage normalizes the elements to
3593+
have zero mean and unit variance for each instance in each group, and the second
3594+
stage scales and shifts the results of the first stage. The floating-point precision
3595+
used in the first stage is determined by the `stash_type` attribute. For example,
3596+
if `stash_type` is 1, the operator casts all input variables to 32-bit float,
3597+
performs the computation, and finally casts the normalized results back to the
3598+
original type of `X`. The second stage does not depend on `stash_type`.
3599+
3600+
When the number of groups is the same as the number of channels, this operator is
3601+
equivalent to InstanceNormalization. When there is only one group, this operator
3602+
is equivalent to LayerNormalization.
3603+
3604+
Traits: `AlwaysSpeculatableImplTrait`
3605+
3606+
Interfaces: `ConditionallySpeculatable`, `NoMemoryEffect (MemoryEffectOpInterface)`, `ShapeHelperOpInterface`, `ShapeInferenceOpInterface`
3607+
3608+
Effects: `MemoryEffects::Effect{}`
3609+
3610+
#### Attributes:
3611+
3612+
<table>
3613+
<tr><th>Attribute</th><th>MLIR Type</th><th>Description</th></tr>
3614+
<tr><td><code>epsilon</code></td><td>::mlir::FloatAttr</td><td>32-bit float attribute</td></tr>
3615+
<tr><td><code>num_groups</code></td><td>::mlir::IntegerAttr</td><td>64-bit signed integer attribute</td></tr>
3616+
<tr><td><code>stash_type</code></td><td>::mlir::IntegerAttr</td><td>64-bit signed integer attribute</td></tr>
3617+
</table>
3618+
3619+
#### Operands:
3620+
3621+
| Operand | Description |
3622+
| :-----: | ----------- |
3623+
| `X` | tensor of bfloat16 type values or tensor of 16-bit float values or tensor of 32-bit float values or tensor of 64-bit float values
3624+
| `scale` | tensor of bfloat16 type values or tensor of 16-bit float values or tensor of 32-bit float values or tensor of 64-bit float values
3625+
| `bias` | tensor of bfloat16 type values or tensor of 16-bit float values or tensor of 32-bit float values or tensor of 64-bit float values
3626+
3627+
#### Results:
3628+
3629+
| Result | Description |
3630+
| :----: | ----------- |
3631+
| `Y` | tensor of bfloat16 type values or tensor of 16-bit float values or tensor of 32-bit float values or tensor of 64-bit float values
3632+
3633+
### `onnx.GroupNormalizationV18` (ONNXGroupNormalizationV18Op)
3634+
3635+
_ONNX GroupNormalization operation_
3636+
3637+
A GroupNormalization function. Carries out group normalization as described in
3638+
the paper https://arxiv.org/abs/1803.08494
3639+
3640+
This operator transforms input according to
3641+
```
3642+
y = scale * (x - mean) / sqrt(variance + epsilon) + bias,
3643+
```
3644+
where the mean and variance are computed per instance per group of channels, and
3645+
`scale` and `bias` should be specified for each group of channels. The number of
3646+
groups `num_groups` should be divisible by the number of channels so that there are
3647+
an equal number of channels per group.
3648+
35923649
When the number of groups is the same as the number of channels, this operator is
35933650
equivalent to InstanceNormalization. When there is only one group, this operator
35943651
is equivalent to LayerNormalization.

docs/Prerequisite.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ Ninja can be installed with apt on Debian/Ubuntu Linux, or brew on MacOS. On RHE
2626

2727
Java SDK can be installed with distro specific package manager on Linux such as yum on RHEL/Fedora, apt on Debian/Ubuntu, or brew on MacOS. Java SDK is only required if you plan to use the onnx-mlir `--EmitJNI` option to compile a model into a jar file for use in a Java environment. Note that the jar file contains native model runtime library called through JNI so it is not portable across different architectures. To check the java version, run `java --version`.
2828

29-
All the `PyPi` package dependencies and their appropriate versions are captured in [requirements.txt](requirements.txt).
29+
All the `PyPi` package dependencies and their appropriate versions are captured in [requirements.txt](https://github.com/onnx/onnx-mlir/blob/main/requirements.txt).

docs/SupportedONNXOps-NNPA.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33

44
# Supported ONNX Operation for Target *NNPA*.
55

6-
Onnx-mlir currently supports ONNX operations targeting up to opset 20. Limitations are listed when applicable. This documentation highlights the minimum and maximum opset versions that are fully supported by onnx-mlir and not the version changes.
6+
Onnx-mlir currently supports ONNX operations targeting up to opset 21. Limitations are listed when applicable. This documentation highlights the minimum and maximum opset versions that are fully supported by onnx-mlir and not the version changes.
77

88
* Operations are defined by the [ONNX Standard](https://github.com/onnx/onnx/blob/main/docs/Operators.md).
99
* **Supported Opsets** indicates the lowest and highest opset a model may have for onnx-mlir to support compiling a model with the operator.
10-
* A * indicates onnx-mlir is compatible with the latest version of that operator available as of opset 20.
10+
* A * indicates onnx-mlir is compatible with the latest version of that operator available as of opset 21.
1111

1212

1313
NNPA has hardware limitations in dimension index size and tensor size, which are described in [NNPALimit.hpp](../src/Accelerators/NNPA/Support/NNPALimit.hpp). They are large enough for normal use cases, but if your model exceeds the limitations, CPU is used instead of NNPA.

docs/SupportedONNXOps-cpu.md

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33

44
# Supported ONNX Operation for Target *cpu*.
55

6-
Onnx-mlir currently supports ONNX operations targeting up to opset 20. Limitations are listed when applicable. This documentation highlights the minimum and maximum opset versions that are fully supported by onnx-mlir and not the version changes.
6+
Onnx-mlir currently supports ONNX operations targeting up to opset 21. Limitations are listed when applicable. This documentation highlights the minimum and maximum opset versions that are fully supported by onnx-mlir and not the version changes.
77

88
* Operations are defined by the [ONNX Standard](https://github.com/onnx/onnx/blob/main/docs/Operators.md).
99
* **Supported Opsets** indicates the lowest and highest opset a model may have for onnx-mlir to support compiling a model with the operator.
10-
* A * indicates onnx-mlir is compatible with the latest version of that operator available as of opset 20.
10+
* A * indicates onnx-mlir is compatible with the latest version of that operator available as of opset 21.
1111

1212

1313
| Op |Supported Opsets (inclusive) |Limitations |Notes |
@@ -36,8 +36,8 @@ Onnx-mlir currently supports ONNX operations targeting up to opset 20. Limitatio
3636
| **BitwiseOr** |18 - * | | |
3737
| **BitwiseXor** |18 - * | | |
3838
| **BlackmanWindow** |none | | | |
39-
| **Cast** |6 - * |Cast only between float and double types. Only ppc64le and MacOS platforms support float16. | |
40-
| **CastLike** |19 - * |CastLike only between float and double types. Only ppc64le and MacOS platforms support float16. | |
39+
| **Cast** |6 - * |Cast only between float and double types. Only ppc64le and MacOS platforms support float16. Does not support int4 and uint4. | |
40+
| **CastLike** |19 - * |CastLike only between float and double types. Only ppc64le and MacOS platforms support float16. Does not support int4 and uint4. | |
4141
| **CastMap** |none | | | |
4242
| **CategoryMapper** |none | | | |
4343
| **Ceil** |6 - * | | |
@@ -48,8 +48,8 @@ Onnx-mlir currently supports ONNX operations targeting up to opset 20. Limitatio
4848
| **Compress** |9 - * | | |
4949
| **Concat** |6 - * | | |
5050
| **ConcatFromSequence** |none | | | |
51-
| **Constant** |6 - * | | |
52-
| **ConstantOfShape** |9 - * | | |
51+
| **Constant** |6 - * |Does not support int4 and uint4. | |
52+
| **ConstantOfShape** |9 - * |Does not support int4 and uint4. | |
5353
| **Conv** |6 - * | | |
5454
| **ConvInteger** |none | | | |
5555
| **ConvTranspose** |6 - * |Spatial dimensions (H and W in input `X`, and kH and kW in input `W`) must be static dimension. | |
@@ -59,7 +59,7 @@ Onnx-mlir currently supports ONNX operations targeting up to opset 20. Limitatio
5959
| **DFT** |17 - * | | |
6060
| **DeformConv** |none | | | |
6161
| **DepthToSpace** |13 - * | | |
62-
| **DequantizeLinear** |10 - * |Only support for per-tensor or layer dequantization. No support for per-axis dequantization. | |
62+
| **DequantizeLinear** |10 - * |Only support for per-tensor or layer dequantization. No support for per-axis dequantization. Does not support int4 and uint4. | |
6363
| **Det** |none | | | |
6464
| **DictVectorizer** |none | | | |
6565
| **Div** |6 - * |No support for short integers. | |
@@ -73,7 +73,7 @@ Onnx-mlir currently supports ONNX operations targeting up to opset 20. Limitatio
7373
| **Expand** |8 - * |Input `shape` must have static shape. | |
7474
| **EyeLike** |none | | | |
7575
| **FeatureVectorizer** |none | | | |
76-
| **Flatten** |6 - * | | |
76+
| **Flatten** |6 - * |Does not support int4 and uint4. | |
7777
| **Floor** |6 - * | | |
7878
| **GRU** |7 - * |W, B and R must be constants. | |
7979
| **Gather** |6 - * | | |
@@ -94,8 +94,8 @@ Onnx-mlir currently supports ONNX operations targeting up to opset 20. Limitatio
9494
| **HardSigmoid** |6 - * | | |
9595
| **HardSwish** |none | | | |
9696
| **Hardmax** |6 - * | | |
97-
| **Identity** |16 - * |Sequence identity not supported. | |
98-
| **If** |16 - * |Sequence and Optional outputs are not supported. | |
97+
| **Identity** |16 - * |Sequence identity not supported. Does not support int4 and uint4. | |
98+
| **If** |16 - * |Sequence and Optional outputs are not supported. Does not support int4 and uint4. | |
9999
| **Imputer** |none | | | |
100100
| **InstanceNormalization** |6 - * | | |
101101
| **IsInf** |20 - * |Currently no support for float16 infinity value. Only for float32 and float64. | |
@@ -111,7 +111,7 @@ Onnx-mlir currently supports ONNX operations targeting up to opset 20. Limitatio
111111
| **LinearRegressor** |none | | | |
112112
| **Log** |6 - * | | |
113113
| **LogSoftmax** |13 - * |Axis 0, 1, and default currently disabled due to changes in ONNX 1.8.1/Opset 13. |Temporally removed due to changes in onnx 1.8.1. |
114-
| **Loop** |6 - * |Input must have static shape. | |
114+
| **Loop** |6 - * |Input must have static shape. Does not support int4 and uint4. | |
115115
| **LpNormalization** |none | | | |
116116
| **LpPool** |none | | | |
117117
| **MatMul** |6 - * | | |
@@ -142,11 +142,11 @@ Onnx-mlir currently supports ONNX operations targeting up to opset 20. Limitatio
142142
| **OptionalHasElement** |none | | | |
143143
| **Or** |7 - * | | |
144144
| **PRelu** |6 - * | | |
145-
| **Pad** |6 - * |axes input not supported. | |
145+
| **Pad** |6 - * |axes input not supported. Does not support int4 and uint4. | |
146146
| **Pow** |7 - * |No support for power with integer types. | |
147147
| **QLinearConv** |none | | | |
148148
| **QLinearMatMul** |none | | | |
149-
| **QuantizeLinear** |10 - * |Do not support per-axis and i8 quantization. | |
149+
| **QuantizeLinear** |10 - * |Does not support per-axis and i8 quantization. Does not support int4 and uint4. | |
150150
| **RNN** |7 - * |W, B and R must be constants. | |
151151
| **RandomNormal** |none | | | |
152152
| **RandomNormalLike** |none | | | |
@@ -165,7 +165,7 @@ Onnx-mlir currently supports ONNX operations targeting up to opset 20. Limitatio
165165
| **ReduceSum** |6 - * |Default axis and do_not_keep_dim not supported. |Default axis and do_not_keep_dim temporarily removed due to changes in onnx 1.8.1. |
166166
| **ReduceSumSquare** |13 - * |Default axis and do_not_keep_dim not supported. | |
167167
| **Relu** |6 - * | | |
168-
| **Reshape** |6 - * |allowzero not supported. Input `shape` must have static dimension. | |
168+
| **Reshape** |6 - * |allowzero not supported. Input `shape` must have static dimension. Does not support int4 and uint4. | |
169169
| **Resize** |10 - * |Missing support for linear, cubic, crop, pytorch_half_pixel, and floor. Attributes antialias, axes and keep_aspect_ratio_policy are not supported. `scales` and `sizes` must have static dimension. | |
170170
| **ReverseSequence** |10 - * | | |
171171
| **RoiAlign** |none | | | |
@@ -174,7 +174,7 @@ Onnx-mlir currently supports ONNX operations targeting up to opset 20. Limitatio
174174
| **SVMClassifier** |none | | | |
175175
| **SVMRegressor** |none | | | |
176176
| **Scaler** |none | | | |
177-
| **Scan** |8 - * |Does not support dynamic shapes. |Precision issue with newer opset, maybe just unsupported. Dynamic shape?. |
177+
| **Scan** |8 - * |Does not support dynamic shapes. Does not support int4 and uint4. |Precision issue with newer opset, maybe just unsupported. Dynamic shape?. |
178178
| **Scatter** |none | | | |
179179
| **ScatterElements** |11 - * |Does not support duplicate indices. | |
180180
| **ScatterND** |11 - * |Does not support scatternd add/multiply. | |
@@ -186,13 +186,13 @@ Onnx-mlir currently supports ONNX operations targeting up to opset 20. Limitatio
186186
| **SequenceInsert** |11 - * |Does not support unranked sequence element. | |
187187
| **SequenceLength** |none | | | |
188188
| **SequenceMap** |none | | | |
189-
| **Shape** |15 - * |Does not support start and end attributes. | |
189+
| **Shape** |15 - * |Does not support start and end attributes. Does not support int4 and uint4. | |
190190
| **Shrink** |none | | | |
191191
| **Sigmoid** |6 - * | | |
192192
| **Sign** |9 - * | | |
193193
| **Sin** |7 - * | | |
194194
| **Sinh** |9 - * | | |
195-
| **Size** |13 - * | | |
195+
| **Size** |13 - * |Does not support int4 and uint4. | |
196196
| **Slice** |13 - * |Axis must be a constant argument. |Add tests to slices, currently have none. |
197197
| **Softmax** |6 - * | | |
198198
| **SoftmaxCrossEntropyLoss** |none | | | |
@@ -202,7 +202,7 @@ Onnx-mlir currently supports ONNX operations targeting up to opset 20. Limitatio
202202
| **Split** |6 - * |Does not support static and dynamic shape, zero size splits. |Temporally removed due to changes in onnx 1.8.1. |
203203
| **SplitToSequence** |none | | | |
204204
| **Sqrt** |6 - * | | |
205-
| **Squeeze** |6 - * |Does not support static and dynamic shape. |Temporally removed due to changes in onnx 1.8.1. |
205+
| **Squeeze** |6 - * |Does not support static and dynamic shape. Does not support int4 and uint4. |Temporally removed due to changes in onnx 1.8.1. |
206206
| **StringNormalizer** |none | | | |
207207
| **Sub** |6 - * |Does not support short integers. | |
208208
| **Sum** |6 - * | | |
@@ -212,12 +212,12 @@ Onnx-mlir currently supports ONNX operations targeting up to opset 20. Limitatio
212212
| **ThresholdedRelu** |none | | | |
213213
| **Tile** |6 - * | | |
214214
| **TopK** |10 - * |`K`, the number of top elements to retrieve, must have static shape. | |
215-
| **Transpose** |6 - * | | |
215+
| **Transpose** |6 - * |Does not support int4 and uint4. | |
216216
| **TreeEnsembleClassifier** |none | | | |
217217
| **TreeEnsembleRegressor** |none | | | |
218218
| **Trilu** |14 - * | | |
219219
| **Unique** |11 - * | | |
220-
| **Unsqueeze** |6 - * |Does not support static and dynamic shape. |Temporally removed due to changes in onnx 1.8.1. |
220+
| **Unsqueeze** |6 - * |Does not support static and dynamic shape. Does not support int4 and uint4. |Temporally removed due to changes in onnx 1.8.1. |
221221
| **Upsample** |7 - * |Input `X` and `Y` must have static shape. | |
222222
| **Where** |9 - * | | |
223223
| **Xor** |7 - * | | |

requirements.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
lit~=15.0
22
# numpy 1.24 deprecates np.object, np.bool, np.float, np.complex, np.str,
33
# and np.int which are used heavily in onnx-mlir.
4-
numpy~=1.22.2, <=1.23.5
4+
numpy==2.0.1
5+
onnx==1.16.2
56
protobuf==4.21.12
6-
pytest~=7.2
7-
pytest-xdist~=3.0
7+
pytest==8.3.2
8+
pytest-xdist==3.6.1

src/Builder/OpBuildTable.inc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ op_dialect_version_map_["Gradient"] = {1};
8080
op_dialect_version_map_["Greater"] = {13};
8181
op_dialect_version_map_["GreaterOrEqual"] = {16};
8282
op_dialect_version_map_["GridSample"] = {16};
83-
op_dialect_version_map_["GroupNormalization"] = {18};
83+
op_dialect_version_map_["GroupNormalization"] = {21, 18};
8484
op_dialect_version_map_["HammingWindow"] = {17};
8585
op_dialect_version_map_["HannWindow"] = {17};
8686
op_dialect_version_map_["HardSigmoid"] = {6};
@@ -358,6 +358,8 @@ import_handler_map_["GridSample"] =
358358
&onnx_mlir::detail::FrontendGenImpl::buildOperation<mlir::ONNXGridSampleOp>;
359359
import_handler_map_["GroupNormalization"] =
360360
&onnx_mlir::detail::FrontendGenImpl::buildOperation<mlir::ONNXGroupNormalizationOp>;
361+
import_handler_map_["GroupNormalizationV18"] =
362+
&onnx_mlir::detail::FrontendGenImpl::buildOperation<mlir::ONNXGroupNormalizationV18Op>;
361363
import_handler_map_["HammingWindow"] =
362364
&onnx_mlir::detail::FrontendGenImpl::buildOperation<mlir::ONNXHammingWindowOp>;
363365
import_handler_map_["HannWindow"] =

src/Compiler/CompilerOptions.cpp

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ bool enableONNXHybridPass; // common for both
4242
std::vector<std::string> functionsToDecompose; // common for both
4343
std::string opsForCall; // common for both
4444
bool disableKrnlOpFusion; // common for both
45+
bool disableQuantZeroPoint; // common for both
46+
bool enableKrnlBufferReuse; // common for both
4547
bool disableMemRefPrefetch; // common for both
4648
EmissionTargetType emissionTarget; // onnx-mlir only
4749
bool invokeOnnxVersionConverter; // onnx-mlir only
@@ -194,7 +196,7 @@ static llvm::cl::list<std::string, std::vector<std::string>>
194196
llvm::cl::cat(OnnxMlirCommonOptions));
195197

196198
static llvm::cl::opt<bool, true> enableONNXHybridPassOpt("onnx-hybrid-pass",
197-
llvm::cl::desc("Enable ONNX hybrid pass (default=true)\n"
199+
llvm::cl::desc("Enable ONNX hybrid pass (default=true).\n"
198200
"Set to 'false' if you want to disable ONNX hybrid pass."),
199201
llvm::cl::location(enableONNXHybridPass), llvm::cl::init(true),
200202
llvm::cl::cat(OnnxMlirCommonOptions));
@@ -207,14 +209,31 @@ static llvm::cl::list<std::string, std::vector<std::string>>
207209

208210
static llvm::cl::opt<bool, true> disableKrnlOpFusionOpt(
209211
"disable-krnl-op-fusion",
210-
llvm::cl::desc("disable op fusion in onnx-to-krnl pass (default=false)\n"
212+
llvm::cl::desc("Disable op fusion in onnx-to-krnl pass (default=false).\n"
211213
"Set to 'true' if you want to disable fusion."),
212214
llvm::cl::location(disableKrnlOpFusion), llvm::cl::init(false),
213215
llvm::cl::cat(OnnxMlirCommonOptions));
214216

217+
static llvm::cl::opt<bool, true> disable_quantization_zero_point(
218+
"disable-quantization-zero-point",
219+
llvm::cl::desc(
220+
"Disable the use of zero-point in quantization (default=false).\n"
221+
"Set to 'true' if you want to disable the use of zero-point\n"
222+
"in dyn/static quantization/dequantization."),
223+
llvm::cl::location(disableQuantZeroPoint), llvm::cl::init(false),
224+
llvm::cl::cat(OnnxMlirCommonOptions));
225+
226+
static llvm::cl::opt<bool, true> enableKrnlBufferReuseOpt(
227+
"enable-krnl-buffer-reuse",
228+
llvm::cl::desc("enable buffer reuse within an op in onnx-to-krnl pass"
229+
"(default=false)\n"
230+
"Set to 'true' if you want to enable buffer reuse."),
231+
llvm::cl::location(enableKrnlBufferReuse), llvm::cl::init(false),
232+
llvm::cl::cat(OnnxMlirCommonOptions));
233+
215234
static llvm::cl::opt<bool, true> disableMemRefPrefetchOpt(
216235
"disable-memref-prefetch",
217-
llvm::cl::desc("disable generation of memref.prefetch (default=false)\n"
236+
llvm::cl::desc("Disable generation of memref.prefetch (default=false).\n"
218237
"Set to 'true' if you want to disable prefetch."),
219238
llvm::cl::location(disableMemRefPrefetch), llvm::cl::init(false),
220239
llvm::cl::cat(OnnxMlirCommonOptions));
@@ -1136,7 +1155,6 @@ std::string getLibraryPath() {
11361155
// as lrodataScript.
11371156
std::string getToolPath(
11381157
const std::string &tool, bool flag /*false by default*/) {
1139-
11401158
if (!flag) {
11411159
std::string execDir = llvm::sys::path::parent_path(getExecPath()).str();
11421160
llvm::SmallString<8> toolPath(execDir);

0 commit comments

Comments
 (0)