[go: nahoru, domu]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segmentation fault in tf-opt while running a tf dialect mlir file #48365

Open
dinkdeep opened this issue Apr 7, 2021 · 2 comments
Open

Segmentation fault in tf-opt while running a tf dialect mlir file #48365

dinkdeep opened this issue Apr 7, 2021 · 2 comments
Assignees
Labels
comp:ops OPs related issues stat:awaiting tensorflower Status - Awaiting response from tensorflower TF 2.9 Issues found in the TF 2.9 release (or RCs) type:support Support issues

Comments

@dinkdeep
Copy link
dinkdeep commented Apr 7, 2021

tf-opt segfaults on running the tf.mlir file attached below
tensorflow/bazel-bin/tensorflow/compiler/mlir/tf-opt --tf-shape-inference -xla-legalize-tf=allow-partial-conversion --hlo-legalize-to-linalg -linalg-fusion-for-tensor-ops --linalg-bufferize --print-ir-before-all --print-ir-after-all resnet50_v1_tf_trimmed.mlir
GDB log is attached
The error seems to come from /home/ubuntu/.cache/bazel/_bazel_ubuntu/f3ca1101791d1383bd78d7eef31c6279/execroot/org_tensorflow/bazel-out/k8-dbg/bin/external/llvm-project/mlirnclude/mlir/Dialect/Linalg/IR/LinalgOps.cpp.inc

printOperandsOrIntegersSizesList

void InitTensorOp::print(::mlir::OpAsmPrinter &p) {
p << "linalg.init_tensor";
p << ' ';
printOperandsOrIntegersSizesList(p, *this, sizes(), static_sizesAttr());
p.printOptionalAttrDict((*this)->getAttrs(), /elidedAttrs=/{"static_sizes"});
p << ' ' << ":";
p << ' ';
p << ::llvm::ArrayRef<::mlir::Type>(result().getType());
}
On changing the batchsize to a known value like from ? to the segfault goes away.

