Repository navigation
[CUDA] Add SpeculativePrefixCommit contrib operator - #33474
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved memory-safety, state-propagation, uninitialized-output, and documentation-validation issues block approval.
6 open issues
Regenerate operator documentation from the updated build · New Initialize the complete public scratch output buffer · New Handle non-finite router logits without generating invalid expert indices · New Return updated fold state through explicit outputs · New Bound rotary-cache accesses to the actual cache extent · New Validate ring metadata before state commit or record access · New
What changed in this PR
Adds CUDA contrib operators for multi-token prediction and speculative decoding directly on main, replacing the earlier stacked PR.
Changes:
- Implements NVFP4
MtpMoeprojections andFoldMid2/FoldTailstate updates. - Adds schemas, CUDA registrations, and operator documentation.
- Adds internal kernel tests; fresh GPU execution remains outstanding.
| File | Description |
|---|---|
| onnxruntime/test/contrib_ops/cuda_kernels/speculative_fold_test.cc | Tests acceptance, state updates, and muted calls. |
| onnxruntime/test/contrib_ops/cuda_kernels/mtp_moe_test.cc | Tests routing and reference projection arithmetic. |
| onnxruntime/core/graph/contrib_ops/ms_opset.h | Registers the three schemas. |
| onnxruntime/core/graph/contrib_ops/contrib_defs.cc | Defines operator contracts and types. |
| onnxruntime/contrib_ops/cuda/llm/speculative_fold.h | Declares fold launchers. |
| onnxruntime/contrib_ops/cuda/llm/speculative_fold.cu | Implements speculative state kernels. |
| onnxruntime/contrib_ops/cuda/llm/speculative_fold.cc | Adds fold validation and CUDA wrappers. |
| onnxruntime/contrib_ops/cuda/llm/mtp_moe.h | Defines dimensions and launcher interfaces. |
| onnxruntime/contrib_ops/cuda/llm/mtp_moe.cu | Implements routing and expert projections. |
| onnxruntime/contrib_ops/cuda/llm/mtp_moe.cc | Adds validation and output allocation. |
| onnxruntime/contrib_ops/cuda/cuda_contrib_kernels.cc | Registers CUDA implementations. |
| docs/ContribOperators.md | Documents the new operators. |
| cmake/onnxruntime_unittests.cmake | Includes internal tests and kernel sources. |
Review effort: Balanced
Keep router expert indices valid for non-finite logits, initialize the public scratch buffer, return fold state through declared reusable outputs, and guard rotary and ring metadata before committing. Add session-level and kernel regressions and regenerate operator documentation.
There was a problem hiding this comment.
🟡 Changes recommended
Accepted row counts exceed CUDA launch limits, and documentation ordering conflicts with generator validation.
2 open issues
6 resolved since last review
Validate ring metadata before state commit or record access Bound rotary-cache accesses to the actual cache extent Return updated fold state through explicit outputs Handle non-finite router logits without generating invalid expert indices Initialize the complete public scratch output buffer Regenerate operator documentation from the updated build
Review effort: Balanced
|
Pushed 24625bf to address both outstanding review threads and the common root cause of all six failed CUDA/TensorRT/plugin pipelines.
Validation: full-PR lintrunner apply/check-only passes, git diff --check passes, affected schema/kernel documentation matches the official Python renderer with source-derived metadata, entire TOC support-level/name ordering passes, and static validation placement checks pass. No local builds or compilation were run. The new native tests were not executed locally. Fresh CI is triggered by this push and is not claimed green. |
Preserve FoldMid2/FoldTail v1, add explicit aliased state outputs and deferred ring publication, and cover S1-S4 acceptance and captured replay. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ty, optional in-place ctl/ctx) and remove unused MtpMoe Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
# Conflicts: # docs/ContribOperators.md
efa5ab5 to
a602c0c
Compare
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…hema docs Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ification)
- Widen FoldMid2 head_rows attribute and shape inference from 2..4 to 2..8, and FoldTail ctl_slot to {-1, 2, 8..13}.
- Pack tokens[4..7] into the upper 32-bit halves of ring record words 1, 2, 3, and 5 while preserving the 8-word (64-byte) ring record layout and S<=4 compatibility.
- Extend FoldContribTest to verify 8-row prefix acceptance, upper-32-bit token packing, and ctl_slot=13.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…2 QMoE, and PR cleanups - Extend FoldMid2/FoldTail to head_rows<=8 and pack tokens[4..7] into ring record words 1, 2, 3, and 5. - Add state_update_capacity (0..8) support to CausalConvWithState and enable state_update_capacity > 0 in QwenS2 GatedDeltaNetDecodeWarpKernel. - Raise kMaxProfiledExpandedRows to 80 in moe_gemv.h and kFusedRouteMaxRows to 8 in qmoe_fused_route.cuh; add fast INT3 and offline SM80 INT2/INT4 prepack QMoE support. - Eliminate pq[8][ROWS] local register array in HcUpPreKernel and sync PR cleanups (#33469, #33470, #33471, #33472, #33474, #33548, #33569). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
### Summary Extends com.microsoft::SpeculativePrefixCommit (introduced in #33474) to support batch_size >= 1 for batched speculative decoding: - Schema and shape inference (bert_defs.cc): Propagates the batch dimension from next_tokens ([batch, rows] or [rows]) to outputs 0..6 (head_ids, head_c, slot_ids, seqlens, cos_out, sin_out, sel). - CUDA kernel (speculative_fold.h/.cc/.cu): Launches MidKernel<<<batch_size, 256, 0, stream>>> with per-slot strides for ctl, ctx_commit, prefixes, prefix2, per-slot result ring buffers, and per-slot muted flags. - Unit test (speculative_fold_op_test.cc): Adds SupportsBatchedSpeculativePrefixCommitS8 covering batch = 3, head_rows = 8 with mixed acceptance lengths and a muted slot. --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…pdated-state outputs
Remove inputs, outputs, attributes and modes that the Qwen3.8-Flash-Next rc3
graph and the GenAI runtime do not consume:
- rotary gather path (cos_cache/sin_cache inputs, cos_out/sin_out outputs),
head-preparation outputs (head_ids, slot_ids, seqlens, sel)
- redundant prefix2 input (duplicates prefixes[2..3]) and the size-2*batch
ptrs layout (GenAI always passes {ring address, ring size})
- head_capacity attribute and the cache-capacity/rotary error bits
- legacy head_rows 2 layout (8-word ctl, 2-word prefixes), the rows < head_rows
clamp and the always-true publish_ring parameter
updated_ctl and updated_ctx_commit are now required outputs that the kernel
always writes (unchanged words are copied when the output does not alias the
input), so state is never mutated through const_cast and a CPU-backed feed can
no longer lose the update while a ring record is published. The kernel now runs
one thread per batch item.
Schema inference leaves the batch dimension unknown unless next_tokens has a
known shape, and both inference and the kernel reject next_tokens ranks other
than 1 and 2. head_rows defaults to 8 and must be in [3, 8].
Tests cover aliased and separate state outputs, batched per-item ring/state,
muted prefill, invalid metadata, state carried across session runs, rank-3
rejection and shape inference.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Update docs/ContribOperators.md and docs/OperatorKernels.md to match the pruned schema (7 inputs, 3 required outputs, head_rows in [3, 8]) and rewrite docs/contrib_ops/cuda/speculative_fold.md to describe the final operator (interface, state/aliasing contract, result ring layout, muted/error handling, graph wiring and tests) instead of the removed hidden-row, rotary and S1-S4 paths. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
From Copilot: Two-pass source review of commit 22d6117. This PR merged after the review was completed, so I am posting this finding here for a follow-up fix. [P1] Prevent a reused ring slot from looking committed while its payload is overwritten Location: onnxruntime/contrib_ops/cuda/llm/speculative_fold.cu, line 98. With the schema-valid ptrs[1] = 1, the next commit overwrites words 1-7 while word 0 still contains the previous sequence number. A concurrent host poller can therefore read sequence 1 and payload from commit 2; reading word 0 again does not help if the writer has not published sequence 2 yet. The system fence before the final sequence store orders initial publication, but does not protect an already-published slot from reuse. An H200 probe using this store/fence order observed sequence=1, token=2, length=2, sequence_again=1. Please add a slot-ownership/consumer-acknowledgment protocol, or a writing-generation protocol with the corresponding acquire/revalidation rules for the host reader, before overwriting a published record. If preventing reuse until consumption is a caller obligation, make that an explicit required contract instead of promising that reading word 0 first always yields a complete record. Add a mapped-host-memory regression that polls concurrently across ring wraparound; the current tests inspect records after synchronization. Validation: the standalone CUDA probe reproduced the publication mechanism on H200; it was not a build or session-level run of the unmodified ORT operator. No full PR-specific ORT test suites were run. This finding is separate from the already-addressed ring-metadata and returned-state comments. |
…play conv states of both layouts, and fix the prefix-commit slot stride (#2824) > **Stacked on #2823** (base `tlwu/20261030/qwen38-windows-ple-context-tiers`; the diff shows only this change). Position 8 of the series described in #2726. Retarget to `main` once #2823 merges. > > #2825 (plane bundling) and #2784 (QMoE offload) are stacked on this PR and are independent of each other. > > This PR was re-cut. It used to carry the adaptive offload budget, the benchmark-tool tweaks, the contract README and the MSVC warning fixes as well. The budget moved to #2784, the tools and the README to #2729, and the warning fixes into the commits that introduced those lines. What remains is the contract change, the layout-aware conv-state replay and the prefix-commit slot stride. > > Replaces #2808. GitHub marked #2808 as merged (into a PR branch, never into `main`) while this series was being re-stacked, and a merged PR cannot be reopened, so the same change continues here on a new branch. #2808 had no review comments; one CI-triage note about its old head stays on that PR. ## Summary microsoft/onnxruntime#33474 (merged 2026-10-27) changed the `com.microsoft::SpeculativePrefixCommit` node that the `qwen38_flash_graph` fold model uses to commit a verified DFlash2 cycle. The Qwen3.8-Flash-Next rc4 and rc5 packages are exported for the new node. This PR adapts the engine to it, and fixes two defects of the plane that the review found next to it: - the compact replay of a conv state only handled the channel-first order (`[batch, channels, history]`); it now replays both orders, selected by a field of the replay descriptor and gated by a new plane capability; - with more than one request slot and fewer than 8 verify rows, the plane wrote the n-gram contexts of slot `s` at `2 * rows` words per slot while `SpeculativePrefixCommit` reads them at the stride of the whole buffer (16 words), so for every slot but the first the node read its prefix contexts from the wrong place. Every writer now uses the 16-word stride. **Breaking for rc3 packages.** The node now takes 7 inputs (`fold.ctx_b` and the rotary caches are gone) and has two required outputs. A package that was exported with the old 10-input / 7-output node does not load with this runtime. The rc4 and rc5 packages are the supported ones. ## Summary of Changes | File | Change | |------|--------| | `src/models/qwen38_decode_device.h` | Names the fold node's state I/O (`kQwen38FoldCtl`, `kQwen38FoldCtxCommit`, `kQwen38FoldCtlOut` = `fold.ctl_out`, `kQwen38FoldCtxCommitOut` = `fold.ctx_commit_out`) and adds `Qwen38FoldStateInput()`, which maps a state output to the input it must be bound over. | | `src/models/qwen38_graph.h` | `kFoldCtlWords` (16), `kFoldCtxCommitWords` (2) and `kFoldCtxAWords` (16 = `2 * kMaxVerifyRows`): the per-slot int64 words of the control state, the commit state and the n-gram contexts, so the views and `ctx_a_slot()` no longer depend on the number of verify rows. `kFoldCtxAWords` is `static_assert`ed equal to the plane's `QWEN38_PLANE_CTX_WORDS_PER_SLOT`. | | `src/models/qwen38_graph.cpp` | The fold inputs are the 7 of the new contract: `fold.ctx_b` is no longer created or bound. `fold.ctl_out` and `fold.ctx_commit_out` are bound in place over the persistent `ctl_` / `ctx_commit_` buffers for the single-slot target and the batched target bindings, otherwise the state update is lost. `verify_rows_` must be in [3, 8] (the `head_rows` range of the op), otherwise the model throws. The batched `fold.ctx_a` view has `B * kFoldCtxAWords` words, so the per-slot stride the op derives from its size equals the engine's `ctx_a_slot()` and the stride the plane writes. The compact replay of `conv_value` / `ple_conv_value` builds its descriptor with `MakeQwen38ConvReplayDescriptor`. | | `src/models/qwen38_graph_prefill.cpp` | The same bindings for the unified prefill (`FastAppendSlot`, where the muted slot is rewritten unchanged) and for `FastAppend`. | | `src/models/qwen38_replay_geometry.{h,cpp}` | The conv geometry takes the channel count from the last dimension of the `state_update` value. A state with it in dimension 1 is channel-first, one with it in dimension 2 is history-first (`Qwen38ReplayGeometry::layout`), and a state with it in neither is rejected at model load. A square state cannot be told apart and stays channel-first, which is what the exporter writes. | | `src/models/qwen38_graph_plane.{h,cpp}` | `MakeQwen38ConvReplayDescriptor` builds the descriptor of a conv replay (validator, layout) and requires the plane capability `conv_history_first_replay` only when the state is history-first. A channel-first package therefore keeps loading with a plane that lacks the capability; for a history-first one the load fails with an error that names the capability, the state and the library. | | `src/qwen38_plane/qwen38_plane_abi.h` | `Qwen38PlaneConvStateLayout` and `Qwen38StateReplayDesc::layout` (zero is channel-first, which every earlier plane assumes). The field takes the 4 bytes of tail padding after `kind`, so `sizeof` stays 152; `static_assert`s on both sides keep it. New capabilities `QWEN38_PLANE_CAP_CONV_HISTORY_FIRST_REPLAY` (0x10, `conv_history_first_replay`) and `QWEN38_PLANE_CAP_CTX_SLOT_STRIDE` (0x20, `ctx_slot_stride`), reported by `qwen38_plane_capabilities`. `QWEN38_PLANE_CTX_WORDS_PER_SLOT` (16) and the documented layout of `prep_batched`'s `ctx_out`. The plane ABI version stays 3 and there is no new export. | | `src/qwen38_plane/qwen38_plane.cu` | The conv path of `k_replay_generic` honors the layout, in the index of the state element and in the source of the shifted position (the state or, past its end, the update). `k_prep_fold` and the staged loop of `qwen38_plane_prep_batched` write slot `s` at `s * QWEN38_PLANE_CTX_WORDS_PER_SLOT` instead of `s * 2 * rows`. | | `docs/paged_attention_engine.md` | The conv layout and its capability, and the stride of the contexts. | | `test/cpp/engine/qwen38_graph_model_tests.cpp` | `Qwen38FoldIoTest.StateOutputsBindOverTheMatchingInputs`: the state outputs map to their inputs and nothing else does. | | `test/cpp/engine/qwen38_replay_geometry_tests.cpp`, `qwen38_plane_tests.cpp` | See Testing. | The rc4/rc5 conv state is laid out `[batch, channels, width]` (10240 x 4 and 10240 x 9), for which the replay is unchanged. A package whose conv state is `[batch, width, channels]` is replayed correctly through the new descriptor field and needs a plane that reports `conv_history_first_replay` (the plane of this source tree does). The graph I/O and the bindings are documented in the "`SpeculativePrefixCommit` contract" section of `tools/qwen38_graph/README.md` in #2729. ## Behavior changes - rc3 packages no longer load (see above). - A history-first conv state is accepted at model load (the validator used to reject it) and replayed correctly. With a plane that lacks capability 0x10 the load fails and names the capability. Channel-first packages are unaffected by either. - `prep_batched` writes the contexts of slot `s` at word `s * 16` of `ctx_out` for every row count, as `ctx_a_slot()`, the batched `fold.ctx_a` view and `SpeculativePrefixCommit` read them; with 8 rows it already did. This changes the layout of `ctx_out` for fewer rows and is gated by the `ctx_slot_stride` capability (`QWEN38_PLANE_CAP_CTX_SLOT_STRIDE`, 0x20), required alongside `batched_prep` when `max_batch_size > 1` (single-slot packages are unaffected). ## Testing - CUDA build (`-DUSE_CUDA=ON -DENABLE_QWEN38_PLANE=ON`, CUDA 13.0, H200/`sm_90`) on top of the previous head of #2823: - `engine_unit_tests`: 1477 tests, **1437 passed**, 22 skipped (WebGPU, real model), 18 failed. The 18 are the failures of the unmodified base in this environment (`CudaSearchCheckpointTest.*`, `CudaFixedStatePoolTest.*`, `ModelPackage.*`, `TurnPolicyTest.CudaGreedy...`: the SDK's CUDA provider lacks the legacy `GetProvider` symbol), by name. - `engine_unit_tests --gtest_filter='*Qwen38*'`: 332 tests, passed in 5 of 5 runs (three in order, two shuffled). - `unit_tests`: 338 tests, 271 passed, 53 skipped, 14 failed, the same 14 as on the base. - `compute-sanitizer --tool memcheck` over the replay and prep tests: no device-side error. - Re-run after rebasing onto the updated #2823 (head `410dd2070`; the rebase leaves this PR's diff byte-identical), same environment: - `engine_unit_tests`: 1629 tests, **1583 passed**, 25 skipped, 21 failed. All 21 fail for the same reason as before (the SDK's CUDA provider lacks the legacy `GetProvider` symbol): the 18 above plus `SessionOptionPathsTest.RuntimeProfile*` (3, tests that come from `main`). - `engine_unit_tests --gtest_filter='*Qwen38*'`: 404 tests, passed in 3 of 3 runs (two in order, one shuffled); `Qwen38Plane*`: 92 of 92; `reinit_tests`: 6 of 6. - `compute-sanitizer --tool memcheck` over the 61 replay, prep and staged-PLE tests: no device-side error and no leak. It reports 22 host-side CUDA API errors, all from four existing error-path tests that provoke them on purpose (a failed copy, a rejected launch, an unregistered host pointer). - New and changed tests: - `Qwen38ConvReplayDescriptorTest.*` (host only): the descriptor keeps 152 bytes with `layout` in the former padding; the capability bit and name; a channel-first state needs no capability (simulated plane without it) and a history-first state fails naming `conv_history_first_replay`; a square state is channel-first; a state of another channel count is refused before the capability check. - `Qwen38ReplayGeometryTest.ConvolutionAcceptsAHistoryFirstState` (was `...RejectsAHistoryFirstState`), `OnlyAConvolutionHasALayout`, `ConvolutionRejectsAStateThatIsNotBatchedChannelsAndHistory`; a state of another channel count is still rejected. - GPU: `SupportedLayouts/Qwen38PlaneConvReplayTest.*`, instantiated for both layouts, replays every acceptance length of a nonuniform state against a host reference and a state worked out by hand; `Qwen38PlaneReplayTest.OneLaunchReplaysConvolutionStatesOfBothLayoutsAmongTheOtherKinds` mixes the layouts and the other kinds in one launch. - GPU: `Qwen38PlanePrefixCommitStrideTest.*`: 2, 3, 5 and 8 slots with 1 to 8 rows (so 3 to 7 are the widths below 8 that the fold model supports), fp8 and int8 tables, the resident and the staged writers; distinct prefixes per slot and row are asserted at word `s * 16 + 2 * r` (the stride `SpeculativePrefixCommit` derives from the buffer size), the unwritten tail of every slot stays untouched, and a muted slot keeps its place while its neighbours keep theirs. The existing batched-prep tests read the buffer at the same stride. - Both fixes were checked against deliberately broken variants: with the kernel ignoring the layout exactly the history-first GPU tests fail; with the old dense stride in both writers 12 of the 15 prep tests fail (in the resident writer only, the device-table and muted-slot tests; in the staged writer only, the staged-table tests). - C++17 (`USE_CXX17`) `-fsyntax-only -Wall -Wextra` over the changed translation units: no warning in the code this PR adds. - Not run: the Windows / MSVC build (CI only), and end-to-end decoding of an rc4/rc5 package on this revision (the numbers measured on earlier revisions of this series are not repeated). The `SpeculativePrefixCommit` node itself was not executed; the stride the host and the plane agree on is the one its source derives from the size of `prefixes`. ## Checklist - [x] Tests added/updated - [ ] No breaking changes: **rc3 packages (10-input / 7-output `SpeculativePrefixCommit`) no longer load**; the rc4 and rc5 packages are the ones the node was changed for - [x] Documentation updated (the contract section of the engine README is in #2729; the plane ABI and `docs/paged_attention_engine.md` are in this PR) --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Updated [Microsoft.AspNetCore.Mvc.Testing](https://github.com/dotnet/dotnet) from 10.0.14 to 10.0.15. <details> <summary>Release notes</summary> _Sourced from [Microsoft.AspNetCore.Mvc.Testing's releases](https://github.com/dotnet/dotnet/releases)._ No release notes found for this version range. Commits viewable in [compare view](https://github.com/dotnet/dotnet/commits). </details> Updated [Microsoft.Data.Sqlite](https://github.com/dotnet/dotnet) from 10.0.14 to 10.0.15. <details> <summary>Release notes</summary> _Sourced from [Microsoft.Data.Sqlite's releases](https://github.com/dotnet/dotnet/releases)._ No release notes found for this version range. Commits viewable in [compare view](https://github.com/dotnet/dotnet/commits). </details> Updated [Microsoft.ML.OnnxRuntime](https://github.com/Microsoft/onnxruntime) from 1.31.1 to 1.32.0. <details> <summary>Release notes</summary> _Sourced from [Microsoft.ML.OnnxRuntime's releases](https://github.com/Microsoft/onnxruntime/releases)._ ## 1.32.0 ONNX Runtime 1.32.0 reintegrates ONNX 1.23.2 with opset 28 support, introduces CPU/GPU hybrid MoE offloading and shared-layout CPU QMoE kernels, expands device-memory, weightless-compilation, and Python model-package APIs, dramatically accelerates session initialization on large graphs, and strengthens runtime and optimizer reliability. These notes cover changes since ONNX Runtime 1.31.1. CUDA and WebGPU kernel updates are summarized here; detailed provider notes are covered by their separate plugin EP releases. ## Highlights - Reintegrated **ONNX 1.23.2** with **opset 28** operator support (`SpaceToDepth`, `Mod`, signed `BitShift`, and `BFloat16` extensions) and updated **DLPack to v1.3** across all implemented ORT numeric and boolean tensor types ([#33134](microsoft/onnxruntime#33134), [#32362](microsoft/onnxruntime#32362), [#33848](microsoft/onnxruntime#33848)). - Added a session-scoped **CPU/GPU hybrid MoE offload** planner and execution backend for quantized `QMoE` (NVFP4, INT4, INT3, and INT2) and block-packed `MoEPacked` models, backed by shared-layout AVX-512/AVX2 CPU `QMoE` kernels and memory-mapped expert storage ([#33450](microsoft/onnxruntime#33450), [#33451](microsoft/onnxruntime#33451), [#33452](microsoft/onnxruntime#33452), [#33973](microsoft/onnxruntime#33973)). - Expanded core APIs with `OrtApi::EpDevice_GetMemoryCapacity`, explicit multi-mode weightless compilation (`ModelCompilationOptions_SetWeightlessMode` and `ep.enable_weightless_mode`), Python bindings for the Model Package APIs, and zero-copy CPU buffer borrowing in `AddExternalInitializers` ([#33447](microsoft/onnxruntime#33447), [#32899](microsoft/onnxruntime#32899), [#33640](microsoft/onnxruntime#33640), [#33877](microsoft/onnxruntime#33877)). - Eliminated superlinear bottlenecks in allocation planning, constant sharing, graph I/O mapping, and topological sorting—reducing session initialization on 100k-node constant-heavy graphs from minutes to seconds—and added pipelined pinned-memory staging for external GPU weight loading ([#33407](microsoft/onnxruntime#33407), [#33939](microsoft/onnxruntime#33939), [#34009](microsoft/onnxruntime#34009), [#33839](microsoft/onnxruntime#33839)). - Expanded shared generative AI and quantized contrib operators, including Kimi Delta Attention (`GatedDeltaNet` per-key-dimension decay), right-padded chunked prefill in `GroupQueryAttention`, native GGUF/block-packed operators (`GatherPacked`, `MatMulPacked`, `MoEPacked`), and sparse-attention index sharing ([#33817](microsoft/onnxruntime#33817), [#33503](microsoft/onnxruntime#33503), [#33953](microsoft/onnxruntime#33953), [#33224](microsoft/onnxruntime#33224)). ## Announcements & Compatibility - **CUDA Plugin EP v0.4.0** and **WebGPU Plugin EP v0.6.0** are matched with ONNX Runtime 1.32.0 ([#33214](microsoft/onnxruntime#33214)). For **contrib-op compatibility**, core and the plugin must use the same contributed-operator schemas; building both from the **same ONNX Runtime revision** is recommended. Schema mismatches can cause incorrect execution or crashes and may not be detected during plugin registration. - **ACL EP removed:** Following its deprecation in 1.31.0, the Arm Compute Library (`ACLExecutionProvider`) execution provider, its build options, and its standalone C registration API have been removed. Python's `get_all_providers()` no longer lists `ACLExecutionProvider`; applications should remove it from explicit provider lists ([#33851](microsoft/onnxruntime#33851)). - **Legacy provider-bridge `NvTensorRTRTXExecutionProvider` removed:** In-tree provider-bridge `NvTensorRTRTXExecutionProvider` sources have been removed in favor of the standalone NVIDIA TensorRT RTX plugin EP registered via `OrtApi::RegisterExecutionProviderLibrary`. `NvTensorRtRtxProviderOptions` is retained as a deprecated declaration for source compatibility, and legacy `AppendExecutionProvider` calls now report a deprecation error directing callers to the plugin EP ([#32276](microsoft/onnxruntime#32276)). - **ONNX 1.23.2 integration:** ONNX has been upgraded to **1.23.2**, raising supported opset ceilings to **28** and restoring `ONNX_TENSOR_ELEMENT_DATA_TYPE_FLOAT6E2M3` and `ONNX_TENSOR_ELEMENT_DATA_TYPE_FLOAT6E3M2` public element-type mappings and `Cast` conversions ([#33134](microsoft/onnxruntime#33134)). - **DLPack v1.3 boolean contract change:** DLPack has been upgraded to **v1.3** with native `kDLBool` metadata and bidirectional support for all implemented ORT numeric and boolean types, including all five `float8` formats, packed `float4`, `int4`/`uint4`, and `int2`/`uint2` (`float6` remains unsupported in DLPack). The low-level `is_bool_tensor` override was removed, and `uint8` DLPack metadata now always imports as `uint8` ([#33848](microsoft/onnxruntime#33848)). - **Weightless compilation API migration:** `OrtCompileApi::ModelCompilationOptions_SetWeightlessEnabled` and the `ep.enable_weightless` / `ep.enable_weightless_ep_context_nodes` session options are deprecated in favor of `ModelCompilationOptions_SetWeightlessMode` and `ep.enable_weightless_mode` (`"0"` = `NONE`, `"1"` = `EXTERNAL_ONLY`, `"2"` = `ALL`). EPs can now advertise multi-mode capability via `OrtWeightlessSupport_ALL_OR_EXTERNAL_ONLY` and `weightless_supported_modes` ([#32899](microsoft/onnxruntime#32899)). - **Training CI retirement:** Training build and test lanes were retired from active GitHub Actions CI workflows while retaining inference build coverage ([#33836](microsoft/onnxruntime#33836)). - This is the last release for [CocoaPods](https://cocoapods.org/), and we will switch to [Swift Package Manager](https://docs.swift.org/latest/documentation/packagemanagerdocs/). - We will use combo onnxruntime-gpu python package to reduce storage size from next release. You can test it [here](https://aiinfra.visualstudio.com/PublicPackages/_artifacts/feed/ORT-Nightly/PyPI/onnxruntime-gpu/overview) ## New Features ### Core APIs & Runtime - Added `OrtApi::EpDevice_GetMemoryCapacity` (C++ `EpDevice::GetMemoryCapacity()`) and `OrtEpFactory::GetDeviceMemoryCapacity` to query device-global total memory and estimated currently available memory (`DEFAULT` or `HOST_ACCESSIBLE`), with built-in and plugin CUDA EP support ([#33447](microsoft/onnxruntime#33447)). - Expanded the app–EP weightless contract so EPs advertise all supported weightless modes (`weightless_supported_modes`), applications request an explicit mode (`ModelCompilationOptions_SetWeightlessMode` / `ep.enable_weightless_mode`), and compiled EPContext models record `weightless_mode` and `external_dependencies` (`source_model`, `external_weights`, `ep_context_binary`) in model metadata ([#32899](microsoft/onnxruntime#32899)). - Extended `session.use_external_initializer_file_buffers_directly="1"` to `AddExternalInitializers` for zero-copy borrowing of naturally aligned CPU buffers larger than 127 bytes on little-endian hosts, and documented the read-only guarantee for external initializers added via `OrtModelEditorApi::AddInitializerToGraph` with `data_is_external=true` ([#33877](microsoft/onnxruntime#33877), [#33717](microsoft/onnxruntime#33717)). - Added lock-free multi-worker pinned-memory staging (`session.external_data_loader.*`) to accelerate external initializer loading into GPU memory across built-in and plugin CUDA EPs ([#33839](microsoft/onnxruntime#33839)). - Added a session-scoped MoE/QMoE CPU/GPU offload planner and memory-budget ledger (`session.moe.offload.*`), generic `session.kernel_dispatch_policy` (`auto`, `latency`, `memory`, `safe`) configuration plumbing, Level-1 workspace/prepack memory accounting fallback for nodes absent from memory-profile CSVs, and internal capability-planning protocol types ([#33451](microsoft/onnxruntime#33451), [#33042](microsoft/onnxruntime#33042), [#33311](microsoft/onnxruntime#33311), [#33841](microsoft/onnxruntime#33841)). - Enabled cross-thread reuse of idle device streams when graph capture is disabled and providers register device-selection callbacks, and enabled compile-session profiling (`<profile_file>_compile`) in `onnxruntime_perf_test` when `-p` is used with `--compile_ep_context` ([#33053](microsoft/onnxruntime#33053), [#33694](microsoft/onnxruntime#33694)). - Made `onnxruntime_DISABLE_EXCEPTIONS` (`--disable_exceptions`) usable without `onnxruntime_MINIMAL_BUILD` and added the `onnxruntime_DISABLE_STREAM=ON` CMake option to disable device-stream support in non-minimal builds ([#33120](microsoft/onnxruntime#33120), [#33482](microsoft/onnxruntime#33482)). ### ONNX Opset 28 & Shared Contrib Operators These updates affect core ONNX and contributed operator schemas and cross-provider behavior, not only the separately released GPU plugins. - Added ONNX opset 28 operator support: native `SpaceToDepth` (`DCR` and `CRD`) on CPU and CUDA with version-split registrations across DML, JS, WebGPU, and QNN; opset-28 floating floor-modulus `Mod` on CPU, CUDA, and DML; opset-28 `BFloat16` support for `Compress`, `OneHot`, `ReverseSequence`, `Unique`, `Celu`, and `Einsum` on CPU (plus `Compress`, `OneHot`, and `ReverseSequence` on CUDA); and `BFloat16` `Pad` (opsets 21–25) on CPU and CUDA ([#32362](microsoft/onnxruntime#32362), [#32369](microsoft/onnxruntime#32369), [#32378](microsoft/onnxruntime#32378), [#34062](microsoft/onnxruntime#34062)). - Extended `GatedDeltaNet` with Kimi Delta Attention (KDA) per-key-dimension decay across CPU, CUDA, and WebGPU, and extended `GatedDeltaNet` and `CausalConvWithState` state/gate handling for multi-token speculative decoding ([#33817](microsoft/onnxruntime#33817), [#33471](microsoft/onnxruntime#33471)). - Added an optional `query_seqlens` input to `GroupQueryAttention` to skip right-padded prefill tokens and idle batch entries (`query_seqlens[b] = 0`) on CPU and CUDA, and added `q_norm_epsilon` / `k_norm_epsilon` attributes to preserve distinct Q and K normalization epsilons during GQA pre-norm fusion ([#33503](microsoft/onnxruntime#33503), [#33505](microsoft/onnxruntime#33505), [#33832](microsoft/onnxruntime#33832), [#33363](microsoft/onnxruntime#33363)). - Defined the INT3 `QMoE` v1 packed-code contract, added opt-in post-SiLU clipping (`swiglu_limit_after_activation`) and tanh-`GEGLU` (`activation_type="geglu"`) support to MoE/QMoE schemas, and added `GatherPacked` (CPU/CUDA), `MatMulPacked` (CUDA, including native Bolt `global_scale`), and `MoEPacked` (CUDA) to consume native GGUF/block-packed quantized weights directly ([#33394](microsoft/onnxruntime#33394), [#33954](microsoft/onnxruntime#33954), [#33633](microsoft/onnxruntime#33633), [#33953](microsoft/onnxruntime#33953), [#33962](microsoft/onnxruntime#33962)). - Added `PackedSparseAttentionIndexerMerge` for multi-token prediction index sharing and optional `state_status` / mid-state outputs on `PackedSparseAttentionIndexer` across CUDA and WebGPU; extended `GatedAdd` with an optional projected `gate_weight` across CPU, CUDA, and WebGPU; and supported empty unpacked weights in CPU and WebGPU `MatMulNBits` ([#33224](microsoft/onnxruntime#33224), [#33383](microsoft/onnxruntime#33383), [#33472](microsoft/onnxruntime#33472), [#33470](microsoft/onnxruntime#33470), [#33559](microsoft/onnxruntime#33559)). - Registered core contrib schemas for provider-targeted LLM and speculative-decoding operators, including `SwiGLU`, `RMSNormRotary`, `HyperConnectionLowRankMix`, `RouterGateUpProj`, `SpeculativePrefixCommit`, `GatedDeltaNetStateReplay`, `ConvStateReplay`, and `MatMulNBitsQLoRA` ([#32126](microsoft/onnxruntime#32126), [#33469](microsoft/onnxruntime#33469), [#33384](microsoft/onnxruntime#33384), [#33650](microsoft/onnxruntime#33650), [#33474](microsoft/onnxruntime#33474), [#33213](microsoft/onnxruntime#33213), [#33493](microsoft/onnxruntime#33493), [#33370](microsoft/onnxruntime#33370)). ### Plugin Execution Provider Infrastructure - Fixed an `OrtMemoryInfo` ABI mismatch across the ORT/plugin EP boundary by converting `OrtMemoryInfo` instances exclusively through the C API ([#33571](microsoft/onnxruntime#33571)). - Zero-initialized `OrtEpFactory` structs in provider-bridge EP factories so unimplemented optional callbacks are null, and prevented double DLL initialization and handle leaks when probing and registering plugin EP libraries ([#33117](microsoft/onnxruntime#33117), [#33701](microsoft/onnxruntime#33701)). - Hardened portable model-package EP recreation, custom-domain preservation, UTF-8 path handling, and `shared_assets` path confinement and symlink validation ([#32790](microsoft/onnxruntime#32790), [#33826](microsoft/onnxruntime#33826)). ... (truncated) Commits viewable in [compare view](microsoft/onnxruntime@v1.31.1...v1.32.0). </details> Updated [Microsoft.ML.OnnxRuntime.Managed](https://github.com/microsoft/onnxruntime) from 1.31.1 to 1.32.0. <details> <summary>Release notes</summary> _Sourced from [Microsoft.ML.OnnxRuntime.Managed's releases](https://github.com/microsoft/onnxruntime/releases)._ ## 1.32.0 ONNX Runtime 1.32.0 reintegrates ONNX 1.23.2 with opset 28 support, introduces CPU/GPU hybrid MoE offloading and shared-layout CPU QMoE kernels, expands device-memory, weightless-compilation, and Python model-package APIs, dramatically accelerates session initialization on large graphs, and strengthens runtime and optimizer reliability. These notes cover changes since ONNX Runtime 1.31.1. CUDA and WebGPU kernel updates are summarized here; detailed provider notes are covered by their separate plugin EP releases. ## Highlights - Reintegrated **ONNX 1.23.2** with **opset 28** operator support (`SpaceToDepth`, `Mod`, signed `BitShift`, and `BFloat16` extensions) and updated **DLPack to v1.3** across all implemented ORT numeric and boolean tensor types ([#33134](microsoft/onnxruntime#33134), [#32362](microsoft/onnxruntime#32362), [#33848](microsoft/onnxruntime#33848)). - Added a session-scoped **CPU/GPU hybrid MoE offload** planner and execution backend for quantized `QMoE` (NVFP4, INT4, INT3, and INT2) and block-packed `MoEPacked` models, backed by shared-layout AVX-512/AVX2 CPU `QMoE` kernels and memory-mapped expert storage ([#33450](microsoft/onnxruntime#33450), [#33451](microsoft/onnxruntime#33451), [#33452](microsoft/onnxruntime#33452), [#33973](microsoft/onnxruntime#33973)). - Expanded core APIs with `OrtApi::EpDevice_GetMemoryCapacity`, explicit multi-mode weightless compilation (`ModelCompilationOptions_SetWeightlessMode` and `ep.enable_weightless_mode`), Python bindings for the Model Package APIs, and zero-copy CPU buffer borrowing in `AddExternalInitializers` ([#33447](microsoft/onnxruntime#33447), [#32899](microsoft/onnxruntime#32899), [#33640](microsoft/onnxruntime#33640), [#33877](microsoft/onnxruntime#33877)). - Eliminated superlinear bottlenecks in allocation planning, constant sharing, graph I/O mapping, and topological sorting—reducing session initialization on 100k-node constant-heavy graphs from minutes to seconds—and added pipelined pinned-memory staging for external GPU weight loading ([#33407](microsoft/onnxruntime#33407), [#33939](microsoft/onnxruntime#33939), [#34009](microsoft/onnxruntime#34009), [#33839](microsoft/onnxruntime#33839)). - Expanded shared generative AI and quantized contrib operators, including Kimi Delta Attention (`GatedDeltaNet` per-key-dimension decay), right-padded chunked prefill in `GroupQueryAttention`, native GGUF/block-packed operators (`GatherPacked`, `MatMulPacked`, `MoEPacked`), and sparse-attention index sharing ([#33817](microsoft/onnxruntime#33817), [#33503](microsoft/onnxruntime#33503), [#33953](microsoft/onnxruntime#33953), [#33224](microsoft/onnxruntime#33224)). ## Announcements & Compatibility - **CUDA Plugin EP v0.4.0** and **WebGPU Plugin EP v0.6.0** are matched with ONNX Runtime 1.32.0 ([#33214](microsoft/onnxruntime#33214)). For **contrib-op compatibility**, core and the plugin must use the same contributed-operator schemas; building both from the **same ONNX Runtime revision** is recommended. Schema mismatches can cause incorrect execution or crashes and may not be detected during plugin registration. - **ACL EP removed:** Following its deprecation in 1.31.0, the Arm Compute Library (`ACLExecutionProvider`) execution provider, its build options, and its standalone C registration API have been removed. Python's `get_all_providers()` no longer lists `ACLExecutionProvider`; applications should remove it from explicit provider lists ([#33851](microsoft/onnxruntime#33851)). - **Legacy provider-bridge `NvTensorRTRTXExecutionProvider` removed:** In-tree provider-bridge `NvTensorRTRTXExecutionProvider` sources have been removed in favor of the standalone NVIDIA TensorRT RTX plugin EP registered via `OrtApi::RegisterExecutionProviderLibrary`. `NvTensorRtRtxProviderOptions` is retained as a deprecated declaration for source compatibility, and legacy `AppendExecutionProvider` calls now report a deprecation error directing callers to the plugin EP ([#32276](microsoft/onnxruntime#32276)). - **ONNX 1.23.2 integration:** ONNX has been upgraded to **1.23.2**, raising supported opset ceilings to **28** and restoring `ONNX_TENSOR_ELEMENT_DATA_TYPE_FLOAT6E2M3` and `ONNX_TENSOR_ELEMENT_DATA_TYPE_FLOAT6E3M2` public element-type mappings and `Cast` conversions ([#33134](microsoft/onnxruntime#33134)). - **DLPack v1.3 boolean contract change:** DLPack has been upgraded to **v1.3** with native `kDLBool` metadata and bidirectional support for all implemented ORT numeric and boolean types, including all five `float8` formats, packed `float4`, `int4`/`uint4`, and `int2`/`uint2` (`float6` remains unsupported in DLPack). The low-level `is_bool_tensor` override was removed, and `uint8` DLPack metadata now always imports as `uint8` ([#33848](microsoft/onnxruntime#33848)). - **Weightless compilation API migration:** `OrtCompileApi::ModelCompilationOptions_SetWeightlessEnabled` and the `ep.enable_weightless` / `ep.enable_weightless_ep_context_nodes` session options are deprecated in favor of `ModelCompilationOptions_SetWeightlessMode` and `ep.enable_weightless_mode` (`"0"` = `NONE`, `"1"` = `EXTERNAL_ONLY`, `"2"` = `ALL`). EPs can now advertise multi-mode capability via `OrtWeightlessSupport_ALL_OR_EXTERNAL_ONLY` and `weightless_supported_modes` ([#32899](microsoft/onnxruntime#32899)). - **Training CI retirement:** Training build and test lanes were retired from active GitHub Actions CI workflows while retaining inference build coverage ([#33836](microsoft/onnxruntime#33836)). - This is the last release for [CocoaPods](https://cocoapods.org/), and we will switch to [Swift Package Manager](https://docs.swift.org/latest/documentation/packagemanagerdocs/). - We will use combo onnxruntime-gpu python package to reduce storage size from next release. You can test it [here](https://aiinfra.visualstudio.com/PublicPackages/_artifacts/feed/ORT-Nightly/PyPI/onnxruntime-gpu/overview) ## New Features ### Core APIs & Runtime - Added `OrtApi::EpDevice_GetMemoryCapacity` (C++ `EpDevice::GetMemoryCapacity()`) and `OrtEpFactory::GetDeviceMemoryCapacity` to query device-global total memory and estimated currently available memory (`DEFAULT` or `HOST_ACCESSIBLE`), with built-in and plugin CUDA EP support ([#33447](microsoft/onnxruntime#33447)). - Expanded the app–EP weightless contract so EPs advertise all supported weightless modes (`weightless_supported_modes`), applications request an explicit mode (`ModelCompilationOptions_SetWeightlessMode` / `ep.enable_weightless_mode`), and compiled EPContext models record `weightless_mode` and `external_dependencies` (`source_model`, `external_weights`, `ep_context_binary`) in model metadata ([#32899](microsoft/onnxruntime#32899)). - Extended `session.use_external_initializer_file_buffers_directly="1"` to `AddExternalInitializers` for zero-copy borrowing of naturally aligned CPU buffers larger than 127 bytes on little-endian hosts, and documented the read-only guarantee for external initializers added via `OrtModelEditorApi::AddInitializerToGraph` with `data_is_external=true` ([#33877](microsoft/onnxruntime#33877), [#33717](microsoft/onnxruntime#33717)). - Added lock-free multi-worker pinned-memory staging (`session.external_data_loader.*`) to accelerate external initializer loading into GPU memory across built-in and plugin CUDA EPs ([#33839](microsoft/onnxruntime#33839)). - Added a session-scoped MoE/QMoE CPU/GPU offload planner and memory-budget ledger (`session.moe.offload.*`), generic `session.kernel_dispatch_policy` (`auto`, `latency`, `memory`, `safe`) configuration plumbing, Level-1 workspace/prepack memory accounting fallback for nodes absent from memory-profile CSVs, and internal capability-planning protocol types ([#33451](microsoft/onnxruntime#33451), [#33042](microsoft/onnxruntime#33042), [#33311](microsoft/onnxruntime#33311), [#33841](microsoft/onnxruntime#33841)). - Enabled cross-thread reuse of idle device streams when graph capture is disabled and providers register device-selection callbacks, and enabled compile-session profiling (`<profile_file>_compile`) in `onnxruntime_perf_test` when `-p` is used with `--compile_ep_context` ([#33053](microsoft/onnxruntime#33053), [#33694](microsoft/onnxruntime#33694)). - Made `onnxruntime_DISABLE_EXCEPTIONS` (`--disable_exceptions`) usable without `onnxruntime_MINIMAL_BUILD` and added the `onnxruntime_DISABLE_STREAM=ON` CMake option to disable device-stream support in non-minimal builds ([#33120](microsoft/onnxruntime#33120), [#33482](microsoft/onnxruntime#33482)). ### ONNX Opset 28 & Shared Contrib Operators These updates affect core ONNX and contributed operator schemas and cross-provider behavior, not only the separately released GPU plugins. - Added ONNX opset 28 operator support: native `SpaceToDepth` (`DCR` and `CRD`) on CPU and CUDA with version-split registrations across DML, JS, WebGPU, and QNN; opset-28 floating floor-modulus `Mod` on CPU, CUDA, and DML; opset-28 `BFloat16` support for `Compress`, `OneHot`, `ReverseSequence`, `Unique`, `Celu`, and `Einsum` on CPU (plus `Compress`, `OneHot`, and `ReverseSequence` on CUDA); and `BFloat16` `Pad` (opsets 21–25) on CPU and CUDA ([#32362](microsoft/onnxruntime#32362), [#32369](microsoft/onnxruntime#32369), [#32378](microsoft/onnxruntime#32378), [#34062](microsoft/onnxruntime#34062)). - Extended `GatedDeltaNet` with Kimi Delta Attention (KDA) per-key-dimension decay across CPU, CUDA, and WebGPU, and extended `GatedDeltaNet` and `CausalConvWithState` state/gate handling for multi-token speculative decoding ([#33817](microsoft/onnxruntime#33817), [#33471](microsoft/onnxruntime#33471)). - Added an optional `query_seqlens` input to `GroupQueryAttention` to skip right-padded prefill tokens and idle batch entries (`query_seqlens[b] = 0`) on CPU and CUDA, and added `q_norm_epsilon` / `k_norm_epsilon` attributes to preserve distinct Q and K normalization epsilons during GQA pre-norm fusion ([#33503](microsoft/onnxruntime#33503), [#33505](microsoft/onnxruntime#33505), [#33832](microsoft/onnxruntime#33832), [#33363](microsoft/onnxruntime#33363)). - Defined the INT3 `QMoE` v1 packed-code contract, added opt-in post-SiLU clipping (`swiglu_limit_after_activation`) and tanh-`GEGLU` (`activation_type="geglu"`) support to MoE/QMoE schemas, and added `GatherPacked` (CPU/CUDA), `MatMulPacked` (CUDA, including native Bolt `global_scale`), and `MoEPacked` (CUDA) to consume native GGUF/block-packed quantized weights directly ([#33394](microsoft/onnxruntime#33394), [#33954](microsoft/onnxruntime#33954), [#33633](microsoft/onnxruntime#33633), [#33953](microsoft/onnxruntime#33953), [#33962](microsoft/onnxruntime#33962)). - Added `PackedSparseAttentionIndexerMerge` for multi-token prediction index sharing and optional `state_status` / mid-state outputs on `PackedSparseAttentionIndexer` across CUDA and WebGPU; extended `GatedAdd` with an optional projected `gate_weight` across CPU, CUDA, and WebGPU; and supported empty unpacked weights in CPU and WebGPU `MatMulNBits` ([#33224](microsoft/onnxruntime#33224), [#33383](microsoft/onnxruntime#33383), [#33472](microsoft/onnxruntime#33472), [#33470](microsoft/onnxruntime#33470), [#33559](microsoft/onnxruntime#33559)). - Registered core contrib schemas for provider-targeted LLM and speculative-decoding operators, including `SwiGLU`, `RMSNormRotary`, `HyperConnectionLowRankMix`, `RouterGateUpProj`, `SpeculativePrefixCommit`, `GatedDeltaNetStateReplay`, `ConvStateReplay`, and `MatMulNBitsQLoRA` ([#32126](microsoft/onnxruntime#32126), [#33469](microsoft/onnxruntime#33469), [#33384](microsoft/onnxruntime#33384), [#33650](microsoft/onnxruntime#33650), [#33474](microsoft/onnxruntime#33474), [#33213](microsoft/onnxruntime#33213), [#33493](microsoft/onnxruntime#33493), [#33370](microsoft/onnxruntime#33370)). ### Plugin Execution Provider Infrastructure - Fixed an `OrtMemoryInfo` ABI mismatch across the ORT/plugin EP boundary by converting `OrtMemoryInfo` instances exclusively through the C API ([#33571](microsoft/onnxruntime#33571)). - Zero-initialized `OrtEpFactory` structs in provider-bridge EP factories so unimplemented optional callbacks are null, and prevented double DLL initialization and handle leaks when probing and registering plugin EP libraries ([#33117](microsoft/onnxruntime#33117), [#33701](microsoft/onnxruntime#33701)). - Hardened portable model-package EP recreation, custom-domain preservation, UTF-8 path handling, and `shared_assets` path confinement and symlink validation ([#32790](microsoft/onnxruntime#32790), [#33826](microsoft/onnxruntime#33826)). ... (truncated) Commits viewable in [compare view](microsoft/onnxruntime@v1.31.1...v1.32.0). </details> Updated [Microsoft.NET.Test.Sdk](https://github.com/microsoft/vstest) from 18.11.0 to 18.12.0. <details> <summary>Release notes</summary> _Sourced from [Microsoft.NET.Test.Sdk's releases](https://github.com/microsoft/vstest/releases)._ ## 18.12.0 ## Security fix This release includes the fix for CVE-2026-105544, an elevation of privilege vulnerability in the VSTest artifact post-processor. The post-processor could consume a forged `executionComplete.json` written by another local user, and then run attacker-controlled output handling. Affected: `Microsoft.TestPlatform.CLI` 18.11.0 and earlier. Every version from 18.11.1 on is fixed, including 18.12.0. `Microsoft.TestPlatform.CLI` is the VSTest build that we ship into the .NET SDK. The recommended way to get this fix is to update your .NET SDK to the latest patched version, see the advisory for the SDK versions. The fix is also released in the `Microsoft.TestPlatform.CLI` package, for completeness. That package is rarely used directly. It is not a dependency of `Microsoft.NET.Test.Sdk` or `Microsoft.TestPlatform`, so those packages do not bring it in. Details: microsoft/vstest#16654 and dotnet/announcements#517 Using custom Docker images or Nano Server? See microsoft/vstest#16652 ## What's Changed * Fix TestCaseStart/Stop events dropped for data-driven tests with shared TestCase.Id by @nohwnd in microsoft/vstest#16033 * Stop the discovery manager factory from shadowing discoveryCriteria by @nohwnd in microsoft/vstest#16391 * Gate the HTTP link checker on a fingerprint of the broken links by @nohwnd in microsoft/vstest#16413 * Quote boolean conditions in shipped Microsoft.TestPlatform.targets by @nohwnd in microsoft/vstest#16404 * Obsolete API hygiene: the compatibility-safe changes by @azat-msft in microsoft/vstest#16420 * Add xxHash128 test ids, available but not default by @azat-msft in microsoft/vstest#16378 * Isolate attachment manager test temporary files by @mmitche in microsoft/vstest#16463 * Test ids report logger by @azat-msft in microsoft/vstest#16443 * Isolate code coverage files in published output by @azat-msft in microsoft/vstest#16483 * Preserve OutputType for Android test projects by @jonathanpeppers in microsoft/vstest#16496 * Fix dotnet host resolution under proot (ARM64/Termux) by @azat-msft in microsoft/vstest#16462 * Mark the xxHash128 test id API as experimental by @azat-msft in microsoft/vstest#16465 * Ship Microsoft.Diagnostics.NETCore.Client in Microsoft.TestPlatform and Portable packages by @nohwnd in microsoft/vstest#16633 * Fix localized resource paths in CLI source-build/non-Windows packages by @nohwnd in microsoft/vstest#16644 **Full Changelog**: microsoft/vstest@v18.11.0...v18.12.0 ## 18.11.1 ## Security fix This release fixes CVE-2026-105544, an elevation of privilege vulnerability in the VSTest artifact post-processor. The post-processor could consume a forged `executionComplete.json` written by another local user, and then run attacker-controlled output handling. Affected: `Microsoft.TestPlatform.CLI` 18.11.0. Fixed in: `Microsoft.TestPlatform.CLI` 18.11.1. `Microsoft.TestPlatform.CLI` is the VSTest build that we ship into the .NET SDK. The recommended way to get this fix is to update your .NET SDK to the latest patched version, see the advisory for the SDK versions. The fix is also released in the `Microsoft.TestPlatform.CLI` package, for completeness. That package is rarely used directly. It is not a dependency of `Microsoft.NET.Test.Sdk` or `Microsoft.TestPlatform`, so those packages do not bring it in. Details: microsoft/vstest#16654 and dotnet/announcements#517 Using custom Docker images or Nano Server? See microsoft/vstest#16652 ## What's Changed * Security fix for CVE-2026-105544, see microsoft/vstest#16654 * Ship Microsoft.Diagnostics.NETCore.Client in Microsoft.TestPlatform and Portable packages by @nohwnd in microsoft/vstest#16632 * Fix localized resource paths in CLI source-build packages by @nohwnd in microsoft/vstest#16643 **Full Changelog**: microsoft/vstest@v18.11.0...v18.11.1 Commits viewable in [compare view](microsoft/vstest@v18.11.0...v18.12.0). </details> Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore <dependency name> major version` will close this group update PR and stop Dependabot creating any more for the specific dependency's major version (unless you unignore this specific dependency's major version or upgrade to it yourself) - `@dependabot ignore <dependency name> minor version` will close this group update PR and stop Dependabot creating any more for the specific dependency's minor version (unless you unignore this specific dependency's minor version or upgrade to it yourself) - `@dependabot ignore <dependency name>` will close this group update PR and stop Dependabot creating any more for the specific dependency (unless you unignore this specific dependency or upgrade to it yourself) - `@dependabot unignore <dependency name>` will remove all of the ignore conditions of the specified dependency - `@dependabot unignore <dependency name> <ignore condition>` will remove the ignore condition of the specified dependency and ignore conditions </details> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>



Description
Adds the$3 \le S \le 8$ verification rows ($B \ge 1$ ). The operator runs entirely on the device with zero host synchronization or dynamic allocation so it can be captured and replayed inside a CUDA Graph.
com.microsoft::SpeculativePrefixCommit(opset 1) CUDA contrib operator for single-launch device-side speculative prefix verification, control/context state commit, and result-ring publication acrossSummary of Changes
com.microsoft::SpeculativePrefixCommitSchema & CUDA Kernelonnxruntime/core/graph/contrib_ops/bert_defs.cc,ms_opset.hcom.microsoft::SpeculativePrefixCommit(1)with attributehead_rows(3..8, default8), 7 inputs (next_tokens,input_ids,status,ctl,ctx_commit,prefixes,ptrs), and 3 required outputs (head_c,updated_ctl,updated_ctx_commit), enforcing rank 1 ([rows]) or rank 2 ([batch, rows]) onnext_tokensand propagatinghead_cshape[batch]only whennext_tokenshas a known shapeonnxruntime/contrib_ops/cuda/cuda_contrib_kernels.cc,onnxruntime/contrib_ops/cuda/llm/speculative_fold.{h,cc,cu}SpeculativePrefixCommit(MayInplace(3, 1)andMayInplace(4, 2)), launching one thread per batch item (PrefixCommitKernel) to match verifier predictions against draft tokens (input_ids[b, 1:rows]), write the updated 16-word control state (updated_ctl) and 2-word context pair (updated_ctx_commit) in-place or to disjoint output buffers, and publish an 8-word record to the per-request result ring after__threadfence_system()Tests and Documentation
onnxruntime/test/contrib_ops/cuda_kernels/speculative_fold_test.cc,cmake/onnxruntime_unittests.cmake: Kernel-level tests (FoldContribTest.*) covering all accepted prefix lengths forhead_rowsin{3, 4, 8}, in-place and disjoint state output buffers, multi-batch per-item state and result-ring progression, muted prefill (ctl[3] != 0), invalid metadata / ring validation flags (ctl[5]), verifier status aggregation, and CUDA Graph capture/replay.onnxruntime/test/contrib_ops/speculative_fold_op_test.cc: Session-level tests (SpeculativeFoldTest.*) covering batchedInferenceSession, multi-run state progression carryingupdated_ctl/updated_ctx_commitacrossRuncalls, muted prefill with variable row counts, shape inference with known and unknownnext_tokensshapes, and rejection of invalidnext_tokensranks, missing required state outputs, or partially overlapping buffers.docs/ContribOperators.md,docs/OperatorKernels.md,docs/contrib_ops/cuda/speculative_fold.md: Regenerates schema/kernel tables and documents the operator interface, state aliasing contract, result-ring layout, error flags, and graph wiring.Testing
onnxruntime_provider_test --gtest_filter="FoldContribTest.*:SpeculativeFoldTest.*"qwen_flash_next_int4_int8_rc3_contrib_dflash2(Checklist