Skip to content

Add GenAI runtime profile model variants - #2687

Open
Tianlei Wu (tianleiwu) wants to merge 5 commits into
mainfrom
tlwu/20260925/genai-runtime-profile-model-variants
Open

Tianlei Wu (tianleiwu) wants to merge 5 commits into
mainfrom
tlwu/20260925/genai-runtime-profile-model-variants

Conversation

@tianleiwu

Copy link
Copy Markdown

Describe your changes

Add an Olive post-processing pass for ONNX Runtime GenAI memory profiles. A profile can update only genai_config.json, or derive an alternate KV-cache decoder graph while hardlinking the rest of the generated package and preserving the base external-data file.

This replaces #2663 and builds on the composite ModelBuilder support now present on main. It depends on microsoft/onnxruntime-genai#2622 for runtime profile fields and the KV-cache graph transformer.

Key changes

  • Add and register GenAIModelRuntimeProfiles for configuration-only and alternate-decoder profiles.
  • Extend ModelBuilder structured configuration forwarding and CPU-embedding split handling needed by the combined Qwen package.
  • Generate deterministic model_<profile-id>.onnx filenames and strip build-only kv_cache settings from emitted runtime configuration.
  • Validate profile IDs, eligibility, filenames, and required graph-generation settings.
  • Add focused ModelBuilder and runtime-profile pass tests.

Validation

  • Direct focused runtime-profile pass test passed for both graph-generating and config-only modes.
  • Real Qwen3.8-27B package validation created model_32gib.onnx, retained the same hardlinked model.onnx.data, and emitted the requested runtime overlay.
  • python -m ruff check ... and python -m ruff format --check ... passed on changed Python files.
  • scripts/format_json.py --linter-mode ... olive/olive_config.json passed.
  • Full pytest collection was not available locally because the environment lacks the optional peft test dependency; the focused test body was invoked directly.

Checklist before requesting a review

  • Add unit tests for this change.
  • Make sure focused tests pass.
  • Update documents if necessary. (Runtime/profile documentation is in Support memory-based runtime model profiles onnxruntime-genai#2622.)
  • Lint and apply fixes to the changed files.
  • Is this a user-facing change? The new GenAIModelRuntimeProfiles pass enables memory-tiered GenAI packages.

(Optional) Issue link

Comment thread test/passes/onnx/test_model_builder.py Fixed

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.

Copilot review overview

🟡 Changes recommended

Unresolved correctness, validation, path-safety, and hardlink-isolation issues remain.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 High severity · 4 Medium severity

Open (5)
What changed in this PR

Adds GenAI runtime profiles for configuration overlays and alternate KV-cache decoder graphs, with supporting ModelBuilder updates.

Changes:

  • Adds and registers GenAIModelRuntimeProfiles.
  • Extends structured builder options and CPU embedding splitting.
  • Adds focused tests and configuration registration.
File Summary
test/​passes/​onnx/​test_model_builder.py Tests structured configuration and embedding splitting.
test/​passes/​onnx/​test_genai_runtime_profiles.py Tests runtime profile and decoder variant generation.
olive/​passes/​onnx/​model_builder.py Adds structured options and CPU embedding support.
olive/​passes/​onnx/​genai_runtime_profiles.py Implements profile validation, overlays, package copying, and decoder variants.
olive/​olive_config.json Registers the new pass.

💡 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/genai_runtime_profiles.py
Comment thread olive/passes/onnx/genai_runtime_profiles.py
Comment thread olive/passes/onnx/genai_runtime_profiles.py
Comment thread olive/passes/onnx/genai_runtime_profiles.py Outdated
Comment thread olive/passes/onnx/genai_runtime_profiles.py
Comment thread olive/passes/onnx/genai_runtime_profiles.py Fixed

This branch has not been deployed

No deployments
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