[Mlir-commits] [mlir] 82cd8b8 - Fix test-rsqrt.mlir to accept AMD's approximation of rsqrt as well

Mehdi Amini llvmlistbot at llvm.org
Thu Oct 7 21:24:39 PDT 2021


Author: Mehdi Amini
Date: 2021-10-08T04:24:24Z
New Revision: 82cd8b81aad5f33b054e6576b5ee85ceb9063107

URL: https://github.com/llvm/llvm-project/commit/82cd8b81aad5f33b054e6576b5ee85ceb9063107
DIFF: https://github.com/llvm/llvm-project/commit/82cd8b81aad5f33b054e6576b5ee85ceb9063107.diff

LOG: Fix test-rsqrt.mlir to accept AMD's approximation of rsqrt as well

These kind of function can behave differently on these X86 chips, there
isn't really "one true answer" so we'll accept both.

Also remove spurious passes and use mattr="avx" to match the instruction
used here.

Differential Revision: https://reviews.llvm.org/D111373

Added: 
    

Modified: 
    mlir/test/Integration/Dialect/Vector/CPU/X86Vector/test-rsqrt.mlir

Removed: 
    


################################################################################
diff  --git a/mlir/test/Integration/Dialect/Vector/CPU/X86Vector/test-rsqrt.mlir b/mlir/test/Integration/Dialect/Vector/CPU/X86Vector/test-rsqrt.mlir
index 4d02bb3f6e5c..37cded3f4b57 100644
--- a/mlir/test/Integration/Dialect/Vector/CPU/X86Vector/test-rsqrt.mlir
+++ b/mlir/test/Integration/Dialect/Vector/CPU/X86Vector/test-rsqrt.mlir
@@ -1,6 +1,6 @@
-// RUN: mlir-opt %s -convert-scf-to-std -convert-vector-to-llvm="enable-x86vector" -convert-std-to-llvm -reconcile-unrealized-casts | \
+// RUN: mlir-opt %s -convert-vector-to-llvm="enable-x86vector" -convert-std-to-llvm | \
 // RUN: mlir-translate --mlir-to-llvmir | \
-// RUN: %lli --entry-function=entry --mattr="avx512bw" --dlopen=%mlir_integration_test_dir/libmlir_c_runner_utils%shlibext | \
+// RUN: %lli --entry-function=entry --mattr="avx" --dlopen=%mlir_integration_test_dir/libmlir_c_runner_utils%shlibext | \
 // RUN: FileCheck %s
 
 func @entry() -> i32 {
@@ -8,7 +8,8 @@ func @entry() -> i32 {
 
   %v = std.constant dense<[0.125, 0.25, 0.5, 1.0, 2.0, 4.0, 8.0, 16.0]> : vector<8xf32>
   %r = x86vector.avx.rsqrt %v : vector<8xf32>
-  // CHECK: ( 2.82764, 1.99951, 1.41382, 0.999756, 0.706909, 0.499878, 0.353455, 0.249939 )
+  // `rsqrt` may produce slightly 
diff erent results on Intel and AMD machines: accept both results here.
+  // CHECK: {{( 2.82764, 1.99951, 1.41382, 0.999756, 0.706909, 0.499878, 0.353455, 0.249939 | 2.82812, 1.99976, 1.41406, 0.999878, 0.707031, 0.499939, 0.353516, 0.249969 )}}
   vector.print %r : vector<8xf32>
 
   return %i0 : i32


        


More information about the Mlir-commits mailing list