Open prithayan opened 2 years ago
The ModuleInliner pass crashes with the following MLIR, circt-opt --pass-pipeline='firrtl.circuit(firrtl-inliner)'
ModuleInliner
circt-opt --pass-pipeline='firrtl.circuit(firrtl-inliner)'
firrtl.circuit "Inliner" { firrtl.hierpath @nla_3 [@Bar0::@w, @Bar1] firrtl.module private @Bar1() { %w = firrtl.wire sym @a {annotations = [{circt.nonlocal = @nla_3, class = "test2"}]}: !firrtl.uint<8> } firrtl.module private @Bar0() attributes {annotations = [{class = "firrtl.passes.InlineAnnotation"}]} { firrtl.instance w sym @w @Bar1() } firrtl.module @Inliner() { firrtl.instance bar0 @Bar0() firrtl.instance bar1 @Bar0() %w = firrtl.wire sym @w : !firrtl.uint<8> } }
../lib/Dialect/FIRRTL/Transforms/ModuleInliner.cpp:376: void (anonymous namespace)::MutableNLA::setInnerSym(mlir::Attribute, mlir::StringAttr): Assertion `!renames.count(module) && "Module already renamed"' 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) t1.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 0x00007fd55d0da980 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x12980) #4 0x00007fd55bb83fb7 raise /build/glibc-S9d2JN/glibc-2.27/signal/../sysdeps/unix/sysv/linux/raise.c:51:0 #5 0x00007fd55bb85921 abort /build/glibc-S9d2JN/glibc-2.27/stdlib/abort.c:81:0 #6 0x00007fd55bb7548a __assert_fail_base /build/glibc-S9d2JN/glibc-2.27/assert/assert.c:89:0 #7 0x00007fd55bb75502 (/lib/x86_64-linux-gnu/libc.so.6+0x30502) #8 0x0000000000adee89 (anonymous namespace)::MutableNLA::setInnerSym(mlir::Attribute, mlir::StringAttr) /home/prithayan/work/sifive/fork-circt/circt/build/../lib/Dialect/FIRRTL/Transforms/ModuleInliner.cpp:0:5 #9 0x0000000000adfd52 (anonymous namespace)::Inliner::rename(llvm::StringRef, mlir::Operation*, circt::firrtl::ModuleNamespace&) /home/prithayan/work/sifive/fork-circt/circt/build/../lib/Dialect/FIRRTL/Transforms/ModuleInliner.cpp:616:23 #10 0x0000000000adf32d (anonymous namespace)::Inliner::cloneAndRename(llvm::StringRef, mlir::OpBuilder&, mlir::BlockAndValueMapping&, mlir::Operation&, llvm::DenseMap<mlir::Attribute, mlir::Attribute, llvm::DenseMapInfo<mlir::Attribute, void>, llvm::detail::DenseMapPair<mlir::Attribute, mlir::Attribute>> const&, llvm::DenseSet<mlir::Attribute, llvm::DenseMapInfo<mlir::Attribute, void>> const&, circt::firrtl::ModuleNamespace&) /home/prithayan/work/sifive/fork-circt/circt/build/../lib/Dialect/FIRRTL/Transforms/ModuleInliner.cpp:724:24 #11 0x0000000000ae06d8 (anonymous namespace)::Inliner::inlineInto(llvm::StringRef, mlir::OpBuilder&, mlir::BlockAndValueMapping&, circt::firrtl::FModuleOp, llvm::DenseMap<mlir::Attribute, mlir::Attribute, llvm::DenseMapInfo<mlir::Attribute, void>, llvm::detail::DenseMapPair<mlir::Attribute, mlir::Attribute>>&, circt::firrtl::ModuleNamespace&) /home/prithayan/work/sifive/fork-circt/circt/build/../lib/Dialect/FIRRTL/Transforms/ModuleInliner.cpp:877:7 #12 0x0000000000adaf6d (anonymous namespace)::Inliner::inlineInstances(circt::firrtl::FModuleOp) /home/prithayan/work/sifive/fork-circt/circt/build/../lib/Dialect/FIRRTL/Transforms/ModuleInliner.cpp:0:7 #13 0x0000000000ad8bdf (anonymous namespace)::Inliner::run() /home/prithayan/work/sifive/fork-circt/circt/build/../lib/Dialect/FIRRTL/Transforms/ModuleInliner.cpp:1104:3 #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 0x00007fd55bb66bf7 __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)
Can still be reproduced, replace firrtl.hierpath with hw.hierpath.
firrtl.hierpath
hw.hierpath
The
ModuleInliner
pass crashes with the following MLIR,circt-opt --pass-pipeline='firrtl.circuit(firrtl-inliner)'