llvm / llvm/Polygeist

Unexpectedly failed tests on M1 Mac

Open
#161 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
624
Forks
170
PR merge metrics
No merged PRs in 30d

Description

I'm trying to build on my M1 Mac and some tests are failing unexpectedly.

```
❯ clang --version
Apple clang version 13.0.0 (clang-1300.0.29.30)
Target: arm64-apple-darwin21.2.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
```

This is how I built.
```
cmake -G Ninja ../llvm-project/llvm \
-DDEFAULT_SYSROOT="$(xcrun --show-sdk-path)"\ # Needed for Mac Includes
-DLLVM_ENABLE_PROJECTS="clang;mlir" \
-DLLVM_EXTERNAL_PROJECTS="polygeist" \
-DLLVM_EXTERNAL_POLYGEIST_SOURCE_DIR=.. \
-DLLVM_TARGETS_TO_BUILD="host" \
-DLLVM_ENABLE_ASSERTIONS=ON \
-DCMAKE_BUILD_TYPE=DEBUG
ninja -j6
ninja check-mlir-clang
```

The failures look similar to this one.
```
********************
FAIL: mlir-clang :: polybench/linear-algebra/blas/gemm/gemm.c (39 of 129)
******************** TEST 'mlir-clang :: polybench/linear-algebra/blas/gemm/gemm.c' FAILED ********************
Script:
--
: 'RUN: at line 1'; /Users/than/Development/c680/Polygeist/build/bin/mlir-clang /Users/than/Development/c680/Polygeist/tools/mlir-clang/Test/polybench/linear-algebra/blas/gemm/gemm.c -I /../clang/lib/Headers -I /Users/than/Development/c680/Polygeist/tools/mlir-clang/Test/polybench/utilities -S | /Users/than/Development/c680/Polygeist/build/bin/FileCheck /Users/than/Development/c680/Polygeist/tools/mlir-clang/Test/polybench/linear-algebra/blas/gemm/gemm.c
: 'RUN: at line 2'; /Users/than/Development/c680/Polygeist/build/bin/mlir-clang /Users/than/Development/c680/Polygeist/tools/mlir-clang/Test/polybench/linear-algebra/blas/gemm/gemm.c -I /../clang/lib/Headers -I /Users/than/Development/c680/Polygeist/tools/mlir-clang/Test/polybench/utilities -S --memref-fullrank | /Users/than/Development/c680/Polygeist/build/bin/FileCheck /Users/than/Development/c680/Polygeist/tools/mlir-clang/Test/polybench/linear-algebra/blas/gemm/gemm.c --check-prefix=FULLRANK
: 'RUN: at line 3'; /Users/than/Development/c680/Polygeist/build/bin/clang /Users/than/Development/c680/Polygeist/tools/mlir-clang/Test/polybench/linear-algebra/blas/gemm/gemm.c -O3 -I /../clang/lib/Headers -I /Users/than/Development/c680/Polygeist/tools/mlir-clang/Test/polybench/utilities /Users/than/Development/c680/Polygeist/tools/mlir-clang/Test/polybench/utilities/polybench.c -D POLYBENCH_DUMP_ARRAYS -D POLYBENCH_NO_FLUSH_CACHE -D MINI_DATASET -o /Users/than/Development/c680/Polygeist/tools/mlir-clang/Test/polybench/linear-algebra/blas/gemm/gemm.c.exec1 && /Users/than/Development/c680/Polygeist/tools/mlir-clang/Test/polybench/linear-algebra/blas/gemm/gemm.c.exec1 &> /Users/than/Development/c680/Polygeist/tools/mlir-clang/Test/polybench/linear-algebra/blas/gemm/gemm.c.out1
: 'RUN: at line 4'; /Users/than/Development/c680/Polygeist/build/bin/mlir-clang /Users/than/Development/c680/Polygeist/tools/mlir-clang/Test/polybench/linear-algebra/blas/gemm/gemm.c /Users/than/Development/c680/Polygeist/tools/mlir-clang/Test/polybench/utilities/polybench.c -D POLYBENCH_DUMP_ARRAYS -D POLYBENCH_NO_FLUSH_CACHE -D MINI_DATASET -I /../clang/lib/Headers -I /Users/than/Development/c680/Polygeist/tools/mlir-clang/Test/polybench/utilities -O3 -o /Users/than/Development/c680/Polygeist/tools/mlir-clang/Test/polybench/linear-algebra/blas/gemm/gemm.c.execm && /Users/than/Development/c680/Polygeist/tools/mlir-clang/Test/polybench/linear-algebra/blas/gemm/gemm.c.execm &> /Users/than/Development/c680/Polygeist/tools/mlir-clang/Test/polybench/linear-algebra/blas/gemm/gemm.c.out2
: 'RUN: at line 5'; rm -f /Users/than/Development/c680/Polygeist/tools/mlir-clang/Test/polybench/linear-algebra/blas/gemm/gemm.c.exec1 /Users/than/Development/c680/Polygeist/tools/mlir-clang/Test/polybench/linear-algebra/blas/gemm/gemm.c.execm
: 'RUN: at line 6'; diff /Users/than/Development/c680/Polygeist/tools/mlir-clang/Test/polybench/linear-algebra/blas/gemm/gemm.c.out1 /Users/than/Development/c680/Polygeist/tools/mlir-clang/Test/polybench/linear-algebra/blas/gemm/gemm.c.out2
: 'RUN: at line 7'; rm -f /Users/than/Development/c680/Polygeist/tools/mlir-clang/Test/polybench/linear-algebra/blas/gemm/gemm.c.out1 /Users/than/Development/c680/Polygeist/tools/mlir-clang/Test/polybench/linear-algebra/blas/gemm/gemm.c.out2
: 'RUN: at line 8'; /Users/than/Development/c680/Polygeist/build/bin/mlir-clang /Users/than/Development/c680/Polygeist/tools/mlir-clang/Test/polybench/linear-algebra/blas/gemm/gemm.c /Users/than/Development/c680/Polygeist/tools/mlir-clang/Test/polybench/utilities/polybench.c -D POLYBENCH_TIME -D POLYBENCH_NO_FLUSH_CACHE -D MINI_DATASET -I /../clang/lib/Headers -I /Users/than/Development/c680/Polygeist/tools/mlir-clang/Test/polybench/utilities -O3 -o /Users/than/Development/c680/Polygeist/tools/mlir-clang/Test/polybench/linear-algebra/blas/gemm/gemm.c.execm && /Users/than/Development/c680/Polygeist/tools/mlir-clang/Test/polybench/linear-algebra/blas/gemm/gemm.c.execm > /Users/than/Development/c680/Polygeist/tools/mlir-clang/Test/polybench/linear-algebra/blas/gemm/gemm.c.mlir.time; cat /Users/than/Development/c680/Polygeist/tools/mlir-clang/Test/polybench/linear-algebra/blas/gemm/gemm.c.mlir.time | /Users/than/Development/c680/Polygeist/build/bin/FileCheck /Users/than/Development/c680/Polygeist/tools/mlir-clang/Test/polybench/linear-algebra/blas/gemm/gemm.c --check-prefix EXEC
: 'RUN: at line 9'; /Users/than/Development/c680/Polygeist/build/bin/clang /Users/than/Development/c680/Polygeist/tools/mlir-clang/Test/polybench/linear-algebra/blas/gemm/gemm.c -O3 /Users/than/Development/c680/Polygeist/tools/mlir-clang/Test/polybench/utilities/polybench.c -D POLYBENCH_TIME -D POLYBENCH_NO_FLUSH_CACHE -D MINI_DATASET -I /../clang/lib/Headers -I /Users/than/Development/c680/Polygeist/tools/mlir-clang/Test/polybench/utilities -o /Users/than/Development/c680/Polygeist/tools/mlir-clang/Test/polybench/linear-algebra/blas/gemm/gemm.c.exec2 && /Users/than/Development/c680/Polygeist/tools/mlir-clang/Test/polybench/linear-algebra/blas/gemm/gemm.c.exec2 > /Users/than/Development/c680/Polygeist/tools/mlir-clang/Test/polybench/linear-algebra/blas/gemm/gemm.c.clang.time; cat /Users/than/Development/c680/Polygeist/tools/mlir-clang/Test/polybench/linear-algebra/blas/gemm/gemm.c.clang.time | /Users/than/Development/c680/Polygeist/build/bin/FileCheck /Users/than/Development/c680/Polygeist/tools/mlir-clang/Test/polybench/linear-algebra/blas/gemm/gemm.c --check-prefix EXEC
: 'RUN: at line 10'; rm -f /Users/than/Development/c680/Polygeist/tools/mlir-clang/Test/polybench/linear-algebra/blas/gemm/gemm.c.exec2 /Users/than/Development/c680/Polygeist/tools/mlir-clang/Test/polybench/linear-algebra/blas/gemm/gemm.c.execm
: 'RUN: at line 12'; /Users/than/Development/c680/Polygeist/build/bin/clang /Users/than/Development/c680/Polygeist/tools/mlir-clang/Test/polybench/linear-algebra/blas/gemm/gemm.c -O3 -I /../clang/lib/Headers -I /Users/than/Development/c680/Polygeist/tools/mlir-clang/Test/polybench/utilities /Users/than/Development/c680/Polygeist/tools/mlir-clang/Test/polybench/utilities/polybench.c -D POLYBENCH_DUMP_ARRAYS -D POLYBENCH_NO_FLUSH_CACHE -D MINI_DATASET -o /Users/than/Development/c680/Polygeist/tools/mlir-clang/Test/polybench/linear-algebra/blas/gemm/gemm.c.exec1 && /Users/than/Development/c680/Polygeist/tools/mlir-clang/Test/polybench/linear-algebra/blas/gemm/gemm.c.exec1 &> /Users/than/Development/c680/Polygeist/tools/mlir-clang/Test/polybench/linear-algebra/blas/gemm/gemm.c.out1
: 'RUN: at line 13'; /Users/than/Development/c680/Polygeist/build/bin/mlir-clang /Users/than/Development/c680/Polygeist/tools/mlir-clang/Test/polybench/linear-algebra/blas/gemm/gemm.c /Users/than/Development/c680/Polygeist/tools/mlir-clang/Test/polybench/utilities/polybench.c -D POLYBENCH_DUMP_ARRAYS -D POLYBENCH_NO_FLUSH_CACHE -D MINI_DATASET -I /../clang/lib/Headers -I /Users/than/Development/c680/Polygeist/tools/mlir-clang/Test/polybench/utilities -detect-reduction -O3 -o /Users/than/Development/c680/Polygeist/tools/mlir-clang/Test/polybench/linear-algebra/blas/gemm/gemm.c.execm && /Users/than/Development/c680/Polygeist/tools/mlir-clang/Test/polybench/linear-algebra/blas/gemm/gemm.c.execm &> /Users/than/Development/c680/Polygeist/tools/mlir-clang/Test/polybench/linear-algebra/blas/gemm/gemm.c.out2
: 'RUN: at line 14'; rm -f /Users/than/Development/c680/Polygeist/tools/mlir-clang/Test/polybench/linear-algebra/blas/gemm/gemm.c.exec1 /Users/than/Development/c680/Polygeist/tools/mlir-clang/Test/polybench/linear-algebra/blas/gemm/gemm.c.execm
: 'RUN: at line 15'; diff /Users/than/Development/c680/Polygeist/tools/mlir-clang/Test/polybench/linear-algebra/blas/gemm/gemm.c.out1 /Users/than/Development/c680/Polygeist/tools/mlir-clang/Test/polybench/linear-algebra/blas/gemm/gemm.c.out2
: 'RUN: at line 16'; rm -f /Users/than/Development/c680/Polygeist/tools/mlir-clang/Test/polybench/linear-algebra/blas/gemm/gemm.c.out1 /Users/than/Development/c680/Polygeist/tools/mlir-clang/Test/polybench/linear-algebra/blas/gemm/gemm.c.out2
--
Exit Code: 2

Command Output (stderr):
--
RecordType 0x1518703c0 'struct __sFILEX'
`-Record 0x151870338 '__sFILEX'
ST: %struct.__sFILEX = type opaque
fields
types
Assertion failed: (types.size()), function getMLIRType, file clang-mlir.cc, line 6005.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: /Users/than/Development/c680/Polygeist/build/bin/mlir-clang /Users/than/Development/c680/Polygeist/tools/mlir-clang/Test/polybench/linear-algebra/blas/gemm/gemm.c -I /../clang/lib/Headers -I /Users/than/Development/c680/Polygeist/tools/mlir-clang/Test/polybench/utilities -S
1. parser at end of file
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
0 mlir-clang 0x0000000102e7aef8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 68
1 mlir-clang 0x0000000102e7b3ec PrintStackTraceSignalHandler(void*) + 28
2 mlir-clang 0x0000000102e79558 llvm::sys::RunSignalHandlers() + 132
3 mlir-clang 0x0000000102e7d0cc SignalHandler(int) + 220
4 libsystem_platform.dylib 0x00000001c459c4e4 _sigtramp + 56
5 libsystem_pthread.dylib 0x00000001c4584eb0 pthread_kill + 288
6 libsystem_c.dylib 0x00000001c44c2314 abort + 164
7 libsystem_c.dylib 0x00000001c44c172c err + 0
8 mlir-clang 0x00000001001e9f4c MLIRASTConsumer::getMLIRType(clang::QualType, bool*, bool) + 3812
9 mlir-clang 0x00000001001e9108 MLIRASTConsumer::getMLIRType(clang::QualType, bool*, bool) + 160
10 mlir-clang 0x00000001001ea8b0 MLIRASTConsumer::getMLIRType(clang::QualType, bool*, bool) + 6216
11 mlir-clang 0x00000001001e9bec MLIRASTConsumer::getMLIRType(clang::QualType, bool*, bool) + 2948
12 mlir-clang 0x00000001001e9108 MLIRASTConsumer::getMLIRType(clang::QualType, bool*, bool) + 160
13 mlir-clang 0x00000001001e92a0 MLIRASTConsumer::getMLIRType(clang::QualType, bool*, bool) + 568
14 mlir-clang 0x00000001001ea8b0 MLIRASTConsumer::getMLIRType(clang::QualType, bool*, bool) + 6216
15 mlir-clang 0x00000001001ea8b0 MLIRASTConsumer::getMLIRType(clang::QualType, bool*, bool) + 6216
16 mlir-clang 0x0000000100223138 MLIRScanner::VisitDeclRefExpr(clang::DeclRefExpr*) + 996
17 mlir-clang 0x00000001001ef700 clang::StmtVisitorBase::Visit(clang::Stmt*) + 5072
18 mlir-clang 0x00000001001fa72c MLIRScanner::VisitCastExpr(clang::CastExpr*) + 5564
19 mlir-clang 0x0000000100276cc4 clang::StmtVisitorBase::VisitImplicitCastExpr(clang::ImplicitCastExpr*) + 32
20 mlir-clang 0x00000001001ef640 clang::StmtVisitorBase::Visit(clang::Stmt*) + 4880
21 mlir-clang 0x0000000100210998 MLIRScanner::VisitCallExpr(clang::CallExpr*)::$_5::operator()(clang::Expr*) const + 48
22 mlir-clang 0x000000010020f138 MLIRScanner::VisitCallExpr(clang::CallExpr*) + 27108
23 mlir-clang 0x00000001001ef4f0 clang::StmtVisitorBase::Visit(clang::Stmt*) + 4544
24 mlir-clang 0x00000001002d8214 MLIRScanner::VisitCompoundStmt(clang::CompoundStmt*) + 136
25 mlir-clang 0x00000001001ee950 clang::StmtVisitorBase::Visit(clang::Stmt*) + 1568
26 mlir-clang 0x00000001001e8928 MLIRScanner::init(mlir::FuncOp, clang::FunctionDecl const*) + 4684
27 mlir-clang 0x000000010022869c MLIRASTConsumer::run() + 696
28 mlir-clang 0x00000001002296bc MLIRASTConsumer::HandleTranslationUnit(clang::ASTContext&) + 28
29 mlir-clang 0x0000000108709378 clang::ParseAST(clang::Sema&, bool, bool) + 732
30 mlir-clang 0x000000010539f2f8 clang::ASTFrontendAction::ExecuteAction() + 264
31 mlir-clang 0x000000010539e9f4 clang::FrontendAction::Execute() + 120
32 mlir-clang 0x000000010022ef98 parseMLIR(char const*, std::__1::vector, std::__1::allocator >, std::__1::allocator, std::__1::allocator > > >, std::__1::basic_string, std::__1::allocator >, std::__1::vector, std::__1::allocator >, std::__1::allocator, std::__1::allocator > > >, std::__1::vector, std::__1::allocator >, std::__1::allocator, std::__1::allocator > > >, mlir::OwningOpRef&, llvm::Triple&, llvm::DataLayout&) + 4204
33 mlir-clang 0x000000010022bb1c main + 2980
34 dyld 0x000000012b4e90f4 start + 520
FileCheck error: '' is empty.
FileCheck command line: /Users/than/Development/c680/Polygeist/build/bin/FileCheck /Users/than/Development/c680/Polygeist/tools/mlir-clang/Test/polybench/linear-algebra/blas/gemm/gemm.c

