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

Failed to export ViT model to QNN with quant_dtype set to None #7429

Open
Metakar1 opened this issue Dec 23, 2024 · 2 comments
Open

Failed to export ViT model to QNN with quant_dtype set to None #7429

Metakar1 opened this issue Dec 23, 2024 · 2 comments
Labels
module: qnn Related to Qualcomm's QNN delegate partner: qualcomm For backend delegation, kernels, demo, etc. from the 3rd-party partner, Qualcomm

Comments

@Metakar1
Copy link

🐛 Describe the bug

I can run this command successfully.

python -m examples.qualcomm.scripts.torchvision_vit -b build-android -m SM8650 --compile_only

However, if I set quant_dtype to None, I got following errors:

[ERROR] [Qnn ExecuTorch]: graph_prepare.cc:213:ERROR:could not create op: q::ConvLayer.fp16.s1.tcm

[ERROR] [Qnn ExecuTorch]: graph_prepare.cc:1403:ERROR:Op 0x2c76300000035 preparation failed with err:-1

[ERROR] [Qnn ExecuTorch]:  <E> "aten_view_copy_default_2" generated: could not create op

[ERROR] [Qnn ExecuTorch]:  <E> RouterX86 graph prepare failed 12

[ERROR] [Qnn ExecuTorch]:  <E> Failed to finalize graph (id: 1) with err 1002

[ERROR] [Qnn ExecuTorch]: Failed to finalize Qnn Graph with error: 1002
Traceback (most recent call last):
  File "/home/user/Projects/android/executorch/examples/qualcomm/scripts/torchvision_vit.py", line 150, in <module>
    main(args)
  File "/home/user/Projects/android/executorch/examples/qualcomm/scripts/torchvision_vit.py", line 75, in main
    build_executorch_binary(
  File "/home/user/Projects/android/executorch/examples/qualcomm/utils.py", line 294, in build_executorch_binary
    exported_program = to_backend(edge_prog.exported_program, qnn_partitioner)
  File "/home/user/.conda/envs/robot/lib/python3.10/functools.py", line 889, in wrapper
    return dispatch(args[0].__class__)(*args, **kw)
  File "/home/user/Projects/android/executorch/exir/backend/backend_api.py", line 396, in _
    tagged_graph_module = _partition_and_lower(
  File "/home/user/Projects/android/executorch/exir/backend/backend_api.py", line 319, in _partition_and_lower
    partitioned_module = _partition_and_lower_one_graph_module(
  File "/home/user/Projects/android/executorch/exir/backend/backend_api.py", line 249, in _partition_and_lower_one_graph_module
    lowered_submodule = to_backend(
  File "/home/user/.conda/envs/robot/lib/python3.10/functools.py", line 889, in wrapper
    return dispatch(args[0].__class__)(*args, **kw)
  File "/home/user/Projects/android/executorch/exir/backend/backend_api.py", line 113, in _
    preprocess_result: PreprocessResult = cls.preprocess(
  File "/home/user/Projects/android/executorch/backends/qualcomm/qnn_preprocess.py", line 111, in preprocess
    assert len(qnn_context_binary) != 0, "Failed to generate Qnn context binary."
AssertionError: Failed to generate Qnn context binary.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/user/.conda/envs/robot/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/home/user/.conda/envs/robot/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/home/user/Projects/android/executorch/examples/qualcomm/scripts/torchvision_vit.py", line 156, in <module>
    raise Exception(e)
Exception: Failed to generate Qnn context binary.
[INFO] [Qnn ExecuTorch]: Destroy Qnn context
[INFO] [Qnn ExecuTorch]: Destroy Qnn device
[INFO] [Qnn ExecuTorch]: Destroy Qnn backend

Versions

Python: 3.10.16
ExecuTorch: 0.4
QNN SDK: 2.29.0.241129

@cccclai
Copy link
Contributor

cccclai commented Dec 23, 2024

@Metakar1 Are you trying to run the fp model, because you removed the quant_dtype?

@cccclai cccclai added partner: qualcomm For backend delegation, kernels, demo, etc. from the 3rd-party partner, Qualcomm module: qnn Related to Qualcomm's QNN delegate labels Dec 23, 2024
@Metakar1
Copy link
Author

@Metakar1 Are you trying to run the fp model, because you removed the quant_dtype?

Hi, thanks for your reply. I want to run some custom PyTorch models on Qualcomm SoC, so I'm doing some tests with executorch+qnn.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module: qnn Related to Qualcomm's QNN delegate partner: qualcomm For backend delegation, kernels, demo, etc. from the 3rd-party partner, Qualcomm
Projects
None yet
Development

No branches or pull requests

2 participants