From ed803e663a0473f2158f8436b1ce1bda6328a0f6 Mon Sep 17 00:00:00 2001 From: chenyx113 Date: Thu, 13 Mar 2025 20:54:07 +0800 Subject: [PATCH 1/2] [tools/onnx-subgraph] add config.json for onnx model splitting config.json for onnx model splitting, it will be used in future PRs ONE-DCO-1.0-Signed-off-by: Youxin Chen --- tools/onnx_subgraph/CMakeLists.txt | 1 + tools/onnx_subgraph/config.json | 13 +++++++++++++ 2 files changed, 14 insertions(+) create mode 100644 tools/onnx_subgraph/config.json diff --git a/tools/onnx_subgraph/CMakeLists.txt b/tools/onnx_subgraph/CMakeLists.txt index 1acacb37848..04dcb37469d 100644 --- a/tools/onnx_subgraph/CMakeLists.txt +++ b/tools/onnx_subgraph/CMakeLists.txt @@ -19,6 +19,7 @@ set(ONNX_SUBGRAPH_FILES extract_onnx.py subgraphs_ios.txt single_vs_multiple_onnx.py + config.json ) foreach(ONNX_SUBGRAPH IN ITEMS ${ONNX_SUBGRAPH_FILES}) set(ONNX_SUBGRAPH_FILE ${ONNX_SUBGRAPH}) diff --git a/tools/onnx_subgraph/config.json b/tools/onnx_subgraph/config.json new file mode 100644 index 00000000000..7c974712943 --- /dev/null +++ b/tools/onnx_subgraph/config.json @@ -0,0 +1,13 @@ +{ + "NPU_supported_ops": ["Conv", "Reshape", "Transpose", "Add", "ReduceMean", "Sub", "Div", "Mul", "Sigmoid","MatMul"], + "CPU_supported_ops": ["Sub", "Pow", "ReduceMean", "Add", "Sqrt", "Div","Transpose", "Gather", "MatMul", "Mul", "Softmax", "Erf", "Gemm", "Conv", "Reshape", + "Sin", "Where", "ConstantOfShape", "Cast", "Sigmoid", "Cos", "Expand", "Slice", "Unsqueeze"], + "performance_data": [ + {"name":"Conv","CPU_time": 0.1, "NPU_time": 0.05}, + {"name":"Mul", "CPU_time": 0.15, "NPU_time": 0.07} + ], + "hardware_limits": { + "max_subgraph_size": 60024.0, + "max_subgraphs": 5 + } +} From 5751d0e498a0698ce4ae21f2f647cf172b53cb29 Mon Sep 17 00:00:00 2001 From: chenyx113 Date: Mon, 17 Mar 2025 21:35:33 +0800 Subject: [PATCH 2/2] add config.json as examples --- tools/onnx_subgraph/CMakeLists.txt | 1 - tools/onnx_subgraph/config.json | 13 ------------- tools/onnx_subgraph/examples/config-cpunpu.json | 13 +++++++++++++ tools/onnx_subgraph/examples/config-cpuonly.json | 12 ++++++++++++ tools/onnx_subgraph/examples/config-full.json | 14 ++++++++++++++ 5 files changed, 39 insertions(+), 14 deletions(-) delete mode 100644 tools/onnx_subgraph/config.json create mode 100644 tools/onnx_subgraph/examples/config-cpunpu.json create mode 100644 tools/onnx_subgraph/examples/config-cpuonly.json create mode 100644 tools/onnx_subgraph/examples/config-full.json diff --git a/tools/onnx_subgraph/CMakeLists.txt b/tools/onnx_subgraph/CMakeLists.txt index 04dcb37469d..1acacb37848 100644 --- a/tools/onnx_subgraph/CMakeLists.txt +++ b/tools/onnx_subgraph/CMakeLists.txt @@ -19,7 +19,6 @@ set(ONNX_SUBGRAPH_FILES extract_onnx.py subgraphs_ios.txt single_vs_multiple_onnx.py - config.json ) foreach(ONNX_SUBGRAPH IN ITEMS ${ONNX_SUBGRAPH_FILES}) set(ONNX_SUBGRAPH_FILE ${ONNX_SUBGRAPH}) diff --git a/tools/onnx_subgraph/config.json b/tools/onnx_subgraph/config.json deleted file mode 100644 index 7c974712943..00000000000 --- a/tools/onnx_subgraph/config.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "NPU_supported_ops": ["Conv", "Reshape", "Transpose", "Add", "ReduceMean", "Sub", "Div", "Mul", "Sigmoid","MatMul"], - "CPU_supported_ops": ["Sub", "Pow", "ReduceMean", "Add", "Sqrt", "Div","Transpose", "Gather", "MatMul", "Mul", "Softmax", "Erf", "Gemm", "Conv", "Reshape", - "Sin", "Where", "ConstantOfShape", "Cast", "Sigmoid", "Cos", "Expand", "Slice", "Unsqueeze"], - "performance_data": [ - {"name":"Conv","CPU_time": 0.1, "NPU_time": 0.05}, - {"name":"Mul", "CPU_time": 0.15, "NPU_time": 0.07} - ], - "hardware_limits": { - "max_subgraph_size": 60024.0, - "max_subgraphs": 5 - } -} diff --git a/tools/onnx_subgraph/examples/config-cpunpu.json b/tools/onnx_subgraph/examples/config-cpunpu.json new file mode 100644 index 00000000000..700ea499bfa --- /dev/null +++ b/tools/onnx_subgraph/examples/config-cpunpu.json @@ -0,0 +1,13 @@ +{ + "NPU_supported_ops": ["Conv", "Reshape", "Transpose", "Add", "ReduceMean", "Sub", + "Div", "Mul", "Sigmoid","MatMul"], + "CPU_supported_ops": ["Sub", "Pow", "ReduceMean", "Add", "Sqrt", "Div","Transpose", + "Gather", "MatMul", "Mul", "Softmax", "Erf", "Gemm", "Conv", "Reshape", + "Sin", "Where", "ConstantOfShape", "Cast", "Sigmoid", "Cos", "Expand", + "Slice", "Unsqueeze"], + "performance_data": [], + "hardware_limits": { + "max_subgraph_size": 60024.0, + "max_subgraphs": 5 + } +} diff --git a/tools/onnx_subgraph/examples/config-cpuonly.json b/tools/onnx_subgraph/examples/config-cpuonly.json new file mode 100644 index 00000000000..7f408d6a4fd --- /dev/null +++ b/tools/onnx_subgraph/examples/config-cpuonly.json @@ -0,0 +1,12 @@ +{ + "NPU_supported_ops": [], + "CPU_supported_ops": ["Sub", "Pow", "ReduceMean", "Add", "Sqrt", "Div","Transpose", + "Gather", "MatMul", "Mul", "Softmax", "Erf", "Gemm", "Conv", "Reshape", + "Sin", "Where", "ConstantOfShape", "Cast", "Sigmoid", "Cos", "Expand", + "Slice", "Unsqueeze"], + "performance_data": [], + "hardware_limits": { + "max_subgraph_size": 60024.0, + "max_subgraphs": 5 + } +} diff --git a/tools/onnx_subgraph/examples/config-full.json b/tools/onnx_subgraph/examples/config-full.json new file mode 100644 index 00000000000..b5d15f800a5 --- /dev/null +++ b/tools/onnx_subgraph/examples/config-full.json @@ -0,0 +1,14 @@ +{ + "NPU_supported_ops": ["Conv", "Reshape", "Transpose", "Add", "ReduceMean", "Sub", + "Div", "Mul", "Sigmoid","MatMul"], + "CPU_supported_ops": ["Sub", "Pow", "ReduceMean", "Add", "Sqrt", "Div","Transpose", + "Gather", "MatMul", "Mul", "Softmax", "Erf", "Gemm", "Conv", "Reshape", + "Sin", "Where", "ConstantOfShape", "Cast", "Sigmoid", "Cos", "Expand", + "Slice", "Unsqueeze"], + "performance_data": [{"name":"Conv","CPU_time": 0.1, "NPU_time": 0.05}, + {"name":"Mul", "CPU_time": 0.15, "NPU_time": 0.07}], + "hardware_limits": { + "max_subgraph_size": 60024.0, + "max_subgraphs": 5 + } +}