llvm / llvm/torch-mlir

[BUG][MLIR][BERT] examples/torchscript_stablehlo_backend_tinybert.py

Open
#3,148 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
1.9k
Forks
736
Avg merge
5d 22h
Merged PRs (30d)
15

Description

Hello!
I've built the project on the commit 71d90788d363e65cadb2a1eee514560932eb29a7.
`g++/gcc` versions are:
```
(mlir_venv) user@lnx-user:/mnt/big/devzone/torch-mlir$ g++ --version
g++ (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

(mlir_venv) user@lnx-user:/mnt/big/devzone/torch-mlir$ gcc --version
gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
```
Project was built:
```
$ cmake -GNinja -Bbuild -DCMAKE_BUILD_TYPE=Debug -DPython3_FIND_VIRTUALENV=ONLY -DLLVM_ENABLE_PROJECTS=mlir -DLLVM_EXTERNAL_PROJECTS="torch-mlir" -DLLVM_EXTERNAL_TORCH_MLIR_SOURCE_DIR="$PWD" -DMLIR_ENABLE_BINDINGS_PYTHON=ON -DLLVM_TARGETS_TO_BUILD=host externals/llvm-project/llvm -DLIBTORCH_SRC_BUILD=ON -DLIBTORCH_VARIANT=shared -DLLVM_ENABLE_ASSERTIONS=ON -DCMAKE_C_FLAGS_DEBUG="-g -O0" -DCMAKE_CXX_FLAGS_DEBUG="-g -O0"
```
```
# Build everything (including LLVM if in-tree)
cmake --build build
```
I got a segfault for tinybert example:
```
(mlir_venv) user@lnx-user:/mnt/big/devzone/torch-mlir$ python projects/pt1/examples/torchscript_stablehlo_backend_tinybert.py
/mnt/big/devzone/torch-mlir/mlir_venv/lib/python3.10/site-packages/transformers/utils/hub.py:124: FutureWarning: Using `TRANSFORMERS_CACHE` is deprecated and will be removed in v5 of Transformers. Use `HF_HOME` instead.
warnings.warn(
/mnt/big/devzone/torch-mlir/mlir_venv/lib/python3.10/site-packages/transformers/modeling_utils.py:4225: FutureWarning: `_is_quantized_training_enabled` is going to be deprecated in transformers 4.39.0. Please use `model.hf_quantizer.is_trainable` instead
warnings.warn(
python: /mnt/big/devzone/torch-mlir/externals/llvm-project/mlir/lib/IR/Operation.cpp:624: void checkFoldResultTypes(mlir::Operation*, llvm::SmallVectorImpl&): Assertion `false && "incorrect fold result type"' failed.
Aborted (core dumped)
```
================================================================

Maybe does anyone know what the problem is? Could you please share your considerations if so?
Thank you in advance!

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure with projects/pt1/examples/torchscript_stablehlo_backend_tinybert.py using the reported build and commit. Start at externals/llvm-project/mlir/lib/IR/Operation.cpp:624 and trace the incorrect fold result type assertion. Done means the TinyBERT example no longer aborts and the regression is covered by an appropriate test.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, python, pytorch
Domain
compilers, machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.