Skip to content

Commit d4933b3

Browse files
committed
Apply clang-tidy fixes for readability-identifier-naming in PolynomialApproximation.cpp (NFC)
1 parent acf2f24 commit d4933b3

File tree

1 file changed

+23
-23
lines changed

1 file changed

+23
-23
lines changed

mlir/lib/Dialect/Math/Transforms/PolynomialApproximation.cpp

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1016,20 +1016,20 @@ ExpApproximation::matchAndRewrite(math::ExpOp op,
10161016
// 2^-126.
10171017

10181018
// Constants.
1019-
Value cst_half = bcast(f32Cst(builder, 0.5f));
1020-
Value cst_one = bcast(f32Cst(builder, 1.0f));
1019+
Value cstHalf = bcast(f32Cst(builder, 0.5f));
1020+
Value cstOne = bcast(f32Cst(builder, 1.0f));
10211021

10221022
// 1/log(2)
1023-
Value cst_log2ef = bcast(f32Cst(builder, 1.44269504088896341f));
1023+
Value cstLog2ef = bcast(f32Cst(builder, 1.44269504088896341f));
10241024

1025-
Value cst_exp_c1 = bcast(f32Cst(builder, -0.693359375f));
1026-
Value cst_exp_c2 = bcast(f32Cst(builder, 2.12194440e-4f));
1027-
Value cst_exp_p0 = bcast(f32Cst(builder, 1.9875691500E-4f));
1028-
Value cst_exp_p1 = bcast(f32Cst(builder, 1.3981999507E-3f));
1029-
Value cst_exp_p2 = bcast(f32Cst(builder, 8.3334519073E-3f));
1030-
Value cst_exp_p3 = bcast(f32Cst(builder, 4.1665795894E-2f));
1031-
Value cst_exp_p4 = bcast(f32Cst(builder, 1.6666665459E-1f));
1032-
Value cst_exp_p5 = bcast(f32Cst(builder, 5.0000001201E-1f));
1025+
Value cstExpC1 = bcast(f32Cst(builder, -0.693359375f));
1026+
Value cstExpC2 = bcast(f32Cst(builder, 2.12194440e-4f));
1027+
Value cstExpP0 = bcast(f32Cst(builder, 1.9875691500E-4f));
1028+
Value cstExpP1 = bcast(f32Cst(builder, 1.3981999507E-3f));
1029+
Value cstExpP2 = bcast(f32Cst(builder, 8.3334519073E-3f));
1030+
Value cstExpP3 = bcast(f32Cst(builder, 4.1665795894E-2f));
1031+
Value cstExpP4 = bcast(f32Cst(builder, 1.6666665459E-1f));
1032+
Value cstExpP5 = bcast(f32Cst(builder, 5.0000001201E-1f));
10331033

10341034
// Our computations below aren't particularly sensitive to the exact choices
10351035
// here, so we choose values a bit larger/smaller than
@@ -1038,7 +1038,7 @@ ExpApproximation::matchAndRewrite(math::ExpOp op,
10381038
// log(2^-126) = -87.337...
10391039
Value x = op.getOperand();
10401040
x = clampWithNormals(builder, shape, x, -87.8f, 88.8f);
1041-
Value n = floor(fmla(x, cst_log2ef, cst_half));
1041+
Value n = floor(fmla(x, cstLog2ef, cstHalf));
10421042

10431043
// When we eventually do the multiplication in e^a * 2^n, we need to handle
10441044
// the case when n > 127, the max fp32 exponent (so 2^n == inf) but e^a < 1
@@ -1082,24 +1082,24 @@ ExpApproximation::matchAndRewrite(math::ExpOp op,
10821082
n = clampWithNormals(builder, shape, n, -127.0f, 127.0f);
10831083

10841084
// Computes x = x - n' * log(2), the value for `a`
1085-
x = fmla(cst_exp_c1, n, x);
1086-
x = fmla(cst_exp_c2, n, x);
1085+
x = fmla(cstExpC1, n, x);
1086+
x = fmla(cstExpC2, n, x);
10871087

10881088
// Polynomial to compute z = e^a, accurate for a in (-0.5, 0.5).
1089-
Value z = fmla(x, cst_exp_p0, cst_exp_p1);
1090-
z = fmla(z, x, cst_exp_p2);
1091-
z = fmla(z, x, cst_exp_p3);
1092-
z = fmla(z, x, cst_exp_p4);
1093-
z = fmla(z, x, cst_exp_p5);
1089+
Value z = fmla(x, cstExpP0, cstExpP1);
1090+
z = fmla(z, x, cstExpP2);
1091+
z = fmla(z, x, cstExpP3);
1092+
z = fmla(z, x, cstExpP4);
1093+
z = fmla(z, x, cstExpP5);
10941094
z = fmla(z, mul(x, x), x);
1095-
z = add(cst_one, z);
1095+
z = add(cstOne, z);
10961096

10971097
// Convert n' to an i32. This is safe because we clamped it above.
1098-
auto i32_vec = broadcast(builder.getI32Type(), shape);
1099-
Value n_i32 = builder.create<arith::FPToSIOp>(i32_vec, n);
1098+
auto i32Vec = broadcast(builder.getI32Type(), shape);
1099+
Value nI32 = builder.create<arith::FPToSIOp>(i32Vec, n);
11001100

11011101
// Creates the value 2^n' if -126 <= n' <= 127 and 0 if n' = -127.
1102-
Value pow2 = exp2I32(builder, n_i32);
1102+
Value pow2 = exp2I32(builder, nI32);
11031103

11041104
// Return z * 2^n' if -126 <= n' <= 127 and 0 if n = -127.
11051105
Value ret = mul(z, pow2);

0 commit comments

Comments
 (0)