[Pallas] xsa TPU sweep: use bfloat16 (was float16, hit Mosaic vector-type bug) - #3204
Merged
Conversation
…type bug) The float16 shapes hit TPU Mosaic's "Invalid vector type for load" codegen error (the vector<8x128x2xf16> layout fp16 forces on head_dim=256), FAILing both xsa rows in the 07-28 sweep. bfloat16 sidesteps this, matches every other bf16-attention row in benchmarks/run_tpu.py, and is what test_examples.test_xsa uses (HALF_DTYPE resolves to bf16 on TPU). Verified on TPU v7 with full autotune + subprocess-per-shape: [2,32,1024,256]: Helion 0.62 ms → 2.59x vs eager, 1.74x vs torch.compile [4,32,2048,256]: Helion 1.60 ms → 5.45x vs eager, 2.52x vs torch.compile
norx1991
marked this pull request as ready for review
July 29, 2026 21:40
jansel
approved these changes
Jul 31, 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.
Summary
Change the xsa TPU sweep from
float16tobfloat16. Both xsa rows FAILed in the 2026-07-28 full sweep with:fp16at head_dim=256 forces thevector<8x128x2xf16>layout (2 elements per lane), which trips a Mosaic codegen path.bfloat16avoids that layout and compiles fine. It's also the dtypetest_examples.test_xsauses on TPU (HALF_DTYPEresolves tobf16there) and matches every other bf16-attention row inbenchmarks/run_tpu.py.Verified on TPU v7 with full autotune +
--subprocess-per-shape:[2,32,1024,256][4,32,2048,256]