llvm / llvm/llvm-project

[RISC-V] MLIR test (CAPI/execution_engine.c) fails with a SIGSEGV on Fedora

Open
#162,655 10 comments 0 reactions 0 assignees View on GitHub
mlir
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

## Description

The CAPI execution engine test from the MLIR test suite, `CAPI/execution_engine.c`, fails with a segmentation fault (SIGSEGV). This is on RISC-V hardware:"HiFive Premier P550" from SiFive.

If need be, I could run test teset separately and get the backtrace from GBD.

(Note: about 27 tests from the MLIR test suite fail. I wanted to hold off filing more issues, as I was wondering if this seg-fault is the cause for them too. Some more details in the "Additional information" section further below.)

I'm also wondering how many of these tests actually make sense on RISC-V. Are they _supposed_ to pass on RISC-V?

## Environment

- LLVM 21.1.1
- Fedora 42
- Hardware: "HiFive Premier P550" by SiFive

## Steps to reproduce

Build LLVM 21.1.1 on Fedora 42 (or even F41) running on HiFive Premier P550:

$ fedpkg clone llvm && cd llvm
$ fedpkg sources
$ sudo dnf builddep llvm.spec
$ mock -r fedora-42-riscv64 path/to/llvm-21.1.1.src.rpm
$ fedpkg mockbuild

(I have a local build environment, so I can assist with any additional debugging if need be.)

## Actual results

The `mlir/test/CAPI/execution_engine.c` test fails with a SIGSEGV (-11):

[...]
FAIL: MLIR :: CAPI/execution_engine.c (50 of 2687)
******************** TEST 'MLIR :: CAPI/execution_engine.c' FAILED ********************
Exit Code: 2
Command Output (stdout):
--
# RUN: at line 10
/builddir/build/BUILD/llvm-21.1.1-build/llvm-project-21.1.1.src/llvm/redhat-linux-build/bin/mlir-capi-execution-engine-test 2>&1 | /builddir/build/BUILD/llvm-21.1.1-build/llvm-project-21.1.1.src/llvm/redhat-linux-build/bin/FileCheck /builddir/build/BUILD/llvm-21.1.1-build/llvm-project-21.1.1.src/mlir/test/CAPI/execution_engine.c
# executed command: /builddir/build/BUILD/llvm-21.1.1-build/llvm-project-21.1.1.src/llvm/redhat-linux-build/bin/mlir-capi-execution-engine-test
# note: command had no output on stdout or stderr
# error: command failed with exit status: -11
# executed command: /builddir/build/BUILD/llvm-21.1.1-build/llvm-project-21.1.1.src/llvm/redhat-linux-build/bin/FileCheck /builddir/build/BUILD/llvm-21.1.1-build/llvm-project-21.1.1.src/mlir/test/CAPI/execution_engine.c
# .---command stderr------------
# | FileCheck error: '' is empty.
# | FileCheck command line: /builddir/build/BUILD/llvm-21.1.1-build/llvm-project-21.1.1.src/llvm/redhat-linux-build/bin/FileCheck /builddir/build/BUILD/llvm-21.1.1-build/llvm-project-21.1.1.src/mlir/test/CAPI/execution_engine.c
# `-----------------------------
# error: command failed with exit status: 2
--
********************
[...]

From Fedora's build log from here: https://riscv-koji.fedoraproject.org/koji/packageinfo?packageID=21312

NB: currently the build "succeeds" on Fedora because the tests are allowed to pass for now with a blunt and temporary workaround such as:

-%cmake_build --target check-mlir
+%cmake_build --target check-mlir || true

## Expected results

The test should succeed.

## Additional information

There are 26 more failures from the MLIR test suite on Fedora. I haven't filed any issues for them yet as they also seem to

Failed Tests (27):
MLIR :: CAPI/execution_engine.c
MLIR :: mlir-runner/async-error.mlir
MLIR :: mlir-runner/async-func.mlir
MLIR :: mlir-runner/async-group.mlir
MLIR :: mlir-runner/async-value.mlir
MLIR :: mlir-runner/async.mlir
MLIR :: mlir-runner/bare-ptr-call-conv.mlir
MLIR :: mlir-runner/copy.mlir
MLIR :: mlir-runner/expand-arith-ops.mlir
MLIR :: mlir-runner/global-constructors.mlir
MLIR :: mlir-runner/global-memref.mlir
MLIR :: mlir-runner/math-polynomial-approx.mlir
MLIR :: mlir-runner/memref-reinterpret-cast.mlir
MLIR :: mlir-runner/memref-reshape.mlir
MLIR :: mlir-runner/sgemm-naive-codegen.mlir
MLIR :: mlir-runner/simple.mlir
MLIR :: mlir-runner/test-expand-math-approx.mlir
MLIR :: mlir-runner/unranked-memref.mlir
MLIR :: mlir-runner/utils.mlir
MLIR :: python/execution_engine.py
MLIR :: python/multithreaded_tests.py
MLIR-Unit :: ExecutionEngine/./MLIRExecutionEngineTests/0/6
MLIR-Unit :: ExecutionEngine/./MLIRExecutionEngineTests/1/6
MLIR-Unit :: ExecutionEngine/./MLIRExecutionEngineTests/2/6
MLIR-Unit :: ExecutionEngine/./MLIRExecutionEngineTests/3/6
MLIR-Unit :: ExecutionEngine/./MLIRExecutionEngineTests/4/6
MLIR-Unit :: ExecutionEngine/./MLIRExecutionEngineTests/5/6

Contributor guide

Open the contributing guide

Research direction

Start with mlir/test/CAPI/execution_engine.c and reproduce the failure using the mlir-capi-execution-engine-test command shown in the report on RISC-V Fedora. Collect the requested backtrace if it still exits with SIGSEGV, then compare the related MLIR execution-engine failures. Done means identifying whether the failure is RISC-V-specific and establishing a test result without relying on the temporary || true workaround.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, python
Domain
compilers, testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.