Skip to content

Commit 3558537

Browse files
committed
[MLIR] Apply clang-tidy fixes for readability-identifier-naming in TosaOps.cpp (NFC)
1 parent bb40d94 commit 3558537

File tree

1 file changed

+65
-66
lines changed

1 file changed

+65
-66
lines changed

mlir/lib/Dialect/Tosa/IR/TosaOps.cpp

Lines changed: 65 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -2301,9 +2301,9 @@ LogicalResult tosa::MulOp::verify() {
23012301
}
23022302

23032303
// verify shift has value 0 for non-integer types
2304-
ElementsAttr shift_elem;
2305-
if (matchPattern(getShift(), m_Constant(&shift_elem))) {
2306-
int32_t shift = shift_elem.getValues<IntegerAttr>()[0].getInt();
2304+
ElementsAttr shiftElem;
2305+
if (matchPattern(getShift(), m_Constant(&shiftElem))) {
2306+
int32_t shift = shiftElem.getValues<IntegerAttr>()[0].getInt();
23072307
if (shift != 0) {
23082308
return emitOpError() << "require shift to be 0 for float type";
23092309
}
@@ -2882,39 +2882,39 @@ LogicalResult tosa::GatherOp::verify() {
28822882
const ShapeAdaptor indicesShape(getIndices().getType());
28832883
const ShapeAdaptor outputShape(getOutput().getType());
28842884

2885-
int64_t N = ShapedType::kDynamic;
2886-
int64_t W = ShapedType::kDynamic;
2887-
int64_t C = ShapedType::kDynamic;
2885+
int64_t n = ShapedType::kDynamic;
2886+
int64_t w = ShapedType::kDynamic;
2887+
int64_t c = ShapedType::kDynamic;
28882888

28892889
if (valuesShape.hasRank()) {
2890-
N = valuesShape.getDimSize(0);
2891-
C = valuesShape.getDimSize(2);
2890+
n = valuesShape.getDimSize(0);
2891+
c = valuesShape.getDimSize(2);
28922892
}
28932893
if (indicesShape.hasRank()) {
28942894
const int64_t indicesN = indicesShape.getDimSize(0);
2895-
W = indicesShape.getDimSize(1);
2896-
if (N == ShapedType::kDynamic)
2897-
N = indicesN;
2898-
else if (indicesN != ShapedType::kDynamic && N != indicesN)
2899-
return emitOpError() << "requires indices dimension 0 to have size " << N
2895+
w = indicesShape.getDimSize(1);
2896+
if (n == ShapedType::kDynamic)
2897+
n = indicesN;
2898+
else if (indicesN != ShapedType::kDynamic && n != indicesN)
2899+
return emitOpError() << "requires indices dimension 0 to have size " << n
29002900
<< ", got " << indicesN;
29012901
}
29022902
if (outputShape.hasRank()) {
29032903
const int64_t outputN = outputShape.getDimSize(0);
29042904
const int64_t outputW = outputShape.getDimSize(1);
29052905
const int64_t outputC = outputShape.getDimSize(2);
2906-
if (N != ShapedType::kDynamic && outputN != ShapedType::kDynamic &&
2907-
N != outputN)
2908-
return emitOpError() << "requires output dimension 0 to have size " << N
2906+
if (n != ShapedType::kDynamic && outputN != ShapedType::kDynamic &&
2907+
n != outputN)
2908+
return emitOpError() << "requires output dimension 0 to have size " << n
29092909
<< ", got " << outputN;
29102910

2911-
if (W != ShapedType::kDynamic && outputW != ShapedType::kDynamic &&
2912-
W != outputW)
2913-
return emitOpError() << "requires output dimension 1 to have size " << W
2911+
if (w != ShapedType::kDynamic && outputW != ShapedType::kDynamic &&
2912+
w != outputW)
2913+
return emitOpError() << "requires output dimension 1 to have size " << w
29142914
<< ", got " << outputW;
2915-
if (C != ShapedType::kDynamic && outputC != ShapedType::kDynamic &&
2916-
C != outputC)
2917-
return emitOpError() << "requires output dimension 2 to have size " << C
2915+
if (c != ShapedType::kDynamic && outputC != ShapedType::kDynamic &&
2916+
c != outputC)
2917+
return emitOpError() << "requires output dimension 2 to have size " << c
29182918
<< ", got " << outputC;
29192919
}
29202920
return success();
@@ -3107,66 +3107,66 @@ LogicalResult tosa::ScatterOp::verify() {
31073107
const ShapeAdaptor inputShape(getInput().getType());
31083108
const ShapeAdaptor outputShape(getValuesOut().getType());
31093109

3110-
int64_t N = ShapedType::kDynamic;
3111-
int64_t K = ShapedType::kDynamic;
3112-
int64_t W = ShapedType::kDynamic;
3113-
int64_t C = ShapedType::kDynamic;
3110+
int64_t n = ShapedType::kDynamic;
3111+
int64_t k = ShapedType::kDynamic;
3112+
int64_t w = ShapedType::kDynamic;
3113+
int64_t c = ShapedType::kDynamic;
31143114
if (valuesInShape.hasRank()) {
3115-
N = valuesInShape.getDimSize(0);
3116-
K = valuesInShape.getDimSize(1);
3117-
C = valuesInShape.getDimSize(2);
3115+
n = valuesInShape.getDimSize(0);
3116+
k = valuesInShape.getDimSize(1);
3117+
c = valuesInShape.getDimSize(2);
31183118
}
31193119
if (indicesShape.hasRank()) {
31203120
const int64_t indicesN = indicesShape.getDimSize(0);
3121-
W = indicesShape.getDimSize(1);
3122-
if (N == ShapedType::kDynamic)
3123-
N = indicesN;
3124-
else if (indicesN != ShapedType::kDynamic && N != indicesN)
3125-
return emitOpError() << "requires indices dimension 0 to have size " << N
3121+
w = indicesShape.getDimSize(1);
3122+
if (n == ShapedType::kDynamic)
3123+
n = indicesN;
3124+
else if (indicesN != ShapedType::kDynamic && n != indicesN)
3125+
return emitOpError() << "requires indices dimension 0 to have size " << n
31263126
<< ", got " << indicesN;
31273127
}
31283128
if (inputShape.hasRank()) {
31293129
const int64_t inputN = inputShape.getDimSize(0);
31303130
const int64_t inputW = inputShape.getDimSize(1);
31313131
const int64_t inputC = inputShape.getDimSize(2);
3132-
if (N == ShapedType::kDynamic)
3133-
N = inputN;
3134-
else if (inputN != ShapedType::kDynamic && N != inputN)
3135-
return emitOpError() << "requires input dimension 0 to have size " << N
3132+
if (n == ShapedType::kDynamic)
3133+
n = inputN;
3134+
else if (inputN != ShapedType::kDynamic && n != inputN)
3135+
return emitOpError() << "requires input dimension 0 to have size " << n
31363136
<< ", got " << inputN;
3137-
if (W == ShapedType::kDynamic)
3138-
W = inputW;
3139-
else if (inputW != ShapedType::kDynamic && W != inputW)
3140-
return emitOpError() << "requires input dimension 1 to have size " << W
3137+
if (w == ShapedType::kDynamic)
3138+
w = inputW;
3139+
else if (inputW != ShapedType::kDynamic && w != inputW)
3140+
return emitOpError() << "requires input dimension 1 to have size " << w
31413141
<< ", got " << inputW;
31423142

3143-
if (C == ShapedType::kDynamic)
3144-
C = inputC;
3145-
else if (inputC != ShapedType::kDynamic && C != inputC)
3146-
return emitOpError() << "requires input dimension 2 to have size " << C
3143+
if (c == ShapedType::kDynamic)
3144+
c = inputC;
3145+
else if (inputC != ShapedType::kDynamic && c != inputC)
3146+
return emitOpError() << "requires input dimension 2 to have size " << c
31473147
<< ", got " << inputC;
31483148
}
31493149
if (outputShape.hasRank()) {
31503150
const int64_t outputN = outputShape.getDimSize(0);
31513151
const int64_t outputK = outputShape.getDimSize(1);
31523152
const int64_t outputC = outputShape.getDimSize(2);
3153-
if (N != ShapedType::kDynamic && outputN != ShapedType::kDynamic &&
3154-
N != outputN)
3153+
if (n != ShapedType::kDynamic && outputN != ShapedType::kDynamic &&
3154+
n != outputN)
31553155
return emitOpError() << "requires values_out dimension 0 to have size "
3156-
<< N << ", got " << outputN;
3157-
if (K == ShapedType::kDynamic)
3158-
K = outputK;
3159-
else if (outputK != ShapedType::kDynamic && K != outputK)
3156+
<< n << ", got " << outputN;
3157+
if (k == ShapedType::kDynamic)
3158+
k = outputK;
3159+
else if (outputK != ShapedType::kDynamic && k != outputK)
31603160
return emitOpError() << "requires values_out dimension 1 to have size "
3161-
<< K << ", got " << outputK;
3162-
if (C != ShapedType::kDynamic && outputC != ShapedType::kDynamic &&
3163-
C != outputC)
3161+
<< k << ", got " << outputK;
3162+
if (c != ShapedType::kDynamic && outputC != ShapedType::kDynamic &&
3163+
c != outputC)
31643164
return emitOpError() << "requires values_out dimension 2 to have size "
3165-
<< C << ", got " << outputC;
3165+
<< c << ", got " << outputC;
31663166
}
3167-
if (K != ShapedType::kDynamic && W != ShapedType::kDynamic && !(K >= W))
3168-
return emitOpError() << "requires dimensions K >= W, got K=" << K
3169-
<< " and W=" << W;
3167+
if (k != ShapedType::kDynamic && w != ShapedType::kDynamic && !(k >= w))
3168+
return emitOpError() << "requires dimensions K >= W, got K=" << k
3169+
<< " and W=" << w;
31703170

31713171
return success();
31723172
}
@@ -3741,14 +3741,13 @@ LogicalResult TransposeConv2DOp::verify() {
37413741
<< strides << "]";
37423742

37433743
const auto checkPadAgainstKernelDim =
3744-
[this](int64_t pad_value, int64_t kernel_dim_size,
3745-
llvm::StringRef pad_name,
3746-
llvm::StringRef kernel_dim_name) -> LogicalResult {
3747-
if (pad_value <= -kernel_dim_size)
3744+
[this](int64_t padValue, int64_t kernelDimSize, llvm::StringRef padName,
3745+
llvm::StringRef kernelDimName) -> LogicalResult {
3746+
if (padValue <= -kernelDimSize)
37483747
return emitOpError("expected ")
3749-
<< pad_name << " > -" << kernel_dim_name
3750-
<< ", but got: " << pad_name << "=" << pad_value << " and "
3751-
<< kernel_dim_name << "=" << kernel_dim_size;
3748+
<< padName << " > -" << kernelDimName << ", but got: " << padName
3749+
<< "=" << padValue << " and " << kernelDimName << "="
3750+
<< kernelDimSize;
37523751
return success();
37533752
};
37543753

0 commit comments

Comments
 (0)