[Mlir-commits] [mlir] 57c56cf - X86Vector: relax checks in rsqrt's integration test

Aart Bik llvmlistbot at llvm.org
Fri Oct 8 13:59:30 PDT 2021


Author: Emilio Cota
Date: 2021-10-08T13:59:18-07:00
New Revision: 57c56cf20cfa017b89bdabfc2bfd46384a25fdc7

URL: https://github.com/llvm/llvm-project/commit/57c56cf20cfa017b89bdabfc2bfd46384a25fdc7
DIFF: https://github.com/llvm/llvm-project/commit/57c56cf20cfa017b89bdabfc2bfd46384a25fdc7.diff

LOG: X86Vector: relax checks in rsqrt's integration test

Instead of hard-coding results for both Intel and AMD, let's relax
the checks to simplify the test while supporting both implementations.
Note that:
- If a new hardware implementation comes up in the future, it is likely
  to pass the relaxed tests, i.e. no future maintenance burden for us.
- If something terribly wrong happens (e.g. instead of rsqrt we
  execute 1/sqrt), the tests will probably catch it, since the relaxed
  tests expect low precision (e.g. rsqrt(1) != 1.0).

Reviewed By: aartbik

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

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 37cded3f4b574..03248e4114b66 100644
--- a/mlir/test/Integration/Dialect/Vector/CPU/X86Vector/test-rsqrt.mlir
+++ b/mlir/test/Integration/Dialect/Vector/CPU/X86Vector/test-rsqrt.mlir
@@ -9,7 +9,7 @@ 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>
   // `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 )}}
+  // CHECK: {{( 2.82[0-9]*, 1.99[0-9]*, 1.41[0-9]*, 0.99[0-9]*, 0.70[0-9]*, 0.49[0-9]*, 0.35[0-9]*, 0.24[0-9]* )}}
   vector.print %r : vector<8xf32>
 
   return %i0 : i32


        


More information about the Mlir-commits mailing list