Skip to content

[BUG] Quantized convolution leagalization doesn't handle int16 dtypes for arm_cpu target #16535

Description

@lhutton1

Expected behaviour:

When an arm_cpu target is used, the model should compile successfully without an error.

Actual error:

When compiled on an arm_cpu target, the models mentioned below result in the following error:

File "/workspaces/tvm/src/tvm/python/tvm/relay/qnn/op/legalizations.py", line 505, in _qnn_conv2d_legalize_arm_cpu
    return helper_change_dtypes_to_be_same(attrs, inputs, types, relay.qnn.op.conv2d)
File "/workspaces/tvm/src/tvm/python/tvm/relay/qnn/op/legalizations.py", line 460, in helper_change_dtypes_to_be_same
    assert (
AssertionError: Qnn Conv2D/Dense only accepts uint8 or int8 inputs

And the following warning is also generated during compilation:

data types int64 and int32 do not match in BroadcastRel

Environment:

Tested with TVM at 6a3fadc. The issue was found as a result of the changes in #16513, however it can be reproduced without as described below.

How to reproduce:

Run either of the following tests:

  • pytest tests/python/frontend/tflite/test_forward.py -k test_forward_mobilenet_int16
  • pytest tests/python/frontend/tflite/test_forward.py -k test_forward_ds_cnn_int16
    with an arm_cpu target. Note: Reminder to remove any skip condition that exists in the test currently.

Likely legalization of the quantized operator needs to be prevented when the data type is not unit8/int8 in

def _qnn_conv2d_legalize_arm_cpu(attrs, inputs, types):

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-triagePRs or issues that need to be investigated by maintainers to find the right assignees to address itrelay:qnnsrc/relay/qnnstatus:stalePR is stale and not being acted on for a whiletopipython/tvm/topitype: bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions