Implement schema-based input/attribute partitioning in GraphBuilder#2837
Implement schema-based input/attribute partitioning in GraphBuilder#2837gramalingam merged 5 commits intomainfrom
Conversation
gramalingam
commented
Mar 3, 2026
- 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 Report❌ Patch coverage is
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. |
There was a problem hiding this comment.
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_argsparameter toseparate_input_attributes_from_argumentsinparam_manipulation.py, enforcing a check for extra positional arguments when a schema is known and no variadic parameter exists. - Implemented
GraphBuilder._partition_inputs_attributesinbuilder.pyto delegate toseparate_input_attributes_from_argumentsviair.schemas.OpSignature.from_op_schema, using strict mode (fill_defaults=False,allow_extra_args=False). - Refactored the
_buildtest helper inbuilder_test.pyto acceptTypeSpecinputs, maketrace_functionoptional, returnir.Graphdirectly, and added a comprehensivePartitionInputsAttributesTestsuite.
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 |
…nal member Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Closing and reopening to see if it triggers the CI |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>