%2 = "tf.Placeholder"() {device = "", shape = #tf.shape<?x224x224x3>} : () -> tensor<?x224x224x3xf32>

%2 = "tf.Placeholder"() {device = "", shape = #tf.shape<4x224x224x3>} : () -> tensor<4x224x224x3xf32>

Looks like it's due to an unknown dim of the input tensor .

%cst_9 = constant dense<0xFF800000> : tensor
%454 = linalg.init_tensor [3, 3] : tensor<3x3xf32>
%455 = linalg.init_tensor [TensorFlow crashed, please file a bug on https://github.com/tensorflow/tensorflow/issues with the trace below.
Stack dump:
#0 0x000055e21d04e433 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/data/dkd/tf/tensorflow/bazel-bin/tensorflow/compiler/mlir/tf-opt+0xb2af433)
#1 0x000055e21d04bcc2 llvm::sys::RunSignalHandlers() (/data/dkd/tf/tensorflow/bazel-bin/tensorflow/compiler/mlir/tf-opt+0xb2accc2)
#2 0x000055e21d04c9d8 SignalHandler(int) (/data/dkd/tf/tensorflow/bazel-bin/tensorflow/compiler/mlir/tf-opt+0xb2ad9d8)
#3 0x00007fad38f618a0 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x128a0)
#4 0x000055e21cfd8620 (anonymous namespace)::SSANameState::printValueID(mlir::Value, bool, llvm::raw_ostream&) const (.constprop.646) (/data/dkd/tf/tensorflow/bazel-bin/tensorflow/compiler/mlir/tf-opt+0xb239620)
#5 0x000055e21cfd9b4d (anonymous namespace)::OperationPrinter::printOperand(mlir::Value) (/data/dkd/tf/tensorflow/bazel-bin/tensorflow/compiler/mlir/tf-opt+0xb23ab4d)
#6 0x000055e21cf52ea7 mlir::printOperandsOrIntegersSizesList(mlir::OpAsmPrinter&, mlir::Operation*, mlir::OperandRange, mlir::ArrayAttr) (/data/dkd/tf/tensorflow/bazel-bin/tensorflow/compiler/mlir/tf-opt+0xb1b3ea7)
#7 0x000055e21ccf4ad8 mlir::linalg::InitTensorOp::print(mlir::OpAsmPrinter&) (/data/dkd/tf/tensorflow/bazel-bin/tensorflow/compiler/mlir/tf-opt+0xaf55ad8)
#8 0x000055e21cd3e6c5 _ZN4mlir2OpINS_6linalg12InitTensorOpEINS_7OpTrait10ZeroRegionENS3_9OneResultENS3_14OneTypedResultINS_10TensorTypeEE4ImplENS3_13ZeroSuccessorENS3_16VariadicOperandsENS_23MemoryEffectOpInterface5TraitEEE13printAssemblyEPNS_9OperationERNS_12OpAsmPrinterE (/data/dkd/tf/tensorflow/bazel-bin/tensorflow/compiler/mlir/tf-opt+0xaf9f6c5)
#9 0x000055e21cfe4b18 (anonymous namespace)::OperationPrinter::print(mlir::Operation*) (/data/dkd/tf/tensorflow/bazel-bin/tensorflow/compiler/mlir/tf-opt+0xb245b18)
#10 0x000055e21cfe4c43 (anonymous namespace)::OperationPrinter::print(mlir::Block*, bool, bool) (/data/dkd/tf/tensorflow/bazel-bin/tensorflow/compiler/mlir/tf-opt+0xb245c43)
#11 0x000055e21cfe512f (anonymous namespace)::OperationPrinter::printRegion(mlir::Region&, bool, bool) (/data/dkd/tf/tensorflow/bazel-bin/tensorflow/compiler/mlir/tf-opt+0xb24612f)
#12 0x000055e21cf957b6 mlir::impl::printFunctionLikeOp(mlir::OpAsmPrinter&, mlir::Operation*, llvm::ArrayRefmlir::Type, bool, llvm::ArrayRefmlir::Type) (/data/dkd/tf/tensorflow/bazel-bin/tensorflow/compiler/mlir/tf-opt+0xb1f67b6)
#13 0x000055e21cfbc8c2 print(mlir::FuncOp, mlir::OpAsmPrinter&) (.constprop.300) (/data/dkd/tf/tensorflow/bazel-bin/tensorflow/compiler/mlir/tf-opt+0xb21d8c2)
#14 0x000055e21cfbc8e9 _ZN4mlir2OpINS_6FuncOpEINS_7OpTrait9OneRegionENS2_10ZeroResultENS2_13ZeroSuccessorENS2_12ZeroOperandsENS2_11AffineScopeENS2_24AutomaticAllocationScopeENS_19CallableOpInterface5TraitENS2_12FunctionLikeENS2_19IsIsolatedFromAboveENS_17SymbolOpInterface5TraitEEE13printAssemblyEPNS_9OperationERNS_12OpAsmPrinterE (/data/dkd/tf/tensorflow/bazel-bin/tensorflow/compiler/mlir/tf-opt+0xb21d8e9)
#15 0x000055e21cfe4b18 (anonymous namespace)::OperationPrinter::print(mlir::Operation*) (/data/dkd/tf/tensorflow/bazel-bin/tensorflow/compiler/mlir/tf-opt+0xb245b18)
#16 0x000055e21cfe541c mlir::Operation::print(llvm::raw_ostream&, mlir::AsmState&, mlir::OpPrintingFlags) (/data/dkd/tf/tensorflow/bazel-bin/tensorflow/compiler/mlir/tf-opt+0xb24641c)
#17 0x000055e21cfe54d4 mlir::Operation::print(llvm::raw_ostream&, mlir::OpPrintingFlags) (/data/dkd/tf/tensorflow/bazel-bin/tensorflow/compiler/mlir/tf-opt+0xb2464d4)
#18 0x000055e21cedfec6 printIR(mlir::Operation*, bool, llvm::raw_ostream&, mlir::OpPrintingFlags) (.constprop.117) (/data/dkd/tf/tensorflow/bazel-bin/tensorflow/compiler/mlir/tf-opt+0xb140ec6)
#19 0x000055e21cee02b3 void llvm::function_ref<void (llvm::raw_ostream&)>::callback_fn<(anonymous namespace)::IRPrinterInstrumentation::runAfterPass(mlir::Pass*, mlir::Operation*)::'lambda'(llvm::raw_ostream&)>(long, llvm::raw_ostream&) (/data/dkd/tf/tensorflow/bazel-bin/tensorflow/compiler/mlir/tf-opt+0xb1412b3)
#20 0x000055e21cedfa12 (anonymous namespace)::BasicIRPrinterConfig::printAfterIfEnabled(mlir::Pass*, mlir::Operation*, llvm::function_ref<void (llvm::raw_ostream&)>) (/data/dkd/tf/tensorflow/bazel-bin/tensorflow/compiler/mlir/tf-opt+0xb140a12)
#21 0x000055e21cee075f (anonymous namespace)::IRPrinterInstrumentation::runAfterPass(mlir::Pass*, mlir::Operation*) (/data/dkd/tf/tensorflow/bazel-bin/tensorflow/compiler/mlir/tf-opt+0xb14175f)
#22 0x000055e21ceffd71 mlir::PassInstrumentor::runAfterPass(mlir::Pass*, mlir::Operation*) (/data/dkd/tf/tensorflow/bazel-bin/tensorflow/compiler/mlir/tf-opt+0xb160d71)
#23 0x000055e21cf062ed mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/data/dkd/tf/tensorflow/bazel-bin/tensorflow/compiler/mlir/tf-opt+0xb1672ed)
#24 0x000055e21cf06611 mlir::detail::OpToOpPassAdaptor::runPipeline(llvm::iterator_range<llvm::pointee_iterator<std::unique_ptr<mlir::Pass, std::default_deletemlir::Pass >, mlir::Pass> >, mlir::Operation, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (/data/dkd/tf/tensorflow/bazel-bin/tensorflow/compiler/mlir/tf-opt+0xb167611)
#25 0x000055e21cf07791 mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::'lambda'(llvm::MutableArrayRefmlir::OpPassManager) std::for_each<llvm::SmallVector<mlir::OpPassManager, 1u>, mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::'lambda'(llvm::MutableArrayRefmlir::OpPassManager)>(llvm::SmallVector<mlir::OpPassManager, 1u>, llvm::SmallVector<mlir::OpPassManager, 1u>, mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::'lambda'(llvm::MutableArrayRefmlir::OpPassManager)) (/data/dkd/tf/tensorflow/bazel-bin/tensorflow/compiler/mlir/tf-opt+0xb168791)
#26 0x000055e21cf058c9 mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool) (/data/dkd/tf/tensorflow/bazel-bin/tensorflow/compiler/mlir/tf-opt+0xb1668c9)
#27 0x000055e21cf062df mlir::detail::OpToOpPassAdaptor::run(mlir::Pass
, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/data/dkd/tf/tensorflow/bazel-bin/tensorflow/compiler/mlir/tf-opt+0xb1672df)
#28 0x000055e21cf06611 mlir::detail::OpToOpPassAdaptor::runPipeline(llvm::iterator_range<llvm::pointee_iterator<std::unique_ptr<mlir::Pass, std::default_deletemlir::Pass >, mlir::Pass> >, mlir::Operation, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (/data/dkd/tf/tensorflow/bazel-bin/tensorflow/compiler/mlir/tf-opt+0xb167611)
#29 0x000055e21cf07d24 mlir::PassManager::run(mlir::Operation*) (/data/dkd/tf/tensorflow/bazel-bin/tensorflow/compiler/mlir/tf-opt+0xb168d24)
#30 0x000055e218f746a7 performActions(llvm::raw_ostream&, bool, bool, llvm::SourceMgr&, mlir::MLIRContext*, mlir::PassPipelineCLParser const&) (.constprop.155) (/data/dkd/tf/tensorflow/bazel-bin/tensorflow/compiler/mlir/tf-opt+0x71d56a7)
#31 0x000055e218f74a4d processBuffer(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_deletellvm::MemoryBuffer >, bool, bool, bool, bool, mlir::PassPipelineCLParser const&, mlir::DialectRegistry&) (.constprop.154) (/data/dkd/tf/tensorflow/bazel-bin/tensorflow/compiler/mlir/tf-opt+0x71d5a4d)
#32 0x000055e218f74d51 mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_deletellvm::MemoryBuffer >, mlir::PassPipelineCLParser const&, mlir::DialectRegistry&, bool, bool, bool, bool, bool) (/data/dkd/tf/tensorflow/bazel-bin/tensorflow/compiler/mlir/tf-opt+0x71d5d51)
#33 0x000055e218f7563f mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&, bool) (/data/dkd/tf/tensorflow/bazel-bin/tensorflow/compiler/mlir/tf-opt+0x71d663f)
#34 0x000055e2128ce58c main (/data/dkd/tf/tensorflow/bazel-bin/tensorflow/compiler/mlir/tf-opt+0xb2f58c)
#35 0x00007fad38967b97 __libc_start_main /build/glibc-2ORdQG/glibc-2.27/csu/../csu/libc-start.c:344:0
#36 0x000055e2129bf4da _start (/data/dkd/tf/tensorflow/bazel-bin/tensorflow/compiler/mlir/tf-opt+0xc204da)
#0 0x000055e21d04e433 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/data/dkd/tf/tensorflow/bazel-bin/tensorflow/compiler/mlir/tf-opt+0xb2af433)
#1 0x000055e21d04bcc2 llvm::sys::RunSignalHandlers() (/data/dkd/tf/tensorflow/bazel-bin/tensorflow/compiler/mlir/tf-opt+0xb2accc2)
#2 0x000055e21d04c9d8 SignalHandler(int) (/data/dkd/tf/tensorflow/bazel-bin/tensorflow/compiler/mlir/tf-opt+0xb2ad9d8)
#3 0x00007fad38f618a0 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x128a0)
#4 0x000055e21cfd8620 (anonymous namespace)::SSANameState::printValueID(mlir::Value, bool, llvm::raw_ostream&) const (.constprop.646) (/data/dkd/tf/tensorflow/bazel-bin/tensorflow/compiler/mlir/tf-opt+0xb239620)
#5 0x000055e21cfd9b4d (anonymous namespace)::OperationPrinter::printOperand(mlir::Value) (/data/dkd/tf/tensorflow/bazel-bin/tensorflow/compiler/mlir/tf-opt+0xb23ab4d)
#6 0x000055e21cf52ea7 mlir::printOperandsOrIntegersSizesList(mlir::OpAsmPrinter&, mlir::Operation*, mlir::OperandRange, mlir::ArrayAttr) (/data/dkd/tf/tensorflow/bazel-bin/tensorflow/compiler/mlir/tf-opt+0xb1b3ea7)
#7 0x000055e21ccf4ad8 mlir::linalg::InitTensorOp::print(mlir::OpAsmPrinter&) (/data/dkd/tf/tensorflow/bazel-bin/tensorflow/compiler/mlir/tf-opt+0xaf55ad8)
#8 0x000055e21cd3e6c5 _ZN4mlir2OpINS_6linalg12InitTensorOpEINS_7OpTrait10ZeroRegionENS3_9OneResultENS3_14OneTypedResultINS_10TensorTypeEE4ImplENS3_13ZeroSuccessorENS3_16VariadicOperandsENS_23MemoryEffectOpInterface5TraitEEE13printAssemblyEPNS_9OperationERNS_12OpAsmPrinterE (/data/dkd/tf/tensorflow/bazel-bin/tensorflow/compiler/mlir/tf-opt+0xaf9f6c5)
#9 0x000055e21cfe4b18 (anonymous namespace)::OperationPrinter::print(mlir::Operation*) (/data/dkd/tf/tensorflow/bazel-bin/tensorflow/compiler/mlir/tf-opt+0xb245b18)
#10 0x000055e21cfe4c43 (anonymous namespace)::OperationPrinter::print(mlir::Block*, bool, bool) (/data/dkd/tf/tensorflow/bazel-bin/tensorflow/compiler/mlir/tf-opt+0xb245c43)
#11 0x000055e21cfe512f (anonymous namespace)::OperationPrinter::printRegion(mlir::Region&, bool, bool) (/data/dkd/tf/tensorflow/bazel-bin/tensorflow/compiler/mlir/tf-opt+0xb24612f)
#12 0x000055e21cf957b6 mlir::impl::printFunctionLikeOp(mlir::OpAsmPrinter&, mlir::Operation*, llvm::ArrayRefmlir::Type, bool, llvm::ArrayRefmlir::Type) (/data/dkd/tf/tensorflow/bazel-bin/tensorflow/compiler/mlir/tf-opt+0xb1f67b6)
#13 0x000055e21cfbc8c2 print(mlir::FuncOp, mlir::OpAsmPrinter&) (.constprop.300) (/data/dkd/tf/tensorflow/bazel-bin/tensorflow/compiler/mlir/tf-opt+0xb21d8c2)
#14 0x000055e21cfbc8e9 _ZN4mlir2OpINS_6FuncOpEINS_7OpTrait9OneRegionENS2_10ZeroResultENS2_13ZeroSuccessorENS2_12ZeroOperandsENS2_11AffineScopeENS2_24AutomaticAllocationScopeENS_19CallableOpInterface5TraitENS2_12FunctionLikeENS2_19IsIsolatedFromAboveENS_17SymbolOpInterface5TraitEEE13printAssemblyEPNS_9OperationERNS_12OpAsmPrinterE (/data/dkd/tf/tensorflow/bazel-bin/tensorflow/compiler/mlir/tf-opt+0xb21d8e9)
#15 0x000055e21cfe4b18 (anonymous namespace)::OperationPrinter::print(mlir::Operation*) (/data/dkd/tf/tensorflow/bazel-bin/tensorflow/compiler/mlir/tf-opt+0xb245b18)
#16 0x000055e21cfe541c mlir::Operation::print(llvm::raw_ostream&, mlir::AsmState&, mlir::OpPrintingFlags) (/data/dkd/tf/tensorflow/bazel-bin/tensorflow/compiler/mlir/tf-opt+0xb24641c)
#17 0x000055e21cfe54d4 mlir::Operation::print(llvm::raw_ostream&, mlir::OpPrintingFlags) (/data/dkd/tf/tensorflow/bazel-bin/tensorflow/compiler/mlir/tf-opt+0xb2464d4)
#18 0x000055e21cedfec6 printIR(mlir::Operation*, bool, llvm::raw_ostream&, mlir::OpPrintingFlags) (.constprop.117) (/data/dkd/tf/tensorflow/bazel-bin/tensorflow/compiler/mlir/tf-opt+0xb140ec6)
#19 0x000055e21cee02b3 void llvm::function_ref<void (llvm::raw_ostream&)>::callback_fn<(anonymous namespace)::IRPrinterInstrumentation::runAfterPass(mlir::Pass*, mlir::Operation*)::'lambda'(llvm::raw_ostream&)>(long, llvm::raw_ostream&) (/data/dkd/tf/tensorflow/bazel-bin/tensorflow/compiler/mlir/tf-opt+0xb1412b3)
#20 0x000055e21cedfa12 (anonymous namespace)::BasicIRPrinterConfig::printAfterIfEnabled(mlir::Pass*, mlir::Operation*, llvm::function_ref<void (llvm::raw_ostream&)>) (/data/dkd/tf/tensorflow/bazel-bin/tensorflow/compiler/mlir/tf-opt+0xb140a12)
#21 0x000055e21cee075f (anonymous namespace)::IRPrinterInstrumentation::runAfterPass(mlir::Pass*, mlir::Operation*) (/data/dkd/tf/tensorflow/bazel-bin/tensorflow/compiler/mlir/tf-opt+0xb14175f)
#22 0x000055e21ceffd71 mlir::PassInstrumentor::runAfterPass(mlir::Pass*, mlir::Operation*) (/data/dkd/tf/tensorflow/bazel-bin/tensorflow/compiler/mlir/tf-opt+0xb160d71)
#23 0x000055e21cf062ed mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/data/dkd/tf/tensorflow/bazel-bin/tensorflow/compiler/mlir/tf-opt+0xb1672ed)
#24 0x000055e21cf06611 mlir::detail::OpToOpPassAdaptor::runPipeline(llvm::iterator_range<llvm::pointee_iterator<std::unique_ptr<mlir::Pass, std::default_deletemlir::Pass >, mlir::Pass> >, mlir::Operation, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (/data/dkd/tf/tensorflow/bazel-bin/tensorflow/compiler/mlir/tf-opt+0xb167611)
#25 0x000055e21cf07791 mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::'lambda'(llvm::MutableArrayRefmlir::OpPassManager) std::for_each<llvm::SmallVector<mlir::OpPassManager, 1u>, mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::'lambda'(llvm::MutableArrayRefmlir::OpPassManager)>(llvm::SmallVector<mlir::OpPassManager, 1u>, llvm::SmallVector<mlir::OpPassManager, 1u>, mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::'lambda'(llvm::MutableArrayRefmlir::OpPassManager)) (/data/dkd/tf/tensorflow/bazel-bin/tensorflow/compiler/mlir/tf-opt+0xb168791)
#26 0x000055e21cf058c9 mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool) (/data/dkd/tf/tensorflow/bazel-bin/tensorflow/compiler/mlir/tf-opt+0xb1668c9)
#27 0x000055e21cf062df mlir::detail::OpToOpPassAdaptor::run(mlir::Pass
, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/data/dkd/tf/tensorflow/bazel-bin/tensorflow/compiler/mlir/tf-opt+0xb1672df)
#28 0x000055e21cf06611 mlir::detail::OpToOpPassAdaptor::runPipeline(llvm::iterator_range<llvm::pointee_iterator<std::unique_ptr<mlir::Pass, std::default_deletemlir::Pass >, mlir::Pass> >, mlir::Operation, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (/data/dkd/tf/tensorflow/bazel-bin/tensorflow/compiler/mlir/tf-opt+0xb167611)
#29 0x000055e21cf07d24 mlir::PassManager::run(mlir::Operation*) (/data/dkd/tf/tensorflow/bazel-bin/tensorflow/compiler/mlir/tf-opt+0xb168d24)
#30 0x000055e218f746a7 performActions(llvm::raw_ostream&, bool, bool, llvm::SourceMgr&, mlir::MLIRContext*, mlir::PassPipelineCLParser const&) (.constprop.155) (/data/dkd/tf/tensorflow/bazel-bin/tensorflow/compiler/mlir/tf-opt+0x71d56a7)
#31 0x000055e218f74a4d processBuffer(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_deletellvm::MemoryBuffer >, bool, bool, bool, bool, mlir::PassPipelineCLParser const&, mlir::DialectRegistry&) (.constprop.154) (/data/dkd/tf/tensorflow/bazel-bin/tensorflow/compiler/mlir/tf-opt+0x71d5a4d)
#32 0x000055e218f74d51 mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_deletellvm::MemoryBuffer >, mlir::PassPipelineCLParser const&, mlir::DialectRegistry&, bool, bool, bool, bool, bool) (/data/dkd/tf/tensorflow/bazel-bin/tensorflow/compiler/mlir/tf-opt+0x71d5d51)
#33 0x000055e218f7563f mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&, bool) (/data/dkd/tf/tensorflow/bazel-bin/tensorflow/compiler/mlir/tf-opt+0x71d663f)
#34 0x000055e2128ce58c main (/data/dkd/tf/tensorflow/bazel-bin/tensorflow/compiler/mlir/tf-opt+0xb2f58c)
#35 0x00007fad38967b97 __libc_start_main /build/glibc-2ORdQG/glibc-2.27/csu/../csu/libc-start.c:344:0
#36 0x000055e2129bf4da _start (/data/dkd/tf/tensorflow/bazel-bin/tensorflow/compiler/mlir/tf-opt+0xc204da)

-------------------- GDB log ------
%454 = linalg.init_tensor [3, 3] : tensor<3x3xf32>
%455 = linalg.init_tensor [tf-opt: external/llvm-project/llvm/include/llvm/ADT/STLExtras.h:1118: ReferenceT llvm::detail::indexed_accessor_range_base<DerivedT, BaseT, T, PointerT, ReferenceT>::operator const [with DerivedT = mlir::ValueRange; BaseT = llvm::PointerUnion<const mlir::Value*, mlir::OpOperand*, mlir::detail::OpResultImpl*>; T = mlir::Value; PointerT = mlir::Value; ReferenceT = mlir::Value; size_t = long unsigned int]: Assertion Index < size() && "invalid index for value range"' failed. Program received signal SIGABRT, Aborted. __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51 51 ../sysdeps/unix/sysv/linux/raise.c: No such file or directory. (gdb) bt #0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51 #1 0x00007ffff0d1b8b1 in __GI_abort () at abort.c:79 #2 0x00007ffff0d0b42a in __assert_fail_base (fmt=0x7ffff0e92a38 "%s%s%s:%u: %s%sAssertion %s' failed.\n%n", assertion=assertion@entry=0x555572d2ca38 "Index < size() && "invalid index for value range"",
file=file@entry=0x555572d2c8a0 "external/llvm-project/llvm/include/llvm/ADT/STLExtras.h", line=line@entry=1118,
function=function@entry=0x555572d3d6a0 <llvm::detail::indexed_accessor_range_base<mlir::ValueRange, llvm::PointerUnion<mlir::Value const*, mlir::OpOperand*, mlir::detail::OpResultImpl*>, mlir::Value, mlir::Value, mlir::Value>::operator[](unsigned long) const::PRETTY_FUNCTION> "ReferenceT llvm::detail::indexed_accessor_range_base<DerivedT, BaseT, T, PointerT, ReferenceT>::operator const [with DerivedT = mlir::ValueRange; BaseT = llvm::PointerUnion<const mlir::Value"...) at assert.c:92
#3 0x00007ffff0d0b4a2 in __GI___assert_fail (assertion=0x555572d2ca38 "Index < size() && "invalid index for value range"", file=0x555572d2c8a0 "external/llvm-project/llvm/include/llvm/ADT/STLExtras.h",
line=1118,
function=0x555572d3d6a0 <llvm::detail::indexed_accessor_range_base<mlir::ValueRange, llvm::PointerUnion<mlir::Value const*, mlir::OpOperand*, mlir::detail::OpResultImpl*>, mlir::Value, mlir::Value, mlir::Value>::operator[](unsigned long) const::PRETTY_FUNCTION> "ReferenceT llvm::detail::indexed_accessor_range_base<DerivedT, BaseT, T, PointerT, ReferenceT>::operator const [with DerivedT = mlir::ValueRange; BaseT = llvm::PointerUnion<const mlir::Value"...) at assert.c:101
#4 0x00005555628b36c1 in llvm::detail::indexed_accessor_range_base<mlir::ValueRange, llvm::PointerUnion<mlir::Value const*, mlir::OpOperand*, mlir::detail::OpResultImpl*>, mlir::Value, mlir::Value, mlir::Value>::operator[] (this=0x7fffffffc450, Index=0) at external/llvm-project/llvm/include/llvm/ADT/STLExtras.h:1118
#5 0x0000555568efb182 in <lambda(mlir::Attribute)>::operator()(mlir::Attribute) const (__closure=0x7fffffffc370, a=...) at external/llvm-project/mlir/lib/Interfaces/ViewLikeInterface.cpp:84
#6 0x0000555568efbf3a in llvm::interleave<const mlir::Attribute*, printOperandsOrIntegersListImpl(mlir::OpAsmPrinter&, mlir::ValueRange, mlir::ArrayAttr) [with long int dynVal = -1l]::<lambda(mlir::Attribute)>, llvm::interleave(const Container&, StreamT&, UnaryFunctor, const llvm::StringRef&) [with Container = mlir::ArrayAttr; UnaryFunctor = printOperandsOrIntegersListImpl(mlir::OpAsmPrinter&, mlir::ValueRange, mlir::ArrayAttr) [with long int dynVal = -1l]::<lambda(mlir::Attribute)>; StreamT = mlir::OpAsmPrinter; T = const mlir::Attribute]::<lambda()>, void>(const mlir::Attribute *, const mlir::Attribute *, <lambda(mlir::Attribute)>, llvm::<lambda()>) (begin=0x55557c087c08, end=0x55557c087c28, each_fn=..., between_fn=...) at external/llvm-project/llvm/include/llvm/ADT/STLExtras.h:1740
#7 0x0000555568efbe91 in llvm::interleave<mlir::ArrayAttr, printOperandsOrIntegersListImpl(mlir::OpAsmPrinter&, mlir::ValueRange, mlir::ArrayAttr) [with long int dynVal = -1l]::<lambda(mlir::Attribute)>, mlir::OpAsmPrinter, const mlir::Attribute>(const mlir::ArrayAttr &, mlir::OpAsmPrinter &, <lambda(mlir::Attribute)>, const llvm::StringRef &) (c=..., os=..., each_fn=..., separator=...)
at external/llvm-project/llvm/include/llvm/ADT/STLExtras.h:1762
#8 0x0000555568efbd33 in llvm::interleaveComma<mlir::ArrayAttr, printOperandsOrIntegersListImpl(mlir::OpAsmPrinter&, mlir::ValueRange, mlir::ArrayAttr) [with long int dynVal = -1l]::<lambda(mlir::Attribute)>, mlir::OpAsmPrinter, const mlir::Attribute>(const mlir::ArrayAttr &, mlir::OpAsmPrinter &, <lambda(mlir::Attribute)>) (c=..., os=..., each_fn=...)
at external/llvm-project/llvm/include/llvm/ADT/STLExtras.h:1776
#9 0x0000555568efb24e in printOperandsOrIntegersListImpl<-1l> (p=..., values=..., arrayAttr=...) at external/llvm-project/mlir/lib/Interfaces/ViewLikeInterface.cpp:81
#10 0x0000555568efaf40 in mlir::printOperandsOrIntegersSizesList (p=..., op=0x55557b4738b0, values=..., integers=...) at external/llvm-project/mlir/lib/Interfaces/ViewLikeInterface.cpp:103
#11 0x0000555568952ad0 in mlir::linalg::InitTensorOp::print (this=0x7fffffffc588, p=...)
at bazel-out/k8-dbg/bin/external/llvm-project/mlir/_virtual_includes/LinalgOpsIncGen/mlir/Dialect/Linalg/IR/LinalgOps.cpp.inc:313
#12 0x0000555568a60d2b in mlir::Op<mlir::linalg::InitTensorOp, mlir::OpTrait::ZeroRegion, mlir::OpTrait::OneResult, mlir::OpTrait::OneTypedResultmlir::TensorType::Impl, mlir::OpTrait::ZeroSuccessor, mlir::OpTrait::VariadicOperands, mlir::MemoryEffectOpInterface::Trait>::printAssembly (op=0x55557b4738b0, p=...) at external/llvm-project/mlir/include/mlir/IR/OpDefinition.h:1709
#13 0x0000555569018294 in mlir::AbstractOperation::printAssembly (this=0x55557bf662f8, op=0x55557b4738b0, p=...) at external/llvm-project/mlir/include/mlir/IR/OperationSupport.h:93
#14 0x000055556900f789 in (anonymous namespace)::OperationPrinter::printOperation (this=0x7fffffffca60, op=0x55557b4738b0) at external/llvm-project/mlir/lib/IR/AsmPrinter.cpp:2434
#15 0x000055556900f4c0 in (anonymous namespace)::OperationPrinter::print (this=0x7fffffffca60, op=0x55557b4738b0) at external/llvm-project/mlir/lib/IR/AsmPrinter.cpp:2397
#16 0x0000555569010060 in (anonymous namespace)::OperationPrinter::print (this=0x7fffffffca60, block=0x55557c03d9b0, printBlockArgs=false, printBlockTerminator=true)
at external/llvm-project/mlir/lib/IR/AsmPrinter.cpp:2534

