Driver and API updates for using sym shapes - #4946
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends MIGraphX’s symbolic dynamic-shape support end-to-end by exposing sym::expr through the driver, the C/C++ API surface, and Python bindings, and adds API/Python tests to validate symbolic dimension construction and ONNX parsing behavior.
Changes:
- Add
sym::expr/sym_expr(C API + C++ handle) and enable symbolic dynamic dimensions viadynamic_dimension(sym_expr)andis_symbolic(). - Extend ONNX options and front-ends (driver + Python bindings) to enable symbolic shapes and pass
dim_params. - Add new C++ and Python tests for symbolic dynamic dimensions and ONNX parsing.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
src/driver/main.cpp |
Adds --enable-symbolic and supports "name" in dynamic-dim JSON to create symbolic dims. |
src/api/include/migraphx/migraphx.h |
Introduces C API migraphx_sym_expr_t and related functions; adds symbolic dynamic-dimension APIs. |
src/api/include/migraphx/migraphx.hpp |
Adds C++ sym_expr handle wrapper and dynamic_dimension(sym_expr) / is_symbolic() accessors. |
src/api/api.cpp |
Implements the new C API for sym_expr, symbolic dynamic dimensions, and ONNX option setters. |
tools/api/api.cpp |
Adds helper(s) used by generated bindings for creating symbolic variables and ONNX option setters. |
src/api/migraphx.py |
Exposes the new migraphx_sym_expr handle + operators and ONNX option setters in the generated API. |
src/py/migraphx_py.cpp |
Adds migraphx.sym submodule, symbolic dynamic_dimension ctor, and ONNX parse flags/params in Python. |
test/api/test_symbolic_shape.cpp |
Adds C++ API tests for symbolic dynamic dimensions and ONNX parsing behavior. |
test/api/CMakeLists.txt |
Registers the new C++ API test. |
test/py/test_symbolic_shape.py |
Adds Python tests for symbolic expressions/dimensions and ONNX parsing behavior. |
test/py/CMakeLists.txt |
Registers the new Python test. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #4946 +/- ##
===========================================
- Coverage 93.27% 93.26% -0.00%
===========================================
Files 623 623
Lines 32889 32969 +80
===========================================
+ Hits 30674 30747 +73
- Misses 2215 2222 +7
🚀 New features to boost your workflow:
|
pfultz2
requested changes
Jun 7, 2026
pfultz2
reviewed
Jun 7, 2026
TedThemistokleous
approved these changes
Jun 24, 2026
pfultz2
reviewed
Jun 26, 2026
Regressions detected 🔴 * No develop baseline was found for this PR's branch point; compared against the latest available develop run instead. |
|
kahmed10
self-requested a review
July 23, 2026 20:36
kahmed10
requested changes
Jul 24, 2026
kahmed10
left a comment
Collaborator
There was a problem hiding this comment.
can you update docs/driver/read.rst?
kahmed10
approved these changes
Jul 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Update the driver flags and C/Python APIs to properly allow symbolic shape inputs.
Technical Details
Exposes symbolic dynamic dimensions (
sym::expr) through the driver, C API, and Python API.--enable-symbolicflag; dynamic-dim JSON now accepts a"name"key to make a dim symbolic. Fixed a crash in the single-object--dim-parampath.migraphx_sym_exprtype (var/literal/parse, arithmetic ops,to_string);dynamic_dimension(sym_expr)+is_symbolic();onnx_optionssettersset_use_symbolic_shapes/set_dim_param.migraphx.symsubmodule (expr,var/lit/parse, operators);dynamic_dimension(expr)+is_symbolic();use_symbolic_shapesonparse_onnx/parse_onnx_buffer, plusdim_paramson the buffer variant.test/api/test_symbolic_shape.cppandtest/py/test_symbolic_shape.py.Changelog Category
Add a
CHANGELOG.mdentry for any option other thanNot Applicable