Skip to content

Conversation

@galagam
Copy link
Contributor

@galagam galagam commented Jan 28, 2026

What does this PR do?

Type of change: Bug fix

Overview:
Conducted a thorough code review for AutoCast using ClaudeCode to identify bugs and improve code quality.
Fixed some low hanging issues.

Implemented fixes:

  • DepthReductionRule: normalize negative axis and check for valid axis range
  • Init scale_dimension in GraphSanitizer to None (was left uninitialized)
  • Simplify logic around custom_ops_low_precision_nodes and prevent duplicate nodes

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?: No
  • Did you add or update any necessary documentation?: No
  • Did you update Changelog?: No

Additional Information

Summary by CodeRabbit

  • Bug Fixes

    • Fixed potential undefined variable error in layer normalization pattern detection.
  • Improvements

    • Optimized low-precision node classification to eliminate duplicate processing, improving efficiency of the autocast system.

✏️ Tip: You can customize this high-level summary in your review settings.

@galagam galagam requested a review from a team as a code owner January 28, 2026 13:10
@galagam galagam requested a review from gcunhase January 28, 2026 13:10
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 28, 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

Two internal utility modules are updated: a variable initialization fix in the graph sanitizer to prevent undefined-variable usage, and a deduplication optimization in the node classifier that uses a set-based approach to prevent reprocessing of low-precision nodes.

Changes

Cohort / File(s) Summary
Graph Sanitizer
modelopt/onnx/autocast/graphsanitizer.py
Initialize scale_dimension = None before final_node assignment to guarantee the variable is always defined before use
Node Classifier
modelopt/onnx/autocast/nodeclassifier.py
Deduplicate low-precision nodes during classification by using a set to track processed nodes; skip reprocessing nodes already in the low-precision set; convert set back to list before returning to maintain public API signature

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title '[ONNX][Autocast] Minor bug fixes (AI-assisted)' is directly related to the changeset, which contains bug fixes in ONNX autocast modules (graphsanitizer.py and nodeclassifier.py). It accurately summarizes the main change.

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


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.

- Conducted a thorough code review for AutoCast using ClaudeCode to identify bugs.
- Implemented fixes:
  - Axis normalization in DepthReductionRule, check for valid axis range
  - Init scale_dimension in GraphSanitizer to None (was left uninitialized)
  - Simplify logic around custom_ops_low_precision_nodes and prevent
    duplicate nodes to be added

Signed-off-by: Gal Hubara Agam <96368689+galagam@users.noreply.github.com>
@galagam galagam force-pushed the dev-gagam-claude-code-bugfixes branch from 7495550 to 7958d38 Compare January 28, 2026 13:12
@NVIDIA NVIDIA deleted a comment from copy-pr-bot bot Jan 28, 2026
@codecov
Copy link

codecov bot commented Jan 28, 2026

Codecov Report

❌ Patch coverage is 54.54545% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 74.01%. Comparing base (2c73de0) to head (7958d38).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
modelopt/onnx/autocast/nodeclassifier.py 50.00% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #822      +/-   ##
==========================================
- Coverage   74.02%   74.01%   -0.02%     
==========================================
  Files         192      192              
  Lines       19664    19672       +8     
==========================================
+ Hits        14557    14560       +3     
- Misses       5107     5112       +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

1 participant