Skip to content

[Frontend] Remove the dead convert_index floor/mod codegen path#303

Merged
YWHyuk merged 1 commit into
developfrom
cleanup/remove-convert-index-develop
Jul 14, 2026
Merged

[Frontend] Remove the dead convert_index floor/mod codegen path#303
YWHyuk merged 1 commit into
developfrom
cleanup/remove-convert-index-develop

Conversation

@YWHyuk

@YWHyuk YWHyuk commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator

Summary

Rebase of the dead-code-removal commit from #271 onto develop, standalone.

axis-split's affine-only contract (docs/axis-split-scheduling.md) linearizes aligned FloorDiv/ModularIndexing into per-axis affine indices upstream, so the load/store index reaching MLIR codegen is already pure affine. The convert_index method (which lowered floor/mod view indices to affine.apply with a constant divisor and a single free symbol) and the helper guarding it are therefore dead. This mirrors the assert the DMA-index path already carries; here it makes the load/store affine-index path consistent with it.

Removes convert_index, inlines its only live behaviour at the call sites, and replaces the floor/mod branches with a loud NotImplementedError so any residual floor/mod that escapes axis-split fails instead of silently mis-lowering. Drops the now-unused re import.

Verification (on develop + this commit)

Cherry-pick onto latest develop is clean (auto-merge, no conflict). The view/reshape/transpose suite passes end-to-end and the new guard never fires:

  • test_floormod_axis_split: 10 passed (group_norm c//(C/G), repeat, repeat_interleave, mixed-radix, pixel_shuffle, incompatible-radix, case7 reshape/softmax/layernorm)
  • test_transpose2D: 4 passed
  • test_transpose3D: 6 passed
  • test_view3D_2D: 3 passed
  • test_cat: 10 passed

Total 33 passed, 0 failed; no NotImplementedError raised.

🤖 Generated with Claude Code

https://claude.ai/code/session_018yhfJ2Vw9fWagy6QWrNhi2

axis-split's affine-only contract (docs/axis-split-scheduling.md) linearizes
aligned FloorDiv/ModularIndexing into per-axis affine indices upstream, so the
load/store index reaching codegen is already pure affine. The convert_index
method (which lowered floor/mod view indices to affine.apply with a constant
divisor and a single free symbol) and the helper that guarded it are therefore
dead -- a tripwire at every floor/mod branch never fired across the view/op test
suite.

Remove convert_index entirely and inline its only live behaviour at the call
sites in _convert_sympy_to_mlir_expr and parse_index_list. A residual
FloorDiv/ModularIndexing now fails loudly via the whole-expression guard in each
of those functions (mirroring the DMA-index assert) instead of silently
mis-lowering. Also drop the assumption-stripping Symbol(str(...)) + expr.replace
round-trip in the affine-map builder: it only mattered when convert_index
transformed the term, and is now a verified no-op (indices and the affine string
depend only on symbol names). Drop the now-unused re import.

Verified: the full view/reshape/transpose suite (test_floormod_axis_split incl.
group_norm/repeat/repeat_interleave/mixed-radix/pixel_shuffle, transpose2D/3D,
view3D_2D, cat) plus add/matmul/reduce/softmax/layernorm/batchnorm pass
unchanged.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SfwHCV7TaX4s9xkn8i7anG
@YWHyuk
YWHyuk merged commit 093e3b2 into develop Jul 14, 2026
132 of 134 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant