llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
29.17k stars 12.04k forks source link

tpuc-opt: ../lib/Dialect/Top/Interfaces/Reshape.cpp:90: void tpu_mlir::top::ReshapeOp::shape_inference(): Assertion `num_input == num_output' failed. #64057

Open hanmoly opened 1 year ago

hanmoly commented 1 year ago
[Running]: tpuc-opt glm_block_cache_0_origin.mlir --shape-infer --canonicalize --extra-optimize -o glm_block_cache_0.mlir
tpuc-opt: ../lib/Dialect/Top/Interfaces/Reshape.cpp:90: void tpu_mlir::top::ReshapeOp::shape_inference(): Assertion `num_input == num_output' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: tpuc-opt glm_block_cache_0_origin.mlir --init --shape-infer --canonicalize --extra-optimize --deinit --mlir-print-debuginfo -o glm_block_cache_0.mlir
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
0  tpuc-opt        0x00005575e17510ba
1  tpuc-opt        0x00005575e174e3bc
2  libpthread.so.0 0x00007f0f37e66980
3  libc.so.6       0x00007f0f36f33e87 gsignal + 199
4  libc.so.6       0x00007f0f36f357f1 abort + 321
5  libc.so.6       0x00007f0f36f253fa
6  libc.so.6       0x00007f0f36f25472
7  tpuc-opt        0x00005575e13830c6
8  tpuc-opt        0x00005575e13026b7
9  tpuc-opt        0x00005575e13e35c4
10 tpuc-opt        0x00005575e0b470ac
11 tpuc-opt        0x00005575e13e57d1
12 tpuc-opt        0x00005575e14b1b6e
13 tpuc-opt        0x00005575e14b2a58
14 tpuc-opt        0x00005575e14b309f
15 tpuc-opt        0x00005575e0ae31d5
16 tpuc-opt        0x00005575e0ae3deb
17 tpuc-opt        0x00005575e0ae3fd2
18 tpuc-opt        0x00005575e16cf4df
19 tpuc-opt        0x00005575e0adcf02
20 tpuc-opt        0x00005575e0ae4387
21 tpuc-opt        0x00005575e0ace160
22 libc.so.6       0x00007f0f36f16c87 __libc_start_main + 231
23 tpuc-opt        0x00005575e0ada5fa
Aborted
Traceback (most recent call last):
  File "/workspace/code/tpu-mlir/python/tools/model_transform.py", line 261, in <module>
    tool.model_transform(args.mlir, args.add_postprocess)
  File "/workspace/code/tpu-mlir/python/tools/model_transform.py", line 51, in model_transform
    mlir_opt_for_top(mlir_origin, self.mlir_file, add_postprocess)
  File "/workspace/code/tpu-mlir/python/utils/mlir_shell.py", line 60, in mlir_opt_for_top
    _os_system(cmd)
  File "/workspace/code/tpu-mlir/python/utils/mlir_shell.py", line 50, in _os_system
    raise RuntimeError("[!Error]: {}".format(cmd_str))
RuntimeError: [!Error]: tpuc-opt glm_block_cache_0_origin.mlir --shape-infer --canonicalize --extra-optimize -o glm_block_cache_0.mlir
llvmbot commented 1 year ago

@llvm/issue-subscribers-mlir-python

[Running]: tpuc-opt glm_block_cache_0_origin.mlir --shape-infer --canonicalize --extra-optimize -o glm_block_cache_0.mlir tpuc-opt: ../lib/Dialect/Top/Interfaces/Reshape.cpp:90: void tpu_mlir::top::ReshapeOp::shape_inference(): Assertion `num_input == num_output' failed. PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace. Stack dump: 0. Program arguments: tpuc-opt glm_block_cache_0_origin.mlir --init --shape-infer --canonicalize --extra-optimize --deinit --mlir-print-debuginfo -o glm_block_cache_0.mlir Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it): 0 tpuc-opt 0x00005575e17510ba 1 tpuc-opt 0x00005575e174e3bc 2 libpthread.so.0 0x00007f0f37e66980 3 libc.so.6 0x00007f0f36f33e87 gsignal + 199 4 libc.so.6 0x00007f0f36f357f1 abort + 321 5 libc.so.6 0x00007f0f36f253fa 6 libc.so.6 0x00007f0f36f25472 7 tpuc-opt 0x00005575e13830c6 8 tpuc-opt 0x00005575e13026b7 9 tpuc-opt 0x00005575e13e35c4 10 tpuc-opt 0x00005575e0b470ac 11 tpuc-opt 0x00005575e13e57d1 12 tpuc-opt 0x00005575e14b1b6e 13 tpuc-opt 0x00005575e14b2a58 14 tpuc-opt 0x00005575e14b309f 15 tpuc-opt 0x00005575e0ae31d5 16 tpuc-opt 0x00005575e0ae3deb 17 tpuc-opt 0x00005575e0ae3fd2 18 tpuc-opt 0x00005575e16cf4df 19 tpuc-opt 0x00005575e0adcf02 20 tpuc-opt 0x00005575e0ae4387 21 tpuc-opt 0x00005575e0ace160 22 libc.so.6 0x00007f0f36f16c87 __libc_start_main + 231 23 tpuc-opt 0x00005575e0ada5fa Aborted Traceback (most recent call last): File "/workspace/code/tpu-mlir/python/tools/model_transform.py", line 261, in <module> tool.model_transform(args.mlir, args.add_postprocess) File "/workspace/code/tpu-mlir/python/tools/model_transform.py", line 51, in model_transform mlir_opt_for_top(mlir_origin, self.mlir_file, add_postprocess) File "/workspace/code/tpu-mlir/python/utils/mlir_shell.py", line 60, in mlir_opt_for_top _os_system(cmd) File "/workspace/code/tpu-mlir/python/utils/mlir_shell.py", line 50, in _os_system raise RuntimeError("[!Error]: {}".format(cmd_str)) RuntimeError: [!Error]: tpuc-opt glm_block_cache_0_origin.mlir --shape-infer --canonicalize --extra-optimize -o glm_block_cache_0.mlir
rikhuijzer commented 1 year ago

@hanmoly, do you have the contents of the glm_block_cache_0_origin.mlir file? I suspect this issue is hard to reproduce without that file.

joker-eph commented 1 year ago

The error is in tpu_mlir::top::ReshapeOp::shape_inference(), that does not seem like upstream code?

ftynse commented 1 year ago

And it isn't related to python, it looks like your downstream python runs your tpuc-opt executable, which crashes. Upstream MLIR can't help here.

GH-4684 commented 12 months ago

I encountered the same problem. Later I set the input_shape of model_transform.py to the same size as the onnx model, and the error disappeared.