You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add standalone Qwen graph packaging and operator rewrites - #2759
Add standalone package assembly and generic contrib-operator rewrites, with optimizer/builder tests and upstream-compatible numeric CUDA provider options.
Supersedes #2756. Reconstructed directly on current main (bf7aaea80e4f902ebdc38c49fa86e1617ea5f41f), without inherited feature-branch history. This PR independently targets main; there is no Git/build stack dependency between the two GenAI replacements. Executing generated model packages requires the graph runtime and compatible companion ORT operators microsoft/onnxruntime#33469 through microsoft/onnxruntime#33474.
Unrelated inherited builders/model features, replay/allocator changes and API-wrapper changes are deliberately excluded. No benchmark/profiling/evaluation drivers or local task metadata are included.
Package assembly review fixes
Reject existing active bundle destinations before copying anything, including later-destination collisions and dangling symlinks. Rebuild into a fresh output directory rather than mixing old graph/weight files with new configuration and libraries.
Preserve directory symlinks without traversing them, alongside existing file-symlink support.
Inventory shared weights from the original source graphs, using device/inode/range/type/shape identity. Destination pool paths still point at packaged files, preserving sharing through --copy and cross-filesystem hard-link fallback. Same-name unrelated source weights remain distinct.
Extract QSA normalization and rotary constants exclusively from the packaged target/head graphs, without an implicit research-machine reference override.
Remove the three CodeQL-reported sys.exit(main()) uses of always-None procedure returns. Check the v12b provider before assembly, retaining dependency-free CLI help.
Document safe rebuild behavior, source sharing, symlink reachability and CPU test commands.
Validation and remaining qualification
Used the qwen-flash Conda environment.
Nine CPU package-builder regressions pass, including forced EXDEV fallback and source-identity negative controls; all three builder CLI help checks pass.
Optimizer regressions pass: 29 tests and 85 subtests. Added capture/unnamed-node, contrib-import, rotary collision, unsafe PostMix, optional-output and transformed-sharing cases.
Optimizer fixes protect subgraph-captured values/initializers across rewrites, use node identity instead of optional names, preserve transformed shared weights through source-pool/transformation provenance, reject invalid/unsafe PostMix fusion, add missing contrib opset imports, and allocate collision-free rotary names.
Full-PR lintrunner -a and check-only lint pass in qwen-flash; whitespace checks pass.
Per request, no ORT/GenAI rebuild or native/GPU/model execution is performed for these review fixes.
Draft: full native compatibility, compatible package load and end-to-end Generator/model parity remain outstanding. Earlier combined-branch results do not qualify these independent branches. Synthetic graph and builder tests do not establish package/model accuracy or performance. PLE construction still requires the external research dependency and compatible checkpoints.
Adds standalone Qwen graph packaging and optimization tools to ONNX Runtime GenAI. Generated packages require the companion graph runtime and compatible ORT operators.
Changes:
Adds package builders with numeric CUDA provider options.
Adds graph rewrites and weight-pool metadata handling.
Adds synthetic optimizer tests and packaging documentation; full runtime qualification remains pending.
Support optimized FP8 head producers with missing shapes; reject captured head outputs explicitly before quantization.
Round-trip empty shared-weight pools.
Guard hyper-connection scale type/layout and input availability; apply the source epsilon default.
Preserve convolution carry-output consumer ordering, including nested captures.
Validation: all 46 CPU-only Python packaging/optimizer tests pass; full-PR lintrunner apply/check-only and git diff --check pass. Updated packaging documentation. No local builds, native compilation, GPU execution, or full-model qualification were performed.
No checks were failed on the previous head at inspection (37 successful, 17 pending/running). Fresh CI is triggered by this push and remains unverified, not claimed green.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Library filename collisions and relative-symlink handling can produce packages that cannot load required operators.
No open issues 🎉
3 previously missed issues
In code that hasn't changed since last review
Resolve library symlinks before creating hard links
tools/qwen38_graph/build_package.py:81
On Linux, a relative library symlink such as libcustom.so -> libcustom.so.1 can take this successful hard-link path and copy the symlink itself. Since its target is not packaged alongside it, the destination is dangling and the operator/provider library cannot load. Resolve the source before hard-linking, matching the behavior of --copy. Bundle symlinks remain preserved by the separate handling in link_tree.
Reject conflicting library basenames during bundle copying
tools/qwen38_graph/build_package.py:160
Distinct --lib-* inputs such as /qsa/libcustom_ops.so and /hc/libcustom_ops.so both become libs/libcustom_ops.so. The later copy replaces the first, while both registration entries reference the remaining library, losing required operators. Reject conflicting destination filenames before copying bundles, including the reserved libqwen38_plane.so filename. Allow repeated references to the same source file.
Reject conflicting library basenames in folded builds
tools/qwen38_graph/build_package_v12.py:239
The folded builder also maps distinct libraries with the same basename to one destination. For example, /qsa/libcustom_ops.so and /hc/libcustom_ops.so overwrite each other, leaving both registration entries pointing to the last library and losing required operators. This also affects the v12b wrapper. Reject conflicting filenames before copying bundles, including libqwen38_plane.so, while allowing repeated references to the same source file.
Clarified that environment flags require a compatible native build and do not add GenAI runtime features.
Documented preserving qualified packages and avoiding in-place writes through hard links.
Retained qualification limits: no full accuracy claim, no sustained 250 TPS at 8K, and no clean-full-suite claim. Focused publishing-version native tests pass (175 off + 175 on); a broader GDN empty-request failure is reproducible with the unmodified ORT PR-head kernel in the incremental retained-dependency build.
This update intentionally contains no GenAI runtime/engine changes, model binaries, weights, machine-specific benchmark drivers, or accumulated unrelated experiments. No new GenAI PR is needed for these native optimizations; the existing graph runtime PR #2758 remains unchanged.
Validation: documentation-only diff and whitespace check. Native incremental compilation/testing and benchmark provenance are detailed on the companion ORT PRs; clean-build CI and full accuracy qualification remain outstanding.
Paired experimental captures measured six fewer graph nodes and four fewer GPU kernels per verification cycle (1046 -> 1042), with 266 cycles per capture.
Twenty-four measured requests across 2K/8K/16K matched all 512 output tokens against the unfused baseline, with no generation failures.
Additional integration evidence from a fresh build of the complete experimental ORT/GenAI sources:
Prompt
Pooled decode TPS
Mean TTFT
2048
269.90
0.584 s
8192
250.17
2.448 s
16384
266.92
5.065 s
32768
264.12
10.578 s
One warmup plus three measured requests per context, CUDA Graph enabled, 512 outputs/request, greedy decoding on H200. All 16 requests matched the previous-runtime token IDs; zero standard fallbacks, MTP failures, or DFlash2 failures. Loaded-library inspection verified the freshly built runtime/provider/bindings.
Scope/limitations: those timings use the complete experimental source stack, not this tooling PR in isolation or a fresh paired Tianlei comparison. They do not establish repeatability across fresh processes. Full accuracy qualification remains deferred. The complete native stack has 333 passing ORT tests, 69 passing selected GenAI tests (including real-GPU mapped weights), and two previously known malformed-state QSA/CSA failures; the latter also fail with specialized top-k disabled. One GenAI test remains disabled. This is not a blanket full-suite or deployment qualification.
Pushed b709837: guarded shared-expert projection and RMS-normalization/rotary rewrites, focused shape/consumer/hardlink/atomic-replacement tests, and packaging documentation. Adapted to the reviewer-fixed optimizer/type inference rather than replacing files wholesale. All 36 staged optimizer tests pass. Requires matching companion ORT kernels (#33469, #33470, #33473); no new third-party operators are emitted. Full accuracy is not yet qualified: beginning uncapped greedy LiveCodeBench, first 10 smoke problems then the full pinned release_v6 suite.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add standalone package assembly and generic contrib-operator rewrites, with optimizer/builder tests and upstream-compatible numeric CUDA provider options.
Supersedes #2756. Reconstructed directly on current
main(bf7aaea80e4f902ebdc38c49fa86e1617ea5f41f), without inherited feature-branch history. This PR independently targetsmain; there is no Git/build stack dependency between the two GenAI replacements. Executing generated model packages requires the graph runtime and compatible companion ORT operators microsoft/onnxruntime#33469 through microsoft/onnxruntime#33474.Unrelated inherited builders/model features, replay/allocator changes and API-wrapper changes are deliberately excluded. No benchmark/profiling/evaluation drivers or local task metadata are included.
Package assembly review fixes
--copyand cross-filesystem hard-link fallback. Same-name unrelated source weights remain distinct.sys.exit(main())uses of always-None procedure returns. Check the v12b provider before assembly, retaining dependency-free CLI help.Validation and remaining qualification
qwen-flashConda environment.lintrunner -aand check-only lint pass inqwen-flash; whitespace checks pass.