pytorch / glow

Compiler for Neural Network hardware accelerators
Apache License 2.0
3.21k stars 688 forks source link

model-compiler does not work when using models with softmax #5144

Open notaJiminLee opened 3 years ago

notaJiminLee commented 3 years ago

I tried to convert the onnx model with softmax into Bundles.

model-compiler -model=./201207_mnist_softmax.onnx -emit-bundle=bundles -backend=CPU

However, the following error was printed: libunwind: pc not in table, pc=0xFFFFFFFFFFFFFFFF

0 0x0000000000433d78 glow::Function::createFlatten(llvm::StringRef, glow::NodeValue, unsigned int) (C:\nxp\Glow\bin\model-compiler.exe+0x33d78)

1 0x0000000002287a4f glow::CommonOperatorLoader<glow_onnx::NodeProto, glow_onnx::AttributeProto>::loadSoftmax(glow_onnx::NodeProto const&, std::unordered_map<std::cxx11::basic_string<char, std::char_traits, std::allocator >, glow_onnx::AttributeProto const*, std::hash<std::__cxx11::basic_string<char, std::char_traits, std::allocator > >, std::equal_to<std::cxx11::basic_string<char, std::char_traits, std::allocator > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits, std::allocator > const, glow_onnx::AttributeProto const*> > >&) (C:\nxp\Glow\bin\model-compiler.exe+0x1e87a4f)

2 0x000000000228fcd6 glow::CommonOperatorLoader<glow_onnx::NodeProto, glow_onnx::AttributeProto>::tryLoadCommonOperator(llvm::StringRef, glow_onnx::NodeProto const&, std::unordered_map<std::cxx11::basic_string<char, std::char_traits, std::allocator >, glow_onnx::AttributeProto const*, std::hash<std::__cxx11::basic_string<char, std::char_traits, std::allocator > >, std::equal_to<std::cxx11::basic_string<char, std::char_traits, std::allocator > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits, std::allocator > const, glow_onnx::AttributeProto const*> > >&) (C:\nxp\Glow\bin\model-compiler.exe+0x1e8fcd6)

3 0x000000000050b74e glow::ONNXModelLoader::loadOperator(glow_onnx::NodeProto const&) (C:\nxp\Glow\bin\model-compiler.exe+0x10b74e)

4 0x000000000050c936 glow::ONNXModelLoader::loadNetwork(glow_onnx::GraphProto&) (C:\nxp\Glow\bin\model-compiler.exe+0x10c936)

5 0x00000000005102a2 glow::ONNXModelLoader::ONNXModelLoader(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&, llvm::ArrayRef<char const>, llvm::ArrayRef<glow::Type const>, glow::Function&, glow::detail::GlowError*, bool)::'lambda'()::operator()() const (C:\nxp\Glow\bin\model-compiler.exe+0x1102a2)

6 0x00000000005106df glow::ONNXModelLoader::ONNXModelLoader(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&, llvm::ArrayRef<char const>, llvm::ArrayRef<glow::Type const>, glow::Function&, glow::detail::GlowError*, bool) (C:\nxp\Glow\bin\model-compiler.exe+0x1106df)

7 0x0000000000407a2e glow::Loader::loadModel() (C:\nxp\Glow\bin\model-compiler.exe+0x7a2e)

8 0x00000000026e8e5a main (C:\nxp\Glow\bin\model-compiler.exe+0x22e8e5a)

9 0x00000000004013b4 __tmainCRTStartup E:/mingwbuild/mingw-w64-crt-git/src/mingw-w64/mingw-w64-crt/crt\crtexe.c:341:8

10 0x000000000040150b mainCRTStartup E:/mingwbuild/mingw-w64-crt-git/src/mingw-w64/mingw-w64-crt/crt\crtexe.c:225:3

11 0x00007ff8336c7c24 (C:\WINDOWS\System32\KERNEL32.DLL+0x17c24)

12 0x00007ff833b2d4d1 (C:\WINDOWS\SYSTEM32\ntdll.dll+0x6d4d1)

The model-compiler works except for softmax operations in the same model.

Environement: onnx : 1.8.0 python : 3.7.0 Glow for windows (NXP) : https://www.nxp.com/design/software/development-software/eiq-ml-development-environment/eiq-for-glow-neural-network-compiler:eIQ-Glow?&tab=Design_Tools_Tab

jfix71 commented 3 years ago

Not very familiar with Windows development, but there was this previous issue that was solved, maybe can help: https://github.com/pytorch/glow/issues/4021

If not I'd suggest trying a debug build if you haven't already to see if this is a weird manifestation of a buffer overflow or something, in which case an assert might catch the issue.