[converter] Harden mixed-source SymInt lowerings under dynamic shapes - #13
Merged
gokulkrishna98 merged 2 commits intoJun 15, 2026
Merged
Conversation
…amic shapes Six related fixes that surface together when exporting models whose FX graphs combine SymInt-derived shape arithmetic with mixed source element types and ranks: 1. _aten_to_core_resolver / replace_binary_ops _op_map: register a bare 'pow' entry alongside the variant-suffixed ones. Some torch.export rewrites leave ``aten.pow`` as the OpOverloadPacket target with no overload suffix; without this entry the converter raises ``Unsupported ATen op: pow``. 2. Same registries for bare 'round': torch.export can leave ``aten.round`` without a ``.default`` overload, mirroring the pow case. 3. upsample_build_output_shape_dynamic: ensure each (out_h, out_w) operand is rank-1 with int32 element type before the concat that builds the output shape — the dialect verifier rejects mixed-rank / mixed-element-type concat inputs. Hits when out_h/out_w are SymInts derived from ``round(SymFloat)`` arithmetic. 4. get_operand mixed-list path (SymInt + plain int): normalise each resolved Value to the same canonical rank-1 si32 form and emit plain-int constants with explicit ``dtype=np.int32`` so the dim-vector concat sees uniform operands. Hits ops like ``view``, ``expand``, ``reshape``, ``repeat`` whenever a dim list mixes SymInts with ints. 5. replace_cat: when one input has a dynamic non-concat axis and a sibling has a known static size for that axis, reshape the dynamic side to that static size before the concat. Localised shape inference using the fact that all non-concat dims must be equal — multiple distinct static sizes is left for the dialect verifier to reject. 6. replace_arange_start_step: unify start/end/step element types to the FX node's output dtype before ``coreai.range_``. Mirrors aten.arange's internal type promotion since coreai.range_'s verifier requires uniform element types. Adds a shared ``to_rank1_int32(v)`` helper in ``_utils.py`` so fixes 3 and 4 share one canonical normalization (rank-0 → rank-1, cast to signed int32 if needed); both call sites collapse to one line per operand. One regression test per non-trivial fix, each verified to FAIL without the fix and PASS with it (verified by reverting each fix individually): - TestRound: bare ``aten.round`` overload-packet target must lower. - TestUpsampleNearest2d / TestUpsampleBilinear2d::test_round_symfloat_size: ``round((num / aspect) ** 0.5) * 14`` output_size produces SymInts whose Value type doesn't match the int32 constants used elsewhere. Pre-fix: ``coreai.concat`` raises ``Operation creation failed``. - TestView::test_view_with_round_symfloat_dims: same trigger applied to a ``view([1, C, h, w])`` mixed list. Pre-fix: ``expected the same element type for all inputs to concat``. - TestCat::test_dynamic_vs_static_non_concat_axis: ``Dim.AUTO`` on one side + static sibling forces non-concat-axis promotion. - TestArange::test_symint_end_with_float_start_step: float ``arange`` with SymInt-derived end exercises the element-type unify.
gokulkrishna98
force-pushed
the
dev/gokul/flmnormals-bare-pow
branch
from
June 13, 2026 02:12
a7e11bf to
1c26f1f
Compare
gokulkrishna98
marked this pull request as ready for review
June 13, 2026 02:22
gokulkrishna98
requested review from
DawerG,
Lewis300,
TobyRoseman,
YifanShenSZ,
cymbalrush and
jakesabathia2
June 13, 2026 02:23
TobyRoseman
reviewed
Jun 15, 2026
This was referenced Jun 15, 2026
cymbalrush
approved these changes
Jun 15, 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.
Description
Six small fixes in
_aten_to_core.py/_utils.py, all surfacing from the same root cause: FX graphs that mix SymInt-derived Values (varying ranks / element types) with plain-int constants flow into coreai ops whose verifiers require uniform operands.aten.powin_op_mapand resolver — sometorch.exportrewrites leaveaten.powas the bare overload-packet target.aten.round.upsample_build_output_shape_dynamic— normalise each(out_h, out_w)to rank-1si32before the output-shape concat.get_operandmixed-list path — same normalisation for the dim-vector concat used byview/expand/reshape/repeat.replace_cat— when one input has a dynamic non-concat axis and a sibling has a known static size for the same axis, reshape the dynamic side to the static size before concat. Conflicting static sizes are left for the verifier (real shape mismatch).replace_arange_start_step— unifystart/end/stepto the FX-node output dtype beforecoreai.range_, mirroring aten's internal promotion.Fixes 3 and 4 share a new
to_rank1_int32(v)helper.Testing