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

QNN EP: Context cache only works with single partition #18354

Closed
john-dance opened this issue Nov 8, 2023 · 6 comments
Closed

QNN EP: Context cache only works with single partition #18354

john-dance opened this issue Nov 8, 2023 · 6 comments
Assignees
Labels
ep:QNN issues related to QNN exeution provider platform:mobile issues related to ONNX Runtime mobile; typically submitted using template

Comments

@john-dance
Copy link

john-dance commented Nov 8, 2023

Describe the issue

The context cache

qnnOptions["qnn_context_cache_enable"] = "1";
qnnOptions["qnn_context_cache_path"] = contextCache;

only works if the graph can be executed in a single partition.

onnxruntime + QNN Execution Provider + libQnnHtp.so backend.

If more than one partition is needed, onnxruntime throws an exception in qnn_execution_provider. This restriction does not exist in other environments such as TfLite + QNN delegate.

  if (num_of_partitions > 1) {
    ORT_ENFORCE(!context_cache_enabled_, "Only support single partition for context cache feature.");
  }

To reproduce

Run the model attached to #18353 with the following options:

qnnOptions["backend_path"] = "<path>/libQnnHtp.so";
qnnOptions["profiling_level"] = "basic";
qnnOptions["htp_performance_mode"] = "burst";
qnnOptions["qnn_context_cache_enable"] = "1";
qnnOptions["qnn_context_cache_path"] = "<valid cache path>";
onnxSessionOptions.AppendExecutionProvider("QNN", qnnOptions);

Urgency

No response

Platform

Android

OS Version

34

ONNX Runtime Installation

Built from Source

ONNX Runtime Version or Commit ID

1.16

ONNX Runtime API

C++

Architecture

ARM64

Execution Provider

Other / Unknown

Execution Provider Library Version

QNN: 2.16

@github-actions github-actions bot added the platform:mobile issues related to ONNX Runtime mobile; typically submitted using template label Nov 8, 2023
@jywu-msft
Copy link
Member

yes, this is a current limitation that we will need to address.

@HectorSVC HectorSVC added the ep:QNN issues related to QNN exeution provider label Dec 21, 2023
@HectorSVC
Copy link
Contributor

Here's the PR:
#18865

@HectorSVC
Copy link
Contributor

Please give it a try with latest main branch.

@john-dance
Copy link
Author

Will do. Thank you.

@john-dance
Copy link
Author

@HectorSVC - The attached model now runs in a single partition. I'm getting a model that requires multiple partitions before actually closing this issue. Thank you for your work on this.

@HectorSVC
Copy link
Contributor

confirmed it worked

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ep:QNN issues related to QNN exeution provider platform:mobile issues related to ONNX Runtime mobile; typically submitted using template
Projects
None yet
Development

No branches or pull requests

3 participants