[all-commits] [llvm/llvm-project] 880631: [MLIR][Math] Add erfc to math dialect (#126439)

Jan Leyonberg via All-commits all-commits at lists.llvm.org
Tue Feb 18 07:52:00 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8806311bb7c2b5a4a40698f544f775d62538d7df
      https://github.com/llvm/llvm-project/commit/8806311bb7c2b5a4a40698f544f775d62538d7df
  Author: Jan Leyonberg <jan_sjodin at yahoo.com>
  Date:   2025-02-18 (Tue, 18 Feb 2025)

  Changed paths:
    M mlir/include/mlir/Dialect/Math/IR/MathOps.td
    M mlir/include/mlir/Dialect/Math/Transforms/Approximation.h
    M mlir/include/mlir/Dialect/Math/Transforms/Passes.h
    M mlir/lib/Conversion/MathToLibm/MathToLibm.cpp
    M mlir/lib/Dialect/Math/IR/MathOps.cpp
    M mlir/lib/Dialect/Math/Transforms/PolynomialApproximation.cpp
    M mlir/test/Dialect/Math/polynomial-approximation.mlir
    M mlir/test/mlir-runner/math-polynomial-approx.mlir
    M mlir/utils/vim/syntax/mlir.vim

  Log Message:
  -----------
  [MLIR][Math] Add erfc to math dialect (#126439)

This patch adds the erfc op to the math dialect. It also does lowering
of the math.erfc op to libm calls. There is also a f32 polynomial
approximation for the function based on

https://stackoverflow.com/questions/35966695/vectorizable-implementation-of-complementary-error-function-erfcf
This is in turn based on
M. M. Shepherd and J. G. Laframboise, "Chebyshev Approximation of
(1+2x)exp(x^2)erfc x in 0 <= x < INF", Mathematics of Computation, Vol.
36, No. 153, January 1981, pp. 249-253.
The code has a ULP error less than 3, which was tested, and MLIR test
values were verified against the C implementation.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list