llvm / llvm/circt

`-DMLIR_ENABLE_EXPENSIVE_PATTERN_API_CHECKS=ON` might have found some invalid API usages

Open
#7,047 4 comments 3 reactions 0 assignees View on GitHub
Arc Calyx Comb FIRRTL Handshake help wanted HW LLHD LoopSchedule
Dominant language
C++
Stars
2.2k
Forks
524
Avg merge
3d 2h
Merged PRs (30d)
46

Description

While the [documentation](https://mlir.llvm.org/getting_started/Debugging/#detecting-invalid-api-usage) states that there might be false positives, I think it might be worth a look into the individual test cases and patterns.
If there are no false positives, adding `-DMLIR_ENABLE_EXPENSIVE_PATTERN_API_CHECKS=ON` to the CI could be beneficial.
```
Failed Tests (32):
CIRCT :: Conversion/LoopScheduleToCalyx/convert_pipeline.mlir
CIRCT :: Conversion/SCFToCalyx/cider_source_location.mlir
CIRCT :: Conversion/SCFToCalyx/convert_controlflow.mlir
CIRCT :: Conversion/SCFToCalyx/convert_func.mlir
CIRCT :: Conversion/SCFToCalyx/convert_memory.mlir
CIRCT :: Conversion/SCFToCalyx/convert_simple.mlir
CIRCT :: Conversion/SCFToCalyx/errors.mlir
CIRCT :: Dialect/Arc/arc-canonicalizer.mlir
CIRCT :: Dialect/Arc/canonicalizers.mlir
CIRCT :: Dialect/Calyx/canonicalization.mlir
CIRCT :: Dialect/Comb/canonicalization.mlir
CIRCT :: Dialect/FIRRTL/SFCTests/GrandCentralInterfaces/Wire.fir
CIRCT :: Dialect/FIRRTL/SFCTests/data-taps.fir
CIRCT :: Dialect/FIRRTL/SFCTests/invalid-interpretations.fir
CIRCT :: Dialect/FIRRTL/SFCTests/invalid-reg-pass.fir
CIRCT :: Dialect/FIRRTL/SFCTests/mem-taps.fir
CIRCT :: Dialect/FIRRTL/canonicalization.mlir
CIRCT :: Dialect/FIRRTL/ref.mlir
CIRCT :: Dialect/FIRRTL/simplify-mems.mlir
CIRCT :: Dialect/HW/canonicalization.mlir
CIRCT :: Dialect/HW/inline.mlir
CIRCT :: Dialect/Handshake/canonicalization.mlir
CIRCT :: Dialect/LLHD/Canonicalization/extract.mlir
CIRCT :: firtool/async-reset.fir
CIRCT :: firtool/chirrtl.fir
CIRCT :: firtool/firtool.fir
CIRCT :: firtool/import-ref.fir
CIRCT :: firtool/lower-memories.fir
CIRCT :: firtool/prefixMemory.fir
CIRCT :: firtool/spec/refs/define.fir
CIRCT :: firtool/spec/refs/nested_refproducer.fir
CIRCT :: firtool/sv-attr.fir

Testing Time: 2.55s

Total Discovered Tests: 812
Unsupported : 12 (1.48%)
Passed : 762 (93.84%)
Expectedly Failed: 6 (0.74%)
Failed : 32 (3.94%)
```

The observed errors are:
- `LLVM ERROR: operation finger print changed`
- `LLVM ERROR: pattern returned success but IR did not change`
- `LLVM ERROR: IR failed to verify after pattern application`

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by rerunning the listed CIRCT tests with -DMLIR_ENABLE_EXPENSIVE_PATTERN_API_CHECKS=ON and compare the three reported LLVM errors across the Conversion, Dialect, and firtool test paths. Done means determining whether each failure is a false positive or an invalid pattern API usage, addressing the confirmed cases, and establishing whether the flag should be added to CI.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers, testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.