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

[tosa] failed to legalize operation 'arith.extsi' #19402

Open
lundong opened this issue Dec 6, 2024 · 5 comments
Open

[tosa] failed to legalize operation 'arith.extsi' #19402

lundong opened this issue Dec 6, 2024 · 5 comments
Labels
bug 🐞 Something isn't working integrations/tosa Tensor Operator Set Architecture (TOSA) import, tests, etc. regression Marks regression of feature, compatibility or performance

Comments

@lundong
Copy link
Contributor

lundong commented Dec 6, 2024

What happened?

When we compile some mlir models via iree-compile, it returned the error messages like:

:0: error: loc("main"): 'arith.extsi' op operand #0 must be signless-fixed-width-integer-like, but got 'ui8'
:0: note: loc("main"): see current operation: %946 = "arith.extsi"(%arg423) : (ui8) -> i32

It has occured since iree-3.1.0rc20241206. Previous IREE revisions were okay.

Steps to reproduce your issue

  1. Download the attached mobilenet_v1.mlir (which is converted from tflite model by iree-import-tflite)
  2. iree-compile --iree-hal-target-backends=llvm-cpu path/to/mobilenet_v1.mlir
  3. See error
    :0: error: loc("main"): 'arith.extsi' op operand #0 must be signless-fixed-width-integer-like, but got 'ui8'
    :0: note: loc("main"): see current operation: %946 = "arith.extsi"(%arg423) : (ui8) -> i32
    mobilenet_v1.zip

What component(s) does this issue relate to?

Compiler

Version information

iree-3.1.0rc20241206.

Additional context

This issue has occured since iree-3.1.0rc20241206. Previous IREE revisions were okay.

@lundong lundong added the bug 🐞 Something isn't working label Dec 6, 2024
@IanWood1
Copy link
Contributor

IanWood1 commented Dec 6, 2024

It appears that unsigned types (for example, ui8) are no longer legal for this op see llvm/llvm-project#118075. I'm not sure why there is no verifier to catch this, however.

@ScottTodd ScottTodd added the regression Marks regression of feature, compatibility or performance label Dec 6, 2024
@ScottTodd
Copy link
Member

Oof. Mobilenet regression is not good. We're lacking test coverage for TOSA / TFLite (iree-org/iree-test-suites#5)

Commit range: iree-3.1.0rc20241205...iree-3.1.0rc20241206 . The PR that Ian linked is likely the culprit, coming in via 0f0cac5

@ScottTodd ScottTodd added the integrations/tosa Tensor Operator Set Architecture (TOSA) import, tests, etc. label Dec 6, 2024
@IanWood1
Copy link
Contributor

IanWood1 commented Dec 6, 2024

@lundong where is this IR coming from? The linked IR contains the ui8 tosa.rescale ops.

@lundong
Copy link
Contributor Author

lundong commented Dec 6, 2024

It was converted from a Mobilenet V1 quantized TFLite model by iree-import-tflite. The TFLite model can be found at https://tfhub.dev/tensorflow/lite-model/mobilenet_v1_0.25_224_quantized/1/default/1?lite-format=tflite

@ScottTodd ScottTodd changed the title failed to legalize operation 'arith.extsi' [tosa] failed to legalize operation 'arith.extsi' Dec 6, 2024
@ScottTodd
Copy link
Member

I don't think we've made any progress on fixing the regression, but I did just put together some tests that demonstrate the issue and will let us guard against similar regressions in the future: iree-org/iree-test-suites#59

ScottTodd added a commit to iree-org/iree-test-suites that referenced this issue Jan 15, 2025
Progress on #5.

This contains two simple test cases for demonstration purposes, one of
which is currently failing due to a regression:
iree-org/iree#19402.

The test suite follows the same structure as the onnx_models test suite
in this repository. Some cleanup and refactoring will be more evident as
this grows. We could for example share the `compile_mlir_with_iree`
helper function between both test suites.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐞 Something isn't working integrations/tosa Tensor Operator Set Architecture (TOSA) import, tests, etc. regression Marks regression of feature, compatibility or performance
Projects
None yet
Development

No branches or pull requests

3 participants