Skip to content

Commit b8353d1

Browse files
apaszkeGoogle-ML-Automation
authored andcommitted
[Mosaic TPU] Add support for non-32bit types in vector.extract
At least for as long as the extracted value is not a scalar. PiperOrigin-RevId: 745151577
1 parent f5d73b8 commit b8353d1

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

jaxlib/mosaic/dialect/tpu/transforms/apply_vector_layout.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3740,10 +3740,6 @@ LogicalResult vector_extract_rule(RewriteContext &ctx, Operation &op,
37403740
TPU_ASSERT_EQ_OP(layouts_out.size(), 1);
37413741
TPU_ASSERT_OP(layouts_in.front().has_value());
37423742
const VectorLayout &layout_in = *layouts_in.front();
3743-
if (layout_in.bitwidth() != 32) {
3744-
return op.emitOpError(
3745-
"Not implemented: Only 32-bit vector.extract supported");
3746-
}
37473743
const VectorType res_vty =
37483744
dyn_cast<VectorType>(extract_op.getResult().getType());
37493745
if (res_vty != nullptr) {
@@ -3772,6 +3768,10 @@ LogicalResult vector_extract_rule(RewriteContext &ctx, Operation &op,
37723768
op.erase();
37733769
return success();
37743770
} else {
3771+
if (layout_in.bitwidth() != 32) {
3772+
return op.emitOpError(
3773+
"Not implemented: Only 32-bit vector.extract supported");
3774+
}
37753775
// TODO(b/367459476): Support non-zero offsets.
37763776
if (layout_in.offsets() != LayoutOffsets{0, 0}) {
37773777
return op.emitOpError("Not implemented: Unsupported layout");

0 commit comments

Comments
 (0)