llvm / llvm/circt

[FIRRTL] Lower Classes Assertion Firing

Open
#10,959 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

I ran into the following assertion failure in `LowerClasses`:

``` mlir
firrtl.circuit "Foo" {
firrtl.memmodule @Bar(
in W0_clk: !firrtl.clock
) attributes {
dataWidth = 8 : ui32,
depth = 8 : ui64,
extraPorts = [],
maskBits = 1 : ui32,
numReadPorts = 0 : ui32,
numReadWritePorts = 0 : ui32,
numWritePorts = 1 : ui32,
readLatency = 1 : ui32,
ruw = #firrtl,
writeLatency = 1 : ui32
}
firrtl.extmodule @Foo()
}
```

``` shell
# circt-opt reduced.mlir -firrtl-lower-classes
Assertion failed: (!NodePtr->isKnownSentinel()), function operator*, file ilist_iterator.h, line 168.
PLEASE submit a bug report to https://github.com/llvm/circt and include the crash backtrace.
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 circt-opt 0x0000000102cea234 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 56
1 circt-opt 0x0000000102ce7e40 llvm::sys::RunSignalHandlers() + 204
2 circt-opt 0x0000000102cead40 SignalHandler(int, __siginfo*, void*) + 328
3 libsystem_platform.dylib 0x0000000180e93744 _sigtramp + 56
4 libsystem_pthread.dylib 0x0000000180e898d8 pthread_kill + 296
5 libsystem_c.dylib 0x0000000180d90644 abort + 148
6 libsystem_c.dylib 0x0000000180d8f8a0 err + 0
7 circt-opt 0x0000000105335d5c llvm::yaml::Scanner::peekNext() (.cold.4) + 0
8 circt-opt 0x00000001034b3d04 auto void mlir::parallelForEach, llvm::detail::DenseMapPair, false>, (anonymous namespace)::LowerClassesPass::runOnOperation()::$_1>(mlir::MLIRContext*, llvm::DenseMapIterator, llvm::detail::DenseMapPair, false>, llvm::DenseMapIterator, llvm::detail::DenseMapPair, false>, (anonymous namespace)::LowerClassesPass::runOnOperation()::$_1&&)::'lambda'(llvm::DenseMapIterator, llvm::detail::DenseMapPair, false>&&)::operator()&>(llvm::DenseMapIterator, llvm::detail::DenseMapPair, false>&&) const + 3648
9 circt-opt 0x00000001034b415c llvm::detail::UniqueFunctionBase::UniqueFunctionBase, llvm::detail::DenseMapPair, false>, void mlir::parallelForEach, llvm::detail::DenseMapPair, false>, (anonymous namespace)::LowerClassesPass::runOnOperation()::$_1>(mlir::MLIRContext*, llvm::DenseMapIterator, llvm::detail::DenseMapPair, false>, llvm::DenseMapIterator, llvm::detail::DenseMapPair, false>, (anonymous namespace)::LowerClassesPass::runOnOperation()::$_1&&)::'lambda'(llvm::DenseMapIterator, llvm::detail::DenseMapPair, false>&&)>(mlir::MLIRContext*, llvm::DenseMapIterator, llvm::detail::DenseMapPair, false>, llvm::DenseMapIterator, llvm::detail::DenseMapPair, false>, (anonymous namespace)::LowerClassesPass::runOnOperation()::$_1&&)::'lambda'(), llvm::LogicalResult mlir::failableParallelForEach, llvm::detail::DenseMapPair, false>, void mlir::parallelForEach, llvm::detail::DenseMapPair, false>, (anonymous namespace)::LowerClassesPass::runOnOperation()::$_1>(mlir::MLIRContext*, llvm::DenseMapIterator, llvm::detail::DenseMapPair, false>, llvm::DenseMapIterator, llvm::detail::DenseMapPair, false>, (anonymous namespace)::LowerClassesPass::runOnOperation()::$_1&&)::'lambda'(llvm::DenseMapIterator, llvm::detail::DenseMapPair, false>&&)>(mlir::MLIRContext*, llvm::DenseMapIterator, llvm::detail::DenseMapPair, false>, llvm::DenseMapIterator, llvm::detail::DenseMapPair, false>, (anonymous namespace)::LowerClassesPass::runOnOperation()::$_1&&)::'lambda'()>(llvm::DenseMapIterator, llvm::detail::DenseMapPair, false>, llvm::detail::UniqueFunctionBase::CalledAs<(anonymous namespace)::LowerClassesPass::runOnOperation()::$_1>)::'lambda'(llvm::detail::UniqueFunctionBase const*)::__invoke(llvm::detail::UniqueFunctionBase const*) + 368
10 circt-opt 0x00000001033fcf14 std::__1::__deferred_assoc_state>>::__execute() + 28
11 libc++.1.dylib 0x0000000180dc0114 std::__1::__assoc_sub_state::wait() + 56
12 circt-opt 0x0000000102c9706c llvm::StdThreadPool::processTasks(llvm::ThreadPoolTaskGroup*) + 872
13 circt-opt 0x0000000102c98a00 void* llvm::thread::ThreadProxy>(void*) + 148
14 libsystem_pthread.dylib 0x0000000180e89c58 _pthread_start + 136
15 libsystem_pthread.dylib 0x0000000180e84c1c thread_start + 8
zsh: abort circt-opt reduced.mlir -firrtl-lower-classes
```

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

Run circt-opt reduced.mlir -firrtl-lower-classes to reproduce the assertion, then start at the LowerClasses pass and its handling of the FIRRTL memmodule/extmodule input. The work is done when this reproducer no longer aborts and the behavior is covered by an appropriate regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.