Skip to content

Integrate Automated QDQ placement tool - part 2.3#846

Open
willg-nv wants to merge 2 commits intoNVIDIA:mainfrom
willg-nv:dev-willg-integrate-auto-qdq-placement-part2.3
Open

Integrate Automated QDQ placement tool - part 2.3#846
willg-nv wants to merge 2 commits intoNVIDIA:mainfrom
willg-nv:dev-willg-integrate-auto-qdq-placement-part2.3

Conversation

@willg-nv
Copy link
Contributor

@willg-nv willg-nv commented Feb 3, 2026

What does this PR do?

This PR implement RegionInspect tool. This tool could be used to visualize the regions parititioned by RegionSearch classes. This tool could be used to analyze if the partitioned regions match the fusion patterns.

Overview: ?

Usage

# Add a code snippet demonstrating how to use this

Testing

Before your PR is "Ready for review"

  • Make sure you read and follow Contributor guidelines 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?: No, CHANGELOG will be updated when all changes are ready.

Additional Information

Summary by CodeRabbit

New Features

  • Added a region inspection tool for ONNX models. Analyzes model structure and generates detailed reports including region statistics, hierarchical relationships, node coverage metrics, and size distribution analysis. Available through a command-line interface with configurable parameters.

@willg-nv willg-nv requested a review from a team as a code owner February 3, 2026 03:12
@willg-nv willg-nv requested a review from ajrasane February 3, 2026 03:12
@copy-pr-bot
Copy link

copy-pr-bot bot commented Feb 3, 2026

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 3, 2026

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

  • 🔍 Trigger a full review
📝 Walkthrough

Walkthrough

Introduces a new module that provides region search inspection capabilities for ONNX models. The tool loads models, converts them to GraphSurgeon graphs, executes a two-phase region search, collects and filters regions, generates statistics, and exposes both programmatic and CLI interfaces.

Changes

Cohort / File(s) Summary
Region Inspection Tool
modelopt/onnx/quantization/autotune/region_inspect.py
New module (203 lines) implementing ONNX model region search inspection. Provides inspect_region_search() function for programmatic use and main() CLI entry point. Executes two-phase region search (partitioning and refinement), logs hierarchical relationships and per-region metrics, generates summary statistics including region type counts and coverage percentages, and produces size distribution histograms for LEAF regions.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Title check ⚠️ Warning The title references an automated QDQ placement tool integration but the PR primarily introduces RegionInspect, a region search inspection visualization tool. Revise the title to accurately reflect that this PR adds RegionInspect tool for visualizing and analyzing regions from RegionSearch, such as: 'Add RegionInspect tool for region search visualization and analysis'.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In `@modelopt/onnx/quantization/autotune/region_inspect.py`:
- Around line 189-196: The log message is misleading because
inspect_region_search returns all regions but the logger.info says "top-level
regions"; update the logger.info call that logs len(regions) (the variable
assigned from inspect_region_search) to accurately describe the content (e.g.,
"regions discovered" or "all regions discovered") so the message reflects that
inspect_region_search returns all_regions rather than only top-level regions.
- Around line 47-57: Update the docstring in region_inspect.py so the API name
matches the implementation: replace references to search() with search_regions()
(and any nearby mention of "Two-Phase Search: Runs automatically via
CombinedRegionSearch.search()" to "CombinedRegionSearch.search_regions()") and
scan the surrounding text for any other mismatched mentions of search() to
ensure all documentation refers to the actual method
CombinedRegionSearch.search_regions().

@willg-nv willg-nv force-pushed the dev-willg-integrate-auto-qdq-placement-part2.3 branch from 68d3339 to a03ea73 Compare February 3, 2026 03:37
Signed-off-by: Will Guo <willg@nvidia.com>
@willg-nv willg-nv force-pushed the dev-willg-integrate-auto-qdq-placement-part2.3 branch from a03ea73 to 610d9a9 Compare February 3, 2026 03:39
@gcunhase
Copy link
Contributor

gcunhase commented Feb 3, 2026

@willg-nv can we add a unittest for this file? Thanks.

Signed-off-by: Will Guo <willg@nvidia.com>
@willg-nv
Copy link
Contributor Author

willg-nv commented Feb 4, 2026

@willg-nv can we add a unittest for this file? Thanks.

Yes, please check the latest commit.

Copy link
Contributor

@gcunhase gcunhase left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, deferring final approval to @ajrasane, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants