[Mlir-commits] [mlir] [mlir][linalg] Edit the yieldOutputs method's builder (PR #73900)

Amir Bishara llvmlistbot at llvm.org
Wed Nov 29 22:52:19 PST 2023


amirBish wrote:

A reproduction for the stack trace that I've encountered
(the stack trace from an invalid lit test which uses `-verify-diagnostics` and runs a pass which applies a RewritePattern on linalg::CopyOp)
 
```
=================================================================
==1892478==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 112 byte(s) in 1 object(s) allocated from:
    #0 0x7f70a59329f0 in __interceptor_malloc ../../../../libsanitizer/asan/asan_malloc_linux.cc:62
    #1 0xecda8db in mlir::Operation::create(mlir::Location, mlir::OperationName, mlir::TypeRange, mlir::ValueRange, mlir::DictionaryAttr, mlir::OpaqueProperties, mlir::BlockRange, unsigned int)
    #2 0xecdafaa in mlir::Operation::create(mlir::Location, mlir::OperationName, mlir::TypeRange, mlir::ValueRange, mlir::NamedAttrList&&, mlir::OpaqueProperties, mlir::BlockRange, unsigned int)
    #3 0xecdb199 in mlir::Operation::create(mlir::Location, mlir::OperationName, mlir::TypeRange, mlir::ValueRange, mlir::NamedAttrList&&, mlir::OpaqueProperties, mlir::BlockRange, mlir::RegionRange) 
    #4 0xecdc3fb in mlir::Operation::create(mlir::OperationState const&)
    #5 0xe8c7b6f in mlir::OpBuilder::create(mlir::OperationState const&) 
    #6 0x9376dd3 in (anonymous namespace)::RegionBuilderHelper::yieldOutputs(mlir::ValueRange)
    #7 0x9379faf in mlir::linalg::CopyOp::regionBuilder(mlir::ImplicitLocOpBuilder&, mlir::Block&, llvm::ArrayRef<mlir::NamedAttribute>)
    #8 0x8c95fbb in std::_Function_handler<void (mlir::ImplicitLocOpBuilder&, mlir::Block&, llvm::ArrayRef<mlir::NamedAttribute>), void (*)(mlir::ImplicitLocOpBuilder&, mlir::Block&, llvm::ArrayRef<mlir::NamedAttribute>)>::_M_invoke(std::_Any_data const&, mlir::ImplicitLocOpBuilder&, mlir::Block&, llvm::ArrayRef<mlir::NamedAttribute>&&) 
    #9 0x934a329 in void llvm::function_ref<void (mlir::ImplicitLocOpBuilder&, mlir::Block&, llvm::ArrayRef<mlir::NamedAttribute>)>::callback_fn<std::function<void (mlir::ImplicitLocOpBuilder&, mlir::Block&, llvm::ArrayRef<mlir::NamedAttribute>)> >(long, mlir::ImplicitLocOpBuilder&, mlir::Block&, llvm::ArrayRef<mlir::NamedAttribute>)
    #10 0x9a19ee4 in fillStructuredOpRegion(mlir::OpBuilder&, mlir::Region&, mlir::TypeRange, mlir::TypeRange, llvm::ArrayRef<mlir::NamedAttribute>, llvm::function_ref<void (mlir::ImplicitLocOpBuilder&, mlir::Block&, llvm::ArrayRef<mlir::NamedAttribute>)>) 
    #11 0x9a1bf2e in buildStructuredOp(mlir::OpBuilder&, mlir::OperationState&, std::optional<mlir::TypeRange>, mlir::ValueRange, mlir::ValueRange, llvm::ArrayRef<mlir::NamedAttribute>, llvm::function_ref<void (mlir::ImplicitLocOpBuilder&, mlir::Block&, llvm::ArrayRef<mlir::NamedAttribute>)>) 
    #12 0x9a2fb72 in mlir::linalg::CopyOp::build(mlir::OpBuilder&, mlir::OperationState&, mlir::ValueRange, mlir::ValueRange, llvm::ArrayRef<mlir::NamedAttribute>)
    #13 0x951fad in MemrefImportExportToAsyncRule::matchAndRewrite(mlir::linalg::CopyOp, mlir::PatternRewriter&) const::{lambda(mlir::OpBuilder&, mlir::Location, mlir::ValueRange)#1}::operator()(mlir::OpBuilder&, mlir::Location, mlir::ValueRange) const
    #14 0x9540e9 in void llvm::function_ref<void (mlir::OpBuilder&, mlir::Location, mlir::ValueRange)>::callback_fn<MemrefImportExportToAsyncRule::matchAndRewrite(mlir::linalg::CopyOp, mlir::PatternRewriter&) const::{lambda(mlir::OpBuilder&, mlir::Location, mlir::ValueRange)#1}>(long, mlir::OpBuilder&, mlir::Location, mlir::ValueRange)
    #15 0x3daf461 in mlir::async::ExecuteOp::build(mlir::OpBuilder&, mlir::OperationState&, mlir::TypeRange, mlir::ValueRange, mlir::ValueRange, llvm::function_ref<void (mlir::OpBuilder&, mlir::Location, mlir::ValueRange)>)
    #16 0x94f561 in MemrefImportExportToAsyncRule::matchAndRewrite(mlir::linalg::CopyOp, mlir::PatternRewriter&) const
    #17 0x94dfb0 in mlir::detail::OpOrInterfaceRewritePatternBase<mlir::linalg::CopyOp>::matchAndRewrite(mlir::Operation*, mlir::PatternRewriter&) const
    #18 0xabba210 in void llvm::function_ref<void ()>::callback_fn<mlir::PatternApplicator::matchAndRewrite(mlir::Operation*, mlir::PatternRewriter&, llvm::function_ref<bool (mlir::Pattern const&)>, llvm::function_ref<void (mlir::Pattern const&)>, llvm::function_ref<mlir::LogicalResult (mlir::Pattern const&)>)::{lambda()#1}>(long)
    #19 0xabb8de4 in mlir::PatternApplicator::matchAndRewrite(mlir::Operation*, mlir::PatternRewriter&, llvm::function_ref<bool (mlir::Pattern const&)>, llvm::function_ref<void (mlir::Pattern const&)>, llvm::function_ref<mlir::LogicalResult (mlir::Pattern const&)>)
    #20 0xa9a22b4 in (anonymous namespace)::OperationLegalizer::legalize(mlir::Operation*, mlir::ConversionPatternRewriter&)
    #21 0xa9a5046 in (anonymous namespace)::OperationConverter::convertOperations(llvm::ArrayRef<mlir::Operation*>, llvm::function_ref<void (mlir::Diagnostic&)>)
    #22 0xa9b9231 in mlir::applyPartialConversion(llvm::ArrayRef<mlir::Operation*>, mlir::ConversionTarget const&, mlir::FrozenRewritePatternSet const&, llvm::DenseSet<mlir::Operation*, llvm::DenseMapInfo<mlir::Operation*, void> >*)
    #23 0xa9b94fa in mlir::applyPartialConversion(mlir::Operation*, mlir::ConversionTarget const&, mlir::FrozenRewritePatternSet const&, llvm::DenseSet<mlir::Operation*, llvm::DenseMapInfo<mlir::Operation*, void> >*)
    #24 0x95a867 in (anonymous namespace)::SomePass::runOnOperation()
    #25 0xc5970b9 in void llvm::function_ref<void ()>::callback_fn<mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int)::{lambda()#2}>(long)

SUMMARY: AddressSanitizer: 112 byte(s) leaked in 1 allocation(s).
```


https://github.com/llvm/llvm-project/pull/73900


More information about the Mlir-commits mailing list