From 6fb96c520dd704c6358e84528e0d25daf326d8b5 Mon Sep 17 00:00:00 2001 From: Sunny Anand <164108690+Sunny-Anand@users.noreply.github.com> Date: Thu, 23 Jan 2025 15:28:44 -0600 Subject: [PATCH] update onnx opset (#3050) * update onnx opset Signed-off-by: Sunny Anand * address feedback Signed-off-by: Sunny Anand * reformat for clang formatting Signed-off-by: Sunny Anand * reformat for black formattter Signed-off-by: Sunny Anand --------- Signed-off-by: Sunny Anand --- docs/SupportedONNXOps-NNPA.md | 4 ++-- docs/SupportedONNXOps-cpu.md | 4 ++-- src/Dialect/ONNX/ONNXOps.hpp | 4 +++- utils/pre-onnx-mlir.py | 5 +++-- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/docs/SupportedONNXOps-NNPA.md b/docs/SupportedONNXOps-NNPA.md index a0f85aef41..fd91a1b016 100644 --- a/docs/SupportedONNXOps-NNPA.md +++ b/docs/SupportedONNXOps-NNPA.md @@ -3,11 +3,11 @@ # Supported ONNX Operation for Target *NNPA*. -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. +Onnx-mlir currently supports ONNX operations targeting up to opset 22. 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. * Operations are defined by the [ONNX Standard](https://github.com/onnx/onnx/blob/main/docs/Operators.md). * **Supported Opsets** indicates the lowest and highest opset a model may have for onnx-mlir to support compiling a model with the operator. - * A * indicates onnx-mlir is compatible with the latest version of that operator available as of opset 21. + * A * indicates onnx-mlir is compatible with the latest version of that operator available as of opset 22. * A ^ indicates onnx-mlir is compatible with the latest level of the NNPA Architecture which is z16. diff --git a/docs/SupportedONNXOps-cpu.md b/docs/SupportedONNXOps-cpu.md index 172c9ed7ca..7b6c643776 100644 --- a/docs/SupportedONNXOps-cpu.md +++ b/docs/SupportedONNXOps-cpu.md @@ -3,11 +3,11 @@ # Supported ONNX Operation for Target *cpu*. -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. +Onnx-mlir currently supports ONNX operations targeting up to opset 22. 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. * Operations are defined by the [ONNX Standard](https://github.com/onnx/onnx/blob/main/docs/Operators.md). * **Supported Opsets** indicates the lowest and highest opset a model may have for onnx-mlir to support compiling a model with the operator. - * A * indicates onnx-mlir is compatible with the latest version of that operator available as of opset 21. + * A * indicates onnx-mlir is compatible with the latest version of that operator available as of opset 22. | Op |Supported Opsets (inclusive) |Limitations |Notes | diff --git a/src/Dialect/ONNX/ONNXOps.hpp b/src/Dialect/ONNX/ONNXOps.hpp index febb5207c0..e104b97ae6 100644 --- a/src/Dialect/ONNX/ONNXOps.hpp +++ b/src/Dialect/ONNX/ONNXOps.hpp @@ -26,7 +26,9 @@ namespace mlir { // OpSet level supported by onnx-mlir -static constexpr int CURRENT_ONNX_OPSET = 20; +// To update all occurrence of the current ONNX opset, please grep +// "CURRENT_ONNX_OPSET" and update all locations accordingly. +static constexpr int CURRENT_ONNX_OPSET = 22; } // end namespace mlir #define GET_OP_CLASSES diff --git a/utils/pre-onnx-mlir.py b/utils/pre-onnx-mlir.py index 66a5ea4a2c..54f8b6f517 100644 --- a/utils/pre-onnx-mlir.py +++ b/utils/pre-onnx-mlir.py @@ -39,7 +39,8 @@ # ==UPDATE_ONNX_VERSION_OPSET== # Look for tag above and update all references when upgrading the ONNX support within ONNX-MLIR. -current_onnx_opset = 21 +# To update all occurrence of the current ONNX opset, please grep "CURRENT_ONNX_OPSET" and update all locations accordingly. +current_onnx_opset = 22 converted_model = version_converter.convert_version(original_model, current_onnx_opset) @@ -58,4 +59,4 @@ + ".onnx" ) onnx.save(converted_model, outFile) - print("The converted model is aved to " + outFile) + print("The converted model is saved to " + outFile)