llvm / llvm/circt

circt-tblgen RTG tests require llvm submodule, don't use same headers as build

Open
#9,961 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
2.2k
Forks
524
Avg merge
3d 2h
Merged PRs (30d)
46

Description

For packaging purposes I build CIRCT against standalone LLVM and MLIR packages.

Recent circt-tblgen tests now grab headers out of the llvm submodule directly, which doesn't work if you don't have that submodule and expect to be getting them from the system. (And more to the point, if you configure CIRCT to build using a particular system LLVM/MLIR, we should be using those headers regardless)

One suggested resolution path is obtaining the MLIR paths from CMake, and injecting into lit (`lit.site.cfg.py.in`) and using those in the tests.

Failing tests:

```
CIRCT :: Tools/circt-tblgen/rtg-instruction-methods-errors.td
CIRCT :: Tools/circt-tblgen/rtg-instruction-methods.td
```

Test output:

```
FAIL: CIRCT :: Tools/circt-tblgen/rtg-instruction-methods.td (810 of 1125)
******************** TEST 'CIRCT :: Tools/circt-tblgen/rtg-instruction-methods.td' FAILED ********************
Exit Code: 2

Command Output (stderr):
--
RUN: at line 1: circt-tblgen -gen-rtg-instruction-methods -I /build/source/test/Tools/circt-tblgen/../../../include -I /build/source/test/Tools/circt-tblgen/../../../llvm/mlir/include /build/source/test/Tools/circt-tblgen/rtg-instruction-methods.td | /nix/store/0y8ygxmgwq4xsrqpjidrbnc77k2yx40y-llvm-23.0.0-20260129_52dfcab/bin/FileCheck /build/source/test/Tools/circt-tblgen/rtg-instruction-methods.td
+ circt-tblgen -gen-rtg-instruction-methods -I /build/source/test/Tools/circt-tblgen/../../../include -I /build/source/test/Tools/circt-tblgen/../../../llvm/mlir/include /build/source/test/Tools/circt-tblgen/rtg-instruction-methods.td
+ /nix/store/0y8ygxmgwq4xsrqpjidrbnc77k2yx40y-llvm-23.0.0-20260129_52dfcab/bin/FileCheck /build/source/test/Tools/circt-tblgen/rtg-instruction-methods.td
/build/source/test/Tools/circt-tblgen/rtg-instruction-methods.td:3:9: error: could not find include file 'mlir/IR/OpBase.td'
include "mlir/IR/OpBase.td"
¦ ¦ ¦ ^
/build/source/test/Tools/circt-tblgen/rtg-instruction-methods.td:3:9: error: Unexpected token at top level
include "mlir/IR/OpBase.td"
¦ ¦ ¦ ^
FileCheck error: '' is empty.
FileCheck command line: /nix/store/0y8ygxmgwq4xsrqpjidrbnc77k2yx40y-llvm-23.0.0-20260129_52dfcab/bin/FileCheck /build/source/test/Tools/circt-tblgen/rtg-instruction-methods.td

--
```

and

```
FAIL: CIRCT :: Tools/circt-tblgen/rtg-instruction-methods-errors.td (830 of 1125)
******************** TEST 'CIRCT :: Tools/circt-tblgen/rtg-instruction-methods-errors.td' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
RUN: at line 1: not circt-tblgen -gen-rtg-instruction-methods -I /build/source/test/Tools/circt-tblgen/../../../include -I /build/source/test/Tools/circt-tblgen/../../../llvm/mlir/include /build/source/test/Tools/circt-tblgen/rtg-instruction-methods-errors.td -DTEST_IMM_NO_WRAPPER 2>&1 | /nix/store/0y8ygxmgwq4xsrqpjidrbnc77k2yx40y-llvm-23.0.0-20260129_52dfcab/bin/FileCheck /build/source/test/Tools/circt-tblgen/rtg-instruction-methods-errors.td --check-prefix=IMM_NO_WRAPPER
+ not circt-tblgen -gen-rtg-instruction-methods -I /build/source/test/Tools/circt-tblgen/../../../include -I /build/source/test/Tools/circt-tblgen/../../../llvm/mlir/include /build/source/test/Tools/circt-tblgen/rtg-instruction-methods-errors.td -DTEST_IMM_NO_WRAPPER
+ /nix/store/0y8ygxmgwq4xsrqpjidrbnc77k2yx40y-llvm-23.0.0-20260129_52dfcab/bin/FileCheck /build/source/test/Tools/circt-tblgen/rtg-instruction-methods-errors.td --check-prefix=IMM_NO_WRAPPER
/build/source/test/Tools/circt-tblgen/rtg-instruction-methods-errors.td:52:20: error: IMM_NO_WRAPPER: expected string not found in input
// IMM_NO_WRAPPER: rtg-instruction-methods-errors.td:50:41: error: immediate operand '$imm' must be wrapped in signed() or unsigned()
¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦^
:1:1: note: scanning from here
Included from /build/source/test/Tools/circt-tblgen/rtg-instruction-methods-errors.td:32:
^

Input file:
Check file: /build/source/test/Tools/circt-tblgen/rtg-instruction-methods-errors.td

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

Input was:
<<<<<<
¦ ¦ ¦ ¦ 1: Included from /build/source/test/Tools/circt-tblgen/rtg-instruction-methods-errors.td:32:·
check:52 X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
¦ ¦ ¦ ¦ 2: /build/source/test/Tools/circt-tblgen/../../../include/circt/Dialect/RTG/IR/RTGISAAssemblyInterfaces.td:12:9: error: could not find include file 'mlir/IR/Interfaces.td'·
check:52 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
¦ ¦ ¦ ¦ 3: include "mlir/IR/Interfaces.td"·
check:52 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
¦ ¦ ¦ ¦ 4: ^·
check:52 ~~~
¦ ¦ ¦ ¦ 5: Included from /build/source/test/Tools/circt-tblgen/rtg-instruction-methods-errors.td:32:·
check:52 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
¦ ¦ ¦ ¦ 6: /build/source/test/Tools/circt-tblgen/../../../include/circt/Dialect/RTG/IR/RTGISAAssemblyInterfaces.td:12:9: error: Unexpected token at top level·
check:52 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
¦ ¦ ¦ ¦ .
¦ ¦ ¦ ¦ .
¦ ¦ ¦ ¦ .
>>>>>>

--
```

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

Start with lit.site.cfg.py.in and inspect how the two RTG tests, rtg-instruction-methods.td and rtg-instruction-methods-errors.td, receive MLIR include paths. Compare the configured system LLVM/MLIR paths with the current llvm submodule path, then run both listed tests. Done means they pass when CIRCT uses standalone system LLVM/MLIR without the LLVM submodule.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake, cpp
Domain
build-system, compilers, testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.