--
```

These are the failed tests.
```
********************
********************
Failed Tests (32):
mlir-clang :: Verification/fscanf.c
mlir-clang :: Verification/gettimeofday.c
mlir-clang :: polybench/datamining/correlation/correlation.c
mlir-clang :: polybench/datamining/covariance/covariance.c
mlir-clang :: polybench/linear-algebra/blas/gemm/gemm.c
mlir-clang :: polybench/linear-algebra/blas/gemver/gemver.c
mlir-clang :: polybench/linear-algebra/blas/gesummv/gesummv.c
mlir-clang :: polybench/linear-algebra/blas/symm/symm.c
mlir-clang :: polybench/linear-algebra/blas/syr2k/syr2k.c
mlir-clang :: polybench/linear-algebra/blas/syrk/syrk.c
mlir-clang :: polybench/linear-algebra/blas/trmm/trmm.c
mlir-clang :: polybench/linear-algebra/kernels/2mm/2mm.c
mlir-clang :: polybench/linear-algebra/kernels/3mm/3mm.c
mlir-clang :: polybench/linear-algebra/kernels/atax/atax.c
mlir-clang :: polybench/linear-algebra/kernels/bicg/bicg.c
mlir-clang :: polybench/linear-algebra/kernels/doitgen/doitgen.c
mlir-clang :: polybench/linear-algebra/kernels/mvt/mvt.c
mlir-clang :: polybench/linear-algebra/solvers/cholesky/cholesky.c
mlir-clang :: polybench/linear-algebra/solvers/durbin/durbin.c
mlir-clang :: polybench/linear-algebra/solvers/gramschmidt/gramschmidt.c
mlir-clang :: polybench/linear-algebra/solvers/lu/lu.c
mlir-clang :: polybench/linear-algebra/solvers/ludcmp/ludcmp.c
mlir-clang :: polybench/linear-algebra/solvers/trisolv/trisolv.c
mlir-clang :: polybench/medley/deriche/deriche.c
mlir-clang :: polybench/medley/floyd-warshall/floyd-warshall.c
mlir-clang :: polybench/medley/nussinov/nussinov.c
mlir-clang :: polybench/stencils/adi/adi.c
mlir-clang :: polybench/stencils/fdtd-2d/fdtd-2d.c
mlir-clang :: polybench/stencils/heat-3d/heat-3d.c
mlir-clang :: polybench/stencils/jacobi-1d/jacobi-1d.c
mlir-clang :: polybench/stencils/jacobi-2d/jacobi-2d.c
mlir-clang :: polybench/stencils/seidel-2d/seidel-2d.c

