[Pallas] Use exact RDIM size instead of next-power-of-2#1954
Draft
[Pallas] Use exact RDIM size instead of next-power-of-2#1954
Conversation
Pallas block refs use exact tensor dimensions, so rounding RDIM_SIZE to the next power of 2 (e.g., 1000→1024) causes shape mismatches. Add Backend.static_rdim_size() and override it in PallasBackend to return the exact size. Also override next_power_of_2_host_expr to be a no-op for Pallas. Removes @xfailIfPallas from test_reduce_non_pow2 added in #1945.
3b39bfb to
28c1f75
Compare
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.
Summary
_RDIM_SIZEwas rounded to the next power of 2 (e.g., 1000→1024), causingValueError: Incompatible shapes for broadcasting.Backend.static_rdim_size()andBackend.dynamic_rdim_size_expr()which default to next-power-of-2 behavior, and override both inPallasBackendto return exact sizes.@xfailIfPallasfromtest_reduce_non_pow2added in [Pallas] Add expected-failure test for non-power-of-2 RDIM size #1945.Test plan
test_reduce_non_pow2fails without fix:ValueError: Incompatible shapes for broadcasting: shapes=[(128, 1024), (128, 1000)]test_reduce_non_pow2passes with fix (_RDIM_SIZE_1 = 1000)