Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Mosaic TPU] Fold sublane offset to indices when storing to untiled ref. #24919

Merged
merged 1 commit into from
Nov 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions jaxlib/mosaic/dialect/tpu/transforms/infer_vector_layout.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1640,14 +1640,14 @@ class VectorLayoutInferer {
// Since it is untiled, we can store to any arbitrary address which
// means the sublane offset can be any value and we can fold it to
// 2nd minor index.
// TODO(jevinjiang): We can fold the sublane offset into the 2nd minor
// index. But we need to handle negative index in lower-to-llo. For
// now, we just force the sublane offset to be 0.
auto prev_store_layout = getLayout(op.getValueToStore());
TPU_CHECK_OP(prev_store_layout.has_value(), "missing vector layout");
offsets[0] = prev_store_layout->offsets()[0].value_or(0);
if (offsets[1].value_or(0) >= tiling[1]) {
offsets[1] = 0;
}
store_layout = VectorLayout(bitwidth, {0, offsets[1]},
nativeTiling(bitwidth), ImplicitDim::kNone);
store_layout = VectorLayout(bitwidth, offsets, nativeTiling(bitwidth),
ImplicitDim::kNone);
} else {
store_layout = VectorLayout(bitwidth, offsets, {tiling[0], tiling[1]},
ImplicitDim::kNone);
Expand Down
Loading