Testing Time: 11.87s
Passed : 92
Expectedly Failed: 5
Failed : 32
FAILED: tools/polygeist/tools/mlir-clang/Test/CMakeFiles/check-mlir-clang /Users/than/Development/c680/Polygeist/build/tools/polygeist/tools/mlir-clang/Test/CMakeFiles/check-mlir-clang
cd /Users/than/Development/c680/Polygeist/build/tools/polygeist/tools/mlir-clang/Test && /opt/homebrew/Frameworks/Python.framework/Versions/3.9/bin/python3.9 /Users/than/Development/c680/Polygeist/build/bin/llvm-lit -sv /Users/than/Development/c680/Polygeist/build/tools/polygeist/tools/mlir-clang/Test
ninja: build stopped: subcommand failed.
```

Am I missing some information here? Have I done something wrong in the build process?

Any advice would be greatly appreciated.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce with the M1 build commands and run ninja check-mlir-clang, starting with tools/mlir-clang/Test/polybench/linear-algebra/blas/gemm/gemm.c. Inspect clang-mlir.cc around getMLIRType at line 6005 and compare the failing test output with the expected FileCheck results. Done means the relevant check-mlir-clang tests complete without the assertion.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake, cpp, macos
Domain
build-system, compilers, operating-systems, testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.