Skip to content

Conversation

justinchuby
Copy link
Collaborator

@justinchuby justinchuby commented Sep 9, 2025

Fix rewriter CI tests for the latest onnx-ir version (currently in main). Since the latest onnx-ir is now returning tuples for repeated attributes, we need to update the comparison logic to account for that.

Copy link

codecov bot commented Sep 9, 2025

Codecov Report

❌ Patch coverage is 95.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 70.21%. Comparing base (0e79b62) to head (ecbcaae).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...ipt/rewriter/ort_fusions/fused_matmul_rule_sets.py 66.66% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2554      +/-   ##
==========================================
- Coverage   70.34%   70.21%   -0.13%     
==========================================
  Files         218      218              
  Lines       26424    26426       +2     
  Branches     2647     2648       +1     
==========================================
- Hits        18587    18556      -31     
- Misses       6934     6968      +34     
+ Partials      903      902       -1     

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

Signed-off-by: Justin Chu <[email protected]>
Signed-off-by: Justin Chu <[email protected]>
Signed-off-by: Justin Chu <[email protected]>
Signed-off-by: Justin Chu <[email protected]>
Signed-off-by: Justin Chu <[email protected]>
@justinchuby justinchuby changed the title Fix CI tests for the latest onnx-ir version Fix rewriter for the latest onnx-ir version Sep 9, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR updates the rewriter to work with the latest onnx-ir version by addressing API changes. The main change is replacing deprecated function calls and fixing attribute handling compatibility issues.

Key Changes

  • Replace deprecated _check_shape function with check_shape_bool throughout fusion modules
  • Fix attribute comparison issues for sequence types in pattern matching
  • Correct assertion order in test files for better readability

Reviewed Changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated no comments.

Show a summary per file
File Description
onnxscript/rewriter/ort_fusions/skip_normalization.py Updates function call from deprecated _check_shape to check_shape_bool
onnxscript/rewriter/ort_fusions/mha_bias.py Updates function call from deprecated _check_shape to check_shape_bool
onnxscript/rewriter/ort_fusions/mha.py Updates function call from deprecated _check_shape to check_shape_bool
onnxscript/rewriter/ort_fusions/gqa_packed_qkv.py Updates function call from deprecated _check_shape to check_shape_bool
onnxscript/rewriter/ort_fusions/gqa.py Updates function call from deprecated _check_shape to check_shape_bool
onnxscript/rewriter/ort_fusions/attention.py Updates function call from deprecated _check_shape to check_shape_bool
onnxscript/rewriter/ort_fusions/fused_matmul_rule_sets_test.py Reorders assertion parameters for better readability
onnxscript/rewriter/ort_fusions/fused_matmul_rule_sets.py Fixes attribute type handling and comparison issues
onnxscript/rewriter/_rewrite_rule.py Fixes attribute comparison by converting to list
onnxscript/rewriter/_pattern_ir.py Improves attribute pattern matching for sequence types
onnxscript/rewriter/_fusion_utils.py Renames deprecated function and adds new wrapper function

@justinchuby justinchuby changed the title Fix rewriter for the latest onnx-ir version Fix rewriter and CI tests for the latest onnx-ir version Sep 9, 2025
@justinchuby justinchuby marked this pull request as ready for review September 9, 2025 23:53
@justinchuby justinchuby added this to the 0.5.0 milestone Sep 10, 2025
@justinchuby justinchuby merged commit 710d597 into main Sep 10, 2025
31 of 32 checks passed
@justinchuby justinchuby deleted the justinchu/fix-test branch September 10, 2025 20:12
ir.AttributeType.STRINGS,
}:
# Since the type of attr.value is Sequence, we need to convert to the same type for comparison.
return tuple(attr.value) == tuple(self._value)
Copy link
Member

Choose a reason for hiding this comment

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

should we cast every value in the tuple?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Discussed offline. Will do when needed

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

Successfully merging this pull request may close these issues.

3 participants