Skip to content

Commit 4254524

Browse files
Google-ML-Automationcharleshofer
authored andcommitted
Use llvm::cast/dyn_cast/isa since alternatives are deprecated in llvm/llvm-project#135556
PiperOrigin-RevId: 748551976
1 parent 85eb58a commit 4254524

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

jaxlib/mosaic/dialect/tpu/tpu_ops.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1096,7 +1096,7 @@ LogicalResult ConcatenateOp::verify() {
10961096
if (getOperands().size() < 2) {
10971097
return emitOpError("Expected at least 2 operands for concatenate op.");
10981098
}
1099-
auto first_type = getOperand(0).getType().cast<VectorType>();
1099+
auto first_type = cast<VectorType>(getOperand(0).getType());
11001100
auto first_shape = first_type.getShape();
11011101
auto first_dtype = first_type.getElementType();
11021102
for (auto operand : getOperands()) {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ LogicalResult tpu_matmul_rule(const CanonicalizeContext &ctx,
257257
auto matmul_res =
258258
dot_dim_matmul(sliced_lhs.getResult(), sliced_rhs.getResult(),
259259
sliced_acc.getResult());
260-
auto res_ty = matmul_res.getType().cast<VectorType>();
260+
auto res_ty = cast<VectorType>(matmul_res.getType());
261261
auto res_shape = res_ty.getShape();
262262
// reshape to 1x[prior_shape]
263263
auto reshape_shape = llvm::to_vector(res_shape);

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,10 @@ class VectorLayoutInferer {
136136

137137
bool has_vector_io = false;
138138
for (auto op : any_op.getOperands()) {
139-
has_vector_io |= op.getType().isa<VectorType>();
139+
has_vector_io |= isa<VectorType>(op.getType());
140140
}
141141
for (auto r : any_op.getResults()) {
142-
has_vector_io |= r.getType().isa<VectorType>();
142+
has_vector_io |= isa<VectorType>(r.getType());
143143
}
144144
if (!has_vector_io && any_op.getRegions().empty()) {
145145
SmallVector<Layout, 4> in_layout(any_op.getNumOperands(), kNoLayout);
@@ -1293,7 +1293,7 @@ class VectorLayoutInferer {
12931293
(*(offsets.end() - 1) + *input_layout->offsets()[1]) % vreg_slice[1];
12941294
}
12951295
for (auto stride : strides_attr) {
1296-
TPU_CHECK_OP(stride.cast<IntegerAttr>().getInt() == 1,
1296+
TPU_CHECK_OP(cast<IntegerAttr>(stride).getInt() == 1,
12971297
"Only trivial strides supported.");
12981298
}
12991299

0 commit comments

Comments
 (0)