Skip to content

Commit 580c3d3

Browse files
willg-nvsugunav14
authored andcommitted
Integrate Automated QDQ placement tool - part 2.1 (#844)
## What does this PR do? This PR implements RegionPattern class. RegionPattern describes local topology structure of a Region. Regions with same Pattern could be autotune together. Best insertion points of a given pattern could also be saved to accelerate the next QDQ autotuning. **Overview:** ? ## Usage ```python python -m modelopt.onnx.quantization.autotune.region_search --model model.onnx --verbose ``` ``` ├─ Region 212 (Level 0, Type: COMPOSITE) │ ├─ Direct nodes: 0 │ ├─ Total nodes (recursive): 9 │ ├─ Children: 1 │ ├─ Inputs: 3 tensors │ │ - xxx │ │ - xxx │ │ - xxx │ └─ Outputs: 1 tensors │ - xxx │ │ Child regions: │ ├─ Region 209 (Level 2, Type: LEAF) │ ├─ Direct nodes: 9 │ ├─ Total nodes (recursive): 9 │ ├─ Children: 0 │ ├─ Inputs: 11 tensors │ │ - xxx ``` ## Testing <!-- Mention how have you tested your change if applicable. --> ## Before your PR is "*Ready for review*" <!-- If you haven't finished some of the above items you can still open `Draft` PR. --> - **Make sure you read and follow [Contributor guidelines](https://github.com/NVIDIA/Model-Optimizer/blob/main/CONTRIBUTING.md)** and your commits are signed. - **Is this change backward compatible?**: Yes - **Did you write any new necessary tests?**: Yes - **Did you add or update any necessary documentation?**: No, document update is in Part 4 - **Did you update [Changelog](https://github.com/NVIDIA/Model-Optimizer/blob/main/CHANGELOG.rst)?**: CHANGELOG update could be done after all changes are ready. ## Additional Information <!-- E.g. related issue. --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Release Notes * **New Features** * Enhanced ONNX quantization analysis with improved region pattern matching and comparison capabilities. * Added utility to identify quantized tensors in models for better analysis. * **Tests** * Comprehensive test coverage for region pattern functionality and quantization utilities. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Signed-off-by: Will Guo <willg@nvidia.com>
1 parent e82a677 commit 580c3d3

File tree

4 files changed

+887
-0
lines changed

4 files changed

+887
-0
lines changed

modelopt/onnx/op_types.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,3 +367,22 @@ def get_set_ops():
367367
"Unique",
368368
"NonZero",
369369
}
370+
371+
372+
def get_symmetric_ops():
373+
"""Returns set of commutative/symmetric operations where operand order doesn't matter."""
374+
return {
375+
"Add",
376+
"Mul",
377+
"And",
378+
"Or",
379+
"Xor",
380+
"Equal",
381+
"Max",
382+
"Min",
383+
"Sum",
384+
"Mean",
385+
"BitwiseAnd",
386+
"BitwiseOr",
387+
"BitwiseXor",
388+
}

0 commit comments

Comments
 (0)