resnet50_v1_tf_trimmed.tgz.txt

@amahendrakar
Copy link
Contributor

@dinkdeep,
Could you please share the TensorFlow version you are using?

Also, please let us know if this issue is related to issues #48338 #48362 and #48363? Thanks!

@amahendrakar amahendrakar added the stat:awaiting response Status - Awaiting response from author label Apr 7, 2021
@dinkdeep
Copy link
Author
dinkdeep commented Apr 7, 2021

@amahendrakar
Please find the info

  1. I had built the TensorFlow from source code
    TensorFlow installed from (source or binary): Source
    commit ac5f2a1 (HEAD -> master, origin/nightly, origin/master, origin/HEAD
    (base) ubuntu@HYD1PNF01:/data/dkd/tf/tensorflow$ git log
    commit ac5f2a1 (HEAD -> master, origin/nightly, origin/master, origin/HEAD)
    Author: Pankaj Kanwar pkanwar@google.com
    Date: Fri Mar 19 21:01:15 2021 -0700

  2. Build the tf-opt with bazel in tf folder
    #time bazel build --jobs 100 -c opt tensorflow/compiler/mlir:tf-opt

  3. Please use the attached "resnet50_v1_tf_trimmed.tgz.txt" file .mlir file, Download the above txt file run it with the tf-opt with following mlir passes
    **# /data/dkd/tf/tensorflow/bazel-bin/tensorflow/compiler/mlir/tf-opt --tf-shape-inference -xla-legalize-tf=allow-partial-conversion --hlo-legalize-to-linalg -linalg-fusion-for-tensor-ops --linalg-bufferize --print-ir-before-all --print-ir-after-all resnet50_v1_tf_trimmed.mlir

Basically, it is a mlir file with tf Dialect which is being converted to HLO Dialect and then to linalg Dialect.

#48338 is a pretty minor issue not a bug just an unused variable .
#48362 is case where mhlo.conv operator of HLO dialect is not get getting converted to linalg.con when the tf.Conv operator has padding specified, the hlo-legalize-to-linalg fails and in the linalg dialect we see the mhlo.convolution operator .

#48363 is something a feature request where conv operator of linalg Dialects are not placed inside Generic region operator, Some thing can be done to get them inside the regions.

@amahendrakar amahendrakar added comp:ops OPs related issues TF 2.5 Issues related to TF 2.5 type:support Support issues and removed stat:awaiting response Status - Awaiting response from author type:bug Bug labels Apr 14, 2021
@amahendrakar amahendrakar assigned ymodak and unassigned amahendrakar Apr 14, 2021
@ymodak ymodak added the stat:awaiting tensorflower Status - Awaiting response from tensorflower label Apr 21, 2021
@sushreebarsa sushreebarsa added TF 2.9 Issues found in the TF 2.9 release (or RCs) and removed TF 2.5 Issues related to TF 2.5 labels Aug 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp:ops OPs related issues stat:awaiting tensorflower Status - Awaiting response from tensorflower TF 2.9 Issues found in the TF 2.9 release (or RCs) type:support Support issues
Projects
None yet
Development

No branches or pull requests

5 participants