Skip to content

[QNN] Improve GPU StaticLLM pass - #2633

Open
qti-mattsinc wants to merge 2 commits into
microsoft:mainfrom
CodeLinaro:dev/mattsinc/gpu-staticllm-improvements
Open

[QNN] Improve GPU StaticLLM pass#2633
qti-mattsinc wants to merge 2 commits into
microsoft:mainfrom
CodeLinaro:dev/mattsinc/gpu-staticllm-improvements

Conversation

@qti-mattsinc

@qti-mattsinc qti-mattsinc commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Describe your changes

  • Update search.max_length in genai_config.json to inform onnxruntime-genai when to stop decode, which is required for the QNN GPU exports with fixed max seq len.
  • Remove the "update_genai_config" option.
  • Handle new ModelBuilder behavior with symbolic "kv_cache_dim".
  • Add "inherit_session_options" to pipeline models in the genai config.

Checklist before requesting a review

  • Add unit tests for this change.
  • Make sure all tests can pass.
  • Update documents if necessary.
  • Lint and apply fixes to your code by running lintrunner -a
  • Is this a user-facing change? If yes, give a description of this change to be included in the release notes.

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

Comment thread olive/passes/onnx/common.py Fixed
Comment thread olive/passes/onnx/common.py Fixed
Comment thread olive/passes/onnx/common.py Fixed
Comment thread test/passes/onnx/test_static_llm.py Fixed
* Update search.max_length in genai_config.json to inform
  onnxruntime-genai when to stop decode, which is required for the
  QNN GPU exports with fixed max seq len.
* Remove the "update_genai_config" option.
* Handle new ModelBuilder behavior with symbolic "kv_cache_dim".
* Add "inherit_session_options" to pipeline models in the genai config.
@qti-mattsinc
qti-mattsinc force-pushed the dev/mattsinc/gpu-staticllm-improvements branch from a654895 to 3cc8454 Compare August 27, 2026 17:56
@qti-mattsinc
qti-mattsinc marked this pull request as ready for review August 27, 2026 21:30
Copilot AI lite review requested due to automatic review settings August 27, 2026 21:30
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the QNN GPU StaticLLM export flow so generated genai_config.json better reflects fixed-shape decoding requirements (fixed max sequence length), aligns with newer ModelBuilder symbolic dim behavior (kv_cache_dim), and standardizes session options inheritance across pipeline entries.

Changes:

  • Update QNN GPU genai pipeline generation to set inherit_session_options and to derive model.context_length / search.max_length from the fixed KV-cache input shape.
  • Remove the update_genai_config option and always perform genai_config updates in the relevant QNN GPU paths.
  • Add QNN GPU-focused unit tests that validate prefill/decode pipeline structure and enforce static I/O shapes.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
test/passes/onnx/test_static_llm.py Adds QNN GPU coverage validating genai pipeline structure and ensuring exported model I/O shapes are fully static.
olive/passes/onnx/static_llm.py Handles new ModelBuilder symbolic kv_cache_dim by mapping it using head_size from genai_config.json; removes update_genai_config gating.
olive/passes/onnx/context_binary.py Removes update_genai_config option and updates QNN GPU context-binary path to update genai pipeline entries unconditionally.
olive/passes/onnx/common.py Adds inherit_session_options to pipeline entries and updates genai max sequence length fields based on the fixed KV-cache input shape.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread olive/passes/onnx/common.py
Comment thread olive/passes/onnx/context_binary.py
Comment thread olive/passes/onnx/static_llm.py

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.

Suppressed comments (1)

olive/passes/onnx/context_binary.py:312

  • update_llm_pipeline_genai_config_gpu_ctxbin is now called unconditionally for QNN GPU, but _generate_context_binary accepts model=None and ModelHandlers can have model_attributes=None (or missing additional_files). In those cases this call will raise before any genai_config update can be attempted. Guard the call so non-GenAI/non-LLM QNN GPU flows still work.
                update_llm_pipeline_genai_config_gpu_ctxbin(model, ctxbin_path)

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants