diff options
author | Mehdi Amini <joker.eph@gmail.com> | 2023-10-20 06:19:31 -0700 |
---|---|---|
committer | Mehdi Amini <joker.eph@gmail.com> | 2024-01-22 17:34:56 -0800 |
commit | d4933b3241f463871cae55bbeec8563e7ffe03a2 (patch) | |
tree | 1505ae4d414faae93e2ad8546d3c43754b79e943 /mlir | |
parent | acf2f24ac3288c1342edbeaba0fdd4e432b4ccb8 (diff) | |
download | llvm-d4933b3241f463871cae55bbeec8563e7ffe03a2.zip llvm-d4933b3241f463871cae55bbeec8563e7ffe03a2.tar.gz llvm-d4933b3241f463871cae55bbeec8563e7ffe03a2.tar.bz2 |
Apply clang-tidy fixes for readability-identifier-naming in PolynomialApproximation.cpp (NFC)
Diffstat (limited to 'mlir')
-rw-r--r-- | mlir/lib/Dialect/Math/Transforms/PolynomialApproximation.cpp | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/mlir/lib/Dialect/Math/Transforms/PolynomialApproximation.cpp b/mlir/lib/Dialect/Math/Transforms/PolynomialApproximation.cpp index 533b14e..71e4e13 100644 --- a/mlir/lib/Dialect/Math/Transforms/PolynomialApproximation.cpp +++ b/mlir/lib/Dialect/Math/Transforms/PolynomialApproximation.cpp @@ -1016,20 +1016,20 @@ ExpApproximation::matchAndRewrite(math::ExpOp op, // 2^-126. // Constants. - Value cst_half = bcast(f32Cst(builder, 0.5f)); - Value cst_one = bcast(f32Cst(builder, 1.0f)); + Value cstHalf = bcast(f32Cst(builder, 0.5f)); + Value cstOne = bcast(f32Cst(builder, 1.0f)); // 1/log(2) - Value cst_log2ef = bcast(f32Cst(builder, 1.44269504088896341f)); + Value cstLog2ef = bcast(f32Cst(builder, 1.44269504088896341f)); - Value cst_exp_c1 = bcast(f32Cst(builder, -0.693359375f)); - Value cst_exp_c2 = bcast(f32Cst(builder, 2.12194440e-4f)); - Value cst_exp_p0 = bcast(f32Cst(builder, 1.9875691500E-4f)); - Value cst_exp_p1 = bcast(f32Cst(builder, 1.3981999507E-3f)); - Value cst_exp_p2 = bcast(f32Cst(builder, 8.3334519073E-3f)); - Value cst_exp_p3 = bcast(f32Cst(builder, 4.1665795894E-2f)); - Value cst_exp_p4 = bcast(f32Cst(builder, 1.6666665459E-1f)); - Value cst_exp_p5 = bcast(f32Cst(builder, 5.0000001201E-1f)); + Value cstExpC1 = bcast(f32Cst(builder, -0.693359375f)); + Value cstExpC2 = bcast(f32Cst(builder, 2.12194440e-4f)); + Value cstExpP0 = bcast(f32Cst(builder, 1.9875691500E-4f)); + Value cstExpP1 = bcast(f32Cst(builder, 1.3981999507E-3f)); + Value cstExpP2 = bcast(f32Cst(builder, 8.3334519073E-3f)); + Value cstExpP3 = bcast(f32Cst(builder, 4.1665795894E-2f)); + Value cstExpP4 = bcast(f32Cst(builder, 1.6666665459E-1f)); + Value cstExpP5 = bcast(f32Cst(builder, 5.0000001201E-1f)); // Our computations below aren't particularly sensitive to the exact choices // here, so we choose values a bit larger/smaller than @@ -1038,7 +1038,7 @@ ExpApproximation::matchAndRewrite(math::ExpOp op, // log(2^-126) = -87.337... Value x = op.getOperand(); x = clampWithNormals(builder, shape, x, -87.8f, 88.8f); - Value n = floor(fmla(x, cst_log2ef, cst_half)); + Value n = floor(fmla(x, cstLog2ef, cstHalf)); // When we eventually do the multiplication in e^a * 2^n, we need to handle // 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, n = clampWithNormals(builder, shape, n, -127.0f, 127.0f); // Computes x = x - n' * log(2), the value for `a` - x = fmla(cst_exp_c1, n, x); - x = fmla(cst_exp_c2, n, x); + x = fmla(cstExpC1, n, x); + x = fmla(cstExpC2, n, x); // Polynomial to compute z = e^a, accurate for a in (-0.5, 0.5). - Value z = fmla(x, cst_exp_p0, cst_exp_p1); - z = fmla(z, x, cst_exp_p2); - z = fmla(z, x, cst_exp_p3); - z = fmla(z, x, cst_exp_p4); - z = fmla(z, x, cst_exp_p5); + Value z = fmla(x, cstExpP0, cstExpP1); + z = fmla(z, x, cstExpP2); + z = fmla(z, x, cstExpP3); + z = fmla(z, x, cstExpP4); + z = fmla(z, x, cstExpP5); z = fmla(z, mul(x, x), x); - z = add(cst_one, z); + z = add(cstOne, z); // Convert n' to an i32. This is safe because we clamped it above. - auto i32_vec = broadcast(builder.getI32Type(), shape); - Value n_i32 = builder.create<arith::FPToSIOp>(i32_vec, n); + auto i32Vec = broadcast(builder.getI32Type(), shape); + Value nI32 = builder.create<arith::FPToSIOp>(i32Vec, n); // Creates the value 2^n' if -126 <= n' <= 127 and 0 if n' = -127. - Value pow2 = exp2I32(builder, n_i32); + Value pow2 = exp2I32(builder, nI32); // Return z * 2^n' if -126 <= n' <= 127 and 0 if n = -127. Value ret = mul(z, pow2); |