Skip to content

Implement schema-based input/attribute partitioning in GraphBuilder#2837

Merged
gramalingam merged 5 commits intomainfrom
rama/params
Mar 6, 2026
Merged

Implement schema-based input/attribute partitioning in GraphBuilder#2837
gramalingam merged 5 commits intomainfrom
rama/params

Conversation

@gramalingam
Copy link
Collaborator

  • Convert onnx.defs.OpSchema to ir.schemas.OpSignature via from_op_schema and delegate to separate_input_attributes_from_arguments
  • Add allow_extra_args parameter to separate_input_attributes_from_arguments for rejecting unexpected positional arguments (default True for compat)
  • Builder uses strict mode: allow_extra_kwargs=False, allow_extra_args=False
  • Refactor _build test helper: accept TypeSpec, optional trace_function, return ir.Graph directly
  • Add comprehensive tests for input/attribute partitioning

- Convert onnx.defs.OpSchema to ir.schemas.OpSignature via from_op_schema
  and delegate to separate_input_attributes_from_arguments
- Add allow_extra_args parameter to separate_input_attributes_from_arguments
  for rejecting unexpected positional arguments (default True for compat)
- Builder uses strict mode: allow_extra_kwargs=False, allow_extra_args=False
- Refactor _build test helper: accept TypeSpec, optional trace_function,
  return ir.Graph directly
- Add comprehensive tests for input/attribute partitioning

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@codecov
Copy link

codecov bot commented Mar 3, 2026

Codecov Report

❌ Patch coverage is 95.41284% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 71.89%. Comparing base (bab4f28) to head (e330026).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
onnxscript/_internal/builder_test.py 95.00% 2 Missing and 3 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2837      +/-   ##
==========================================
+ Coverage   71.81%   71.89%   +0.07%     
==========================================
  Files         239      239              
  Lines       29054    29134      +80     
  Branches     2866     2871       +5     
==========================================
+ Hits        20865    20945      +80     
+ Misses       7217     7215       -2     
- Partials      972      974       +2     

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

Copy link
Contributor

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 activates schema-based input/attribute partitioning in GraphBuilder, which was previously stubbed out. It also adds an allow_extra_args parameter to separate_input_attributes_from_arguments for strict positional-argument validation, and refactors the _build test helper to return ir.Graph directly (removing the intermediate ir.Model wrapper).

Changes:

  • Added allow_extra_args parameter to separate_input_attributes_from_arguments in param_manipulation.py, enforcing a check for extra positional arguments when a schema is known and no variadic parameter exists.
  • Implemented GraphBuilder._partition_inputs_attributes in builder.py to delegate to separate_input_attributes_from_arguments via ir.schemas.OpSignature.from_op_schema, using strict mode (fill_defaults=False, allow_extra_args=False).
  • Refactored the _build test helper in builder_test.py to accept TypeSpec inputs, make trace_function optional, return ir.Graph directly, and added a comprehensive PartitionInputsAttributesTest suite.

Reviewed changes

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

File Description
onnxscript/_internal/param_manipulation.py Adds allow_extra_args parameter and validates extra positional args after the main loop
onnxscript/_internal/builder.py Implements _partition_inputs_attributes using schema-based partitioning instead of a no-op stub
onnxscript/_internal/builder_test.py Refactors _build helper and adds PartitionInputsAttributesTest covering 9 new test cases

@gramalingam gramalingam enabled auto-merge (squash) March 5, 2026 05:26
gramalingam and others added 2 commits March 4, 2026 21:33
…nal member

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy link
Collaborator

@justinchuby justinchuby left a comment

Choose a reason for hiding this comment

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

Could you add labels to the PR? Thanks

@gramalingam gramalingam closed this Mar 6, 2026
auto-merge was automatically disabled March 6, 2026 17:18

Pull request was closed

@gramalingam
Copy link
Collaborator Author

Closing and reopening to see if it triggers the CI

@gramalingam gramalingam reopened this Mar 6, 2026
@gramalingam gramalingam enabled auto-merge (squash) March 6, 2026 17:19
@gramalingam gramalingam merged commit 46e6f69 into main Mar 6, 2026
29 of 33 checks passed
@gramalingam gramalingam deleted the rama/params branch March 6, 2026 21:19
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