Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dialect/Math/canonicalize.mlir fails on trunk (1e818cd8e262b402bd6d3cb380f83ca06966bb4b) #58048

Closed
ZolotukhinM opened this issue Sep 28, 2022 · 7 comments
Assignees

Comments

@ZolotukhinM
Copy link

ZolotukhinM commented Sep 28, 2022

I was trying to follow instructions on how to build LLVM-MLIR from https://mlir.llvm.org/getting_started/:

cmake -G Ninja ../llvm \
   -DLLVM_ENABLE_PROJECTS=mlir \
   -DLLVM_BUILD_EXAMPLES=ON \
   -DLLVM_TARGETS_TO_BUILD="host" \
   -DCMAKE_BUILD_TYPE=Release \
   -DLLVM_ENABLE_ASSERTIONS=ON
cmake --build . --target check-mlir

The build succeeded, but one test was failing:

FAIL: MLIR :: Dialect/Math/canonicalize.mlir (392 of 1458)
******************** TEST 'MLIR :: Dialect/Math/canonicalize.mlir' FAILED ********************
Script:
--
: 'RUN: at line 1';   /Users/mvz/dev/llvm-project/build/bin/mlir-opt /Users/mvz/dev/llvm-project/mlir/test/Dialect/Math/canonicalize.mlir -canonicalize | /Users/mvz/dev/llvm-project/build/bin/FileCheck /Users/mvz/dev/llvm-project/mlir/test/Dialect/Math/canonicalize.mlir
--
Exit Code: 1

Command Output (stderr):
--
/Users/mvz/dev/llvm-project/mlir/test/Dialect/Math/canonicalize.mlir:452:16: error: CHECK-NEXT: expected string not found in input
// CHECK-NEXT: %[[cst:.+]] = arith.constant 0.84{{[0-9]+}} : f32
               ^
<stdin>:200:21: note: scanning from here
 func.func @sin_fold() -> f32 {
                    ^
<stdin>:201:2: note: possible intended match here
 %cst = arith.constant 8.414710e-01 : f32
 ^
/Users/mvz/dev/llvm-project/mlir/test/Dialect/Math/canonicalize.mlir:461:16: error: CHECK-NEXT: expected string not found in input
// CHECK-NEXT: %[[cst:.+]] = arith.constant dense<[0.000000e+00, 0.84{{[0-9]+}}, 0.000000e+00, 0.84{{[0-9]+}}]> : vector<4xf32>
               ^
<stdin>:204:25: note: scanning from here
 func.func @sin_fold_vec() -> vector<4xf32> {
                        ^
<stdin>:205:2: note: possible intended match here
 %cst = arith.constant dense<[0.000000e+00, 8.414710e-01, 0.000000e+00, 8.414710e-01]> : vector<4xf32>
 ^

Input file: <stdin>
Check file: /Users/mvz/dev/llvm-project/mlir/test/Dialect/Math/canonicalize.mlir

-dump-input=help explains the following input dump.

Input was:
<<<<<<
            .
            .
            .
          195:  }
          196:  func.func @trunc_fold_vec() -> vector<4xf32> {
          197:  %cst = arith.constant dense<[0.000000e+00, -0.000000e+00, 1.000000e+00, -1.000000e+00]> : vector<4xf32>
          198:  return %cst : vector<4xf32>
          199:  }
          200:  func.func @sin_fold() -> f32 {
next:452'0                         X~~~~~~~~~~~ error: no match found
          201:  %cst = arith.constant 8.414710e-01 : f32
next:452'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
next:452'1      ?                                         possible intended match
          202:  return %cst : f32
next:452'0     ~~~~~~~~~~~~~~~~~~~
          203:  }
next:452'0     ~~~
          204:  func.func @sin_fold_vec() -> vector<4xf32> {
next:452'0     ~~~~~~~~~~~~~~~~~~~~~~~~
next:461'0                             X~~~~~~~~~~~~~~~~~~~~~ error: no match found
          205:  %cst = arith.constant dense<[0.000000e+00, 8.414710e-01, 0.000000e+00, 8.414710e-01]> : vector<4xf32>
next:461'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
next:461'1      ?                                                                                                      possible intended match
          206:  return %cst : vector<4xf32>
next:461'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          207:  }
next:461'0     ~~~
          208:  func.func @erf_fold() -> f32 {
next:461'0     ~~~~~~~~~~~~~~~~~~~~
          209:  %cst = arith.constant 0.842700779 : f32
          210:  return %cst : f32
            .
            .
            .
>>>>>>

--

********************
********************
Failed Tests (1):
  MLIR :: Dialect/Math/canonicalize.mlir

It was AArch64 build on M1 MacBook.

@llvmbot
Copy link
Collaborator

llvmbot commented Sep 28, 2022

@llvm/issue-subscribers-mlir

@Mogball
Copy link
Contributor

Mogball commented Sep 28, 2022

@jacquesguan can you take a look at this?

@jacquesguan
Copy link
Contributor

https://reviews.llvm.org/D134850 I create a revision for this, it should work, but I do not have M1 environment to test it.

@SunghoLee
Copy link

SunghoLee commented Oct 7, 2022

I had the same issue on my M1 Max Macbook. The issue was caused by the exponential notation of floating point numbers. The canonicalization results of some floating point operations are printed in the exponential notation like "8.414710e-01" on my environment, but some tests try to match the results with "0.84{{[0-9]+}}".
I don't know whether the issue caused by the gap of floating point notations occurs only on M1 Mac or not, but all the tests are passed after changing "0.84{{[0-9]+}}" to "8.4{{[0-9]}}e-01".

@Mogball
Copy link
Contributor

Mogball commented Oct 10, 2022

I don't know whether the issue caused by the gap of floating point notations occurs only on M1 Mac or not, but all the tests are passed after changing "0.84{{[0-9]+}}" to "8.4{{[0-9]}}e-01".

This will cause the test to fail on other platforms, unfortunately.

@SunghoLee
Copy link

I don't know whether the issue caused by the gap of floating point notations occurs only on M1 Mac or not, but all the tests are passed after changing "0.84{{[0-9]+}}" to "8.4{{[0-9]}}e-01".

This will cause the test to fail on other platforms, unfortunately.

Agreed. Then, how about changing it to "{{0.84[0-9]+|8.4[0-9]+e-01}}" for both Mac and other platforms?

jacquesguan pushed a commit that referenced this issue Oct 12, 2022
@rikhuijzer
Copy link
Member

It looks like this issue can be closed because https://reviews.llvm.org/D134850 was merged?

veselypeta pushed a commit to veselypeta/cherillvm that referenced this issue May 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants