Skip to content

Comments

Add MergeNamedShardingIfCompatible to hlo_sharding_util.#38137

Open
copybara-service[bot] wants to merge 1 commit intomainfrom
test_872820304
Open

Add MergeNamedShardingIfCompatible to hlo_sharding_util.#38137
copybara-service[bot] wants to merge 1 commit intomainfrom
test_872820304

Conversation

@copybara-service
Copy link

Add MergeNamedShardingIfCompatible to hlo_sharding_util.

This change introduces a utility function to merge two NamedSharding instances if they are compatible. The merging logic aims to find the most specific sharding for each dimension by taking the longer axis sequence if one is a prefix of the other, while ensuring no conflicts with axes used in other dimensions. The existing MergeShardingIfCompatible is updated to use this new function when both shardings are NamedShardings. New test cases are added to validate the NamedSharding merge behavior.

This change introduces a utility function to merge two NamedSharding instances if they are compatible. The merging logic aims to find the most specific sharding for each dimension by taking the longer axis sequence if one is a prefix of the other, while ensuring no conflicts with axes used in other dimensions. The existing MergeShardingIfCompatible is updated to use this new function when both shardings are NamedShardings. New test cases are added to validate the NamedSharding merge behavior.

PiperOrigin-RevId: 872820304
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.

0 participants