llvm-project/mlir/test/mlir-cpu-runner
Emilio Cota 35553d452b [mlir] Add polynomial approximation for vectorized math::Rsqrt
This patch adds a polynomial approximation that matches the
approximation in Eigen.

Note that the approximation only applies to vectorized inputs;
the scalar rsqrt is left unmodified.

The approximation is protected with a flag since it emits an AVX2
intrinsic (generated via the X86Vector). This is the only reasonably
clean way that I could find to generate the exact approximation that
I wanted (i.e. an identical one to Eigen's).

I considered two alternatives:

1. Introduce a Rsqrt intrinsic in LLVM, which doesn't exist yet.
   I believe this is because there is no definition of Rsqrt that
   all backends could agree on, since hardware instructions that
   implement it have widely varying degrees of precision.
   This is something that the standard could mandate, but Rsqrt is
   not part of IEEE754, so I don't think this option is feasible.

2. Emit fdiv(1.0, sqrt) with fast math flags to allow reciprocal
   transformations. Although portable, this doesn't allow us
   to generate exactly the code we want; it is the LLVM backend,
   and not MLIR, who controls what code is generated based on the
   target CPU.

Reviewed By: ezhulenev

Differential Revision: https://reviews.llvm.org/D112192
2021-10-23 04:56:12 -07:00
..
X86Vector [mlir] Add polynomial approximation for vectorized math::Rsqrt 2021-10-23 04:56:12 -07:00
async-error.mlir [MLIR] Replace std ops with arith dialect ops 2021-10-13 03:07:03 +00:00
async-group.mlir [MLIR] Replace std ops with arith dialect ops 2021-10-13 03:07:03 +00:00
async-value.mlir [MLIR] Replace std ops with arith dialect ops 2021-10-13 03:07:03 +00:00
async.mlir [MLIR] Replace std ops with arith dialect ops 2021-10-13 03:07:03 +00:00
bare_ptr_call_conv.mlir [MLIR] Replace std ops with arith dialect ops 2021-10-13 03:07:03 +00:00
copy.mlir [MLIR] Replace std ops with arith dialect ops 2021-10-13 03:07:03 +00:00
global_memref.mlir [MLIR] Replace std ops with arith dialect ops 2021-10-13 03:07:03 +00:00
lit.local.cfg Revert "Attempt to disable MLIR JIT tests on PowerPC to unbreak the bot" 2021-06-29 18:03:23 -05:00
math_polynomial_approx.mlir Avoid infinity arithmetics when computing exp approximations 2021-10-21 10:09:18 -07:00
memref_reinterpret_cast.mlir [MLIR] Replace std ops with arith dialect ops 2021-10-13 03:07:03 +00:00
memref_reshape.mlir [MLIR] Replace std ops with arith dialect ops 2021-10-13 03:07:03 +00:00
sgemm_naive_codegen.mlir [MLIR] Replace std ops with arith dialect ops 2021-10-13 03:07:03 +00:00
simple.mlir [mlir] replace LLVM dialect float types with built-ins 2021-01-08 17:38:12 +01:00
unranked_memref.mlir [MLIR] Replace std ops with arith dialect ops 2021-10-13 03:07:03 +00:00
utils.mlir [MLIR] Replace std ops with arith dialect ops 2021-10-13 03:07:03 +00:00