Parent issue: #4370
Associated draft PR: #4371
An assert is seen when allocating tensors for the bw_ofm output under BidirectionalSequenceLSTM. As a context, the shape inferencing and type inferencing routines work well, and the issue seems to be with allocating tensors from within CircleExporterImpl::exportModule(Module *module). The assert happens inside the set_tensor_index function, where the node annotation is assert-checked for NULL. It turns out that the annotation isn't NULL, as it ought to be.
The details of the export can be found at the draft pull request mentioned above. I implemented the export for BidirectionalSequenceLSTM at void OperationExporter::visit(luci::CircleBidirectionalSequenceLSTM *node), closely mirorring the approach with void export_node(ExportContext &ctx, luci::CircleUnique *node), as Unique has two outputs, similar to BidirectionalSequenceLSTM.
Could anyone please let me know if anything seems off with the implementation? The callstack near the assert is produced below for reference:
libc.so.6!__GI_raise(int sig) (/build/glibc-S7xCS9/glibc-2.27/sysdeps/unix/sysv/linux/raise.c:51)
libc.so.6!__GI_abort() (/build/glibc-S7xCS9/glibc-2.27/stdlib/abort.c:79)
libc.so.6!__assert_fail_base(const char * fmt, const char * assertion, const char * file, unsigned int line, const char * function) (/build/glibc-S7xCS9/glibc-2.27/assert/assert.c:92)
libc.so.6!__GI___assert_fail(const char * assertion, const char * file, unsigned int line, const char * function) (/build/glibc-S7xCS9/glibc-2.27/assert/assert.c:101)
libluci_export.so!luci::set_tensor_index(loco::Node * node, const luci::CircleTensorIndex & tensor_id) (/home/venkat/projects/fork_fe/ONE/compiler/luci/export/src/CircleExporterUtils.cpp:241)
libluci_export.so!(anonymous namespace)::allocateCircleTensor(luci::CircleNode * node, (anonymous namespace)::CircleTensorContext & ctx) (/home/venkat/projects/fork_fe/ONE/compiler/luci/export/src/CircleTensorExporter.cpp:215)
libluci_export.so!luci::exportOpDefinedTensors(loco::Graph * g, flatbuffers::FlatBufferBuilder & builder, luci::SerializedModelData & md, luci::SerializedGraphData & gd) (/home/***/ONE/compiler/luci/export/src/CircleTensorExporter.cpp:484)
libluci_export.so!luci::CircleExporterImpl::exportModule(luci::CircleExporterImpl * const this, luci::Module * module) (/home/***/ONE/compiler/luci/export/src/CircleExporterImpl.cpp:238)
libluci_export.so!luci::CircleExporterImpl::CircleExporterImpl(luci::CircleExporterImpl * const this, luci::Module * module) (/home/***/ONE/compiler/luci/export/src/CircleExporterImpl.cpp:133)
libluci_export.so!luci::CircleExporter::invoke(const luci::CircleExporter * const this, luci::CircleExporter::Contract * contract) (/home/***/ONE/compiler/luci/export/src/CircleExporter.cpp:42)
entry(int argc, char ** argv) (/home/venkat/projects/fork_fe/ONE/compiler/luci/tester/src/WriteTester.cpp:152)
main(int argc, char ** argv) (/home/venkat/projects/fork_fe/ONE/compiler/safemain/SafeMain.cpp:41)
1) I got build error merged to current master. please fix this.
compiler/luci/import/src/Nodes/CircleBidirectionalSequenceLSTM.cpp:120:15: error: unused variable ‘opcodes’ [-Werror=unused-variable]
2) can you describe how I can reproduce this problem?
- I got build error merged to current master. please fix this.
> compiler/luci/import/src/Nodes/CircleBidirectionalSequenceLSTM.cpp:120:15: error: unused variable ‘opcodes’ [-Werror=unused-variable]
I pulled the latest changes, and am able to build successfully using the following steps:
1. rm -rf ./build
2. ./nncc configure
3. ./nncc build
git log on my pc shows the following:
commit 74aacd60a35805efd9df1e7e920e04c90ffbc69f (HEAD -> draft_bidi_lstm, origin/draft_bidi_lstm)
Merge: 968f8f94 94815000
Author: venkat.iyer <[email protected]>
Date: Wed Nov 25 14:06:31 2020 +0900
Merge branch 'master' into draft_bidi_lstm
merge latest changes from master
ONE-DCO-1.0-Signed-off-by: venkat-iyer <[email protected]>
commit 948150008659635f5a8b969f14b31157ae9ce47c (upstream/master, master)
Author: Hyeongseok Oh <[email protected]>
Date: Wed Nov 25 13:08:57 2020 +0900
[onert] Frontend for ArgMinMax (#5146)
- can you describe how I can reproduce this problem?
I tried the following:
./build/compiler/luci/tester/luci_writetester ./build/compiler/luci/tests/BidirectionalSequenceLSTM_000.circle ./build/compiler/luci/tests/BidirectionalSequenceLSTM_000_w.circle
[INFO] Circle from './build/compiler/luci/tests/BidirectionalSequenceLSTM_000.circle' to './build/compiler/luci/tests/BidirectionalSequenceLSTM_000_w.circle'
luci_writetester: /home/***/ONE/compiler/luci/export/src/CircleExporterUtils.cpp:257: void luci::set_tensor_index(loco::Node*, const CircleTensorIndex&): Assertion `node->annot<CircleTensorIndexAnnotation>() == nullptr' failed.
Aborted (core dumped)
This is the place where you should fix.
bool visit(luci::CircleBidirectionalSequenceLSTMOut *) final
{
//store_outputs(node, 1);
return true;
}
bool visit(luci::CircleBidirectionalSequenceLSTM *node) final
{
store_outputs(node, node->output_count()); // you should implement `output_count` or sth as well
return true;
}
@mhs4670go , thank you for your quick response and inputs.
I modified as you suggested (with a difference that I hardcode 1 or 2 depending on node->merge_outputs()), and the tests seem to pass.