Skip to content

Remove arith dependency from DynamicIotaOpToBroadcast#2918

Open
brucechanglongxu wants to merge 1 commit intoopenxla:mainfrom
brucechanglongxu:fix-dynamic-iota-remove-arith-dep
Open

Remove arith dependency from DynamicIotaOpToBroadcast#2918
brucechanglongxu wants to merge 1 commit intoopenxla:mainfrom
brucechanglongxu:fix-dynamic-iota-remove-arith-dep

Conversation

@brucechanglongxu
Copy link

The DynamicIotaOpToBroadcast pattern was pulling in an arith dialect
dependency to handle index-typed shapes via arith.index_cast. This is
unnecessary — by the time aggressive simplification runs, shapes should
already be legalized to integer types via shape-legalize-to-stablehlo.

Now the pattern bails out on index-typed shapes instead of introducing
arith ops, and the ArithDialect dependency is dropped from the pass
entirely. For non-i64 integer shapes (e.g. i32), it still uses
stablehlo.convert; for i64 it skips the conversion altogether.

Updated the test to verify the index case is left untouched.

Fixes #2628

The pattern was using arith.index_cast to convert index-typed shapes to
i64, pulling in an unnecessary arith dialect dependency. Now it bails out
on index-typed shapes (users should run shape-legalize-to-stablehlo
first) and uses stablehlo.convert for non-i64 integer types. Also skips
the convert entirely when the shape is already i64.

This removes the arith::ArithDialect dependency from the
StablehloAggressiveSimplification pass.

Fixes openxla#2628
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.

Incorrect pattern DynamicIotaOpToBroadcast

1 participant