circt icon indicating copy to clipboard operation
circt copied to clipboard

[FIRRTL] ModuleInliner crash while creating DictionaryAttr

Open prithayan opened this issue 3 years ago • 0 comments
trafficstars

ModuleInliner pass crashes while creating the annotations with the following input

circt-opt --pass-pipeline='firrtl.circuit(firrtl-inliner)'

firrtl.circuit "CollidingSymbolsReTop" {
  firrtl.hierpath @nla1 [@Bar::@baz, @Baz]
  firrtl.module @Baz() {
    %a = firrtl.wire sym @a {annotations = [{circt.nonlocal = @nla1, class = "hello"}]} : !firrtl.uint<1>
  }
  firrtl.module @Bar() attributes {annotations = [{class = "firrtl.passes.InlineAnnotation"}]} {
    firrtl.instance baz sym @baz @Baz()
  }
  firrtl.module @Foo() {
    firrtl.instance bar @Bar()
  }
  firrtl.module @CollidingSymbolsReTop() {
    firrtl.instance b @Bar()
    firrtl.instance c @Bar()
  }
}
sifive/fork-circt/circt/llvm/mlir/lib/IR/BuiltinAttributes.cpp:164: static mlir::DictionaryAttr mlir::DictionaryAttr::get(mlir::MLIRContext *, ArrayRef<mlir::NamedAttribute>): Assertion `!findDuplicateElement(value) && "DictionaryAttr element names must be unique"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: circt-opt --pass-pipeline=firrtl.circuit(firrtl-inliner) t3.mlir
 #0 0x0000000001b5d2f3 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/prithayan/work/sifive/fork-circt/circt/build/bin/circt-opt+0x1b5d2f3)
 #1 0x0000000001b5b07e llvm::sys::RunSignalHandlers() (/home/prithayan/work/sifive/fork-circt/circt/build/bin/circt-opt+0x1b5b07e)
 #2 0x0000000001b5d7bf SignalHandler(int) Signals.cpp:0:0
 #3 0x00007fa991ca2980 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x12980)
 #4 0x00007fa99074bfb7 raise /build/glibc-S9d2JN/glibc-2.27/signal/../sysdeps/unix/sysv/linux/raise.c:51:0
 #5 0x00007fa99074d921 abort /build/glibc-S9d2JN/glibc-2.27/stdlib/abort.c:81:0
 #6 0x00007fa99073d48a __assert_fail_base /build/glibc-S9d2JN/glibc-2.27/assert/assert.c:89:0
 #7 0x00007fa99073d502 (/lib/x86_64-linux-gnu/libc.so.6+0x30502)
 #8 0x0000000001184167 (/home/prithayan/work/sifive/fork-circt/circt/build/bin/circt-opt+0x1184167)
 #9 0x0000000000ae255f (anonymous namespace)::Inliner::run()::$_2::operator()(circt::firrtl::Annotation) const /home/prithayan/work/sifive/fork-circt/circt/build/../lib/Dialect/FIRRTL/Transforms/ModuleInliner.cpp:1201:17
#10 0x0000000000ae2115 bool llvm::function_ref<bool (circt::firrtl::Annotation)>::callback_fn<(anonymous namespace)::Inliner::run()::$_2>(long, circt::firrtl::Annotation) /home/prithayan/work/sifive/fork-circt/circt/build/../llvm/llvm/include/llvm/ADT/STLFunctionalExtras.h:45:5
#11 0x00000000008b25e4 llvm::function_ref<bool (circt::firrtl::Annotation)>::operator()(circt::firrtl::Annotation) const /home/prithayan/work/sifive/fork-circt/circt/build/../llvm/llvm/include/llvm/ADT/STLFunctionalExtras.h:68:5
#12 0x00000000008ae8bc circt::firrtl::AnnotationSet::removeAnnotations(llvm::function_ref<bool (circt::firrtl::Annotation)>) /home/prithayan/work/sifive/fork-circt/circt/build/../lib/Dialect/FIRRTL/FIRRTLAnnotations.cpp:366:31
#13 0x0000000000ad9307 (anonymous namespace)::Inliner::run() /home/prithayan/work/sifive/fork-circt/circt/build/../lib/Dialect/FIRRTL/Transforms/ModuleInliner.cpp:1209:34
#14 0x0000000000ad847e (anonymous namespace)::InlinerPass::runOnOperation() /home/prithayan/work/sifive/fork-circt/circt/build/../lib/Dialect/FIRRTL/Transforms/ModuleInliner.cpp:1239:5
#15 0x0000000001a55840 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/home/prithayan/work/sifive/fork-circt/circt/build/bin/circt-opt+0x1a55840)
#16 0x0000000001a56086 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (/home/prithayan/work/sifive/fork-circt/circt/build/bin/circt-opt+0x1a56086)
#17 0x0000000001a57b68 mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool) (/home/prithayan/work/sifive/fork-circt/circt/build/bin/circt-opt+0x1a57b68)
#18 0x0000000001a55938 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/home/prithayan/work/sifive/fork-circt/circt/build/bin/circt-opt+0x1a55938)
#19 0x0000000001a56086 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (/home/prithayan/work/sifive/fork-circt/circt/build/bin/circt-opt+0x1a56086)
#20 0x0000000001a5888b mlir::PassManager::run(mlir::Operation*) (/home/prithayan/work/sifive/fork-circt/circt/build/bin/circt-opt+0x1a5888b)
#21 0x00000000013f29a6 performActions(llvm::raw_ostream&, bool, bool, llvm::SourceMgr&, mlir::MLIRContext*, llvm::function_ref<mlir::LogicalResult (mlir::PassManager&)>) MlirOptMain.cpp:0:0
#22 0x00000000013f0a9a processBuffer(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, bool, bool, bool, bool, llvm::function_ref<mlir::LogicalResult (mlir::PassManager&)>, mlir::DialectRegistry&, llvm::ThreadPool*) MlirOptMain.cpp:0:0
#23 0x00000000013f0735 mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::function_ref<mlir::LogicalResult (mlir::PassManager&)>, mlir::DialectRegistry&, bool, bool, bool, bool, bool) (/home/prithayan/work/sifive/fork-circt/circt/build/bin/circt-opt+0x13f0735)
#24 0x00000000013f13bd mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&, bool) (/home/prithayan/work/sifive/fork-circt/circt/build/bin/circt-opt+0x13f13bd)
#25 0x000000000040bc9b main /home/prithayan/work/sifive/fork-circt/circt/build/../tools/circt-opt/circt-opt.cpp:64:23
#26 0x00007fa99072ebf7 __libc_start_main /build/glibc-S9d2JN/glibc-2.27/csu/../csu/libc-start.c:344:0
#27 0x000000000040bb0a _start (/home/prithayan/work/sifive/fork-circt/circt/build/bin/circt-opt+0x40bb0a)
Aborted (core dumped)

prithayan avatar Jun 16 '22 22:06 prithayan