Repository navigation
Replace speculative fold operators at version 1 - #33550
Merged
Tianlei Wu (tianleiwu) merged 2 commits intoOct 23, 2026
Merged
Tianlei Wu (tianleiwu) merged 2 commits into
Tianlei Wu (tianleiwu) merged 2 commits into
Conversation
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>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The Microsoft domain version limit blocks normal v2 model loading, and host validation rejects supported muted-prefill row counts.
4 open issues
What changed in this PR
Adds native CUDA v2 speculative-fold operators for multi-row DFlash verification, replacing the legacy custom-op dependency while leaving v1 implementations unchanged.
Changes:
- Adds v2 schemas, CUDA registrations, and host validation for configurable head rows, cache capacity, and optional hidden-state padding.
- Defers result-ring publication until tail validation completes.
- Adds five CUDA tests, test-build integration, and migration documentation.
| File | Description |
|---|---|
onnxruntime/test/contrib_ops/cuda_kernels/speculative_fold_v2_test.cc |
Tests acceptance, publication, metadata validation, and graph replay. |
onnxruntime/core/graph/contrib_ops/ms_opset.h |
Registers the v2 operator schemas. |
onnxruntime/core/graph/contrib_ops/bert_defs.cc |
Defines v2 interfaces and shape inference. |
onnxruntime/contrib_ops/cuda/llm/speculative_fold_v2.h |
Declares CUDA launcher interfaces. |
onnxruntime/contrib_ops/cuda/llm/speculative_fold_v2.cu |
Implements acceptance, padding, and deferred publication. |
onnxruntime/contrib_ops/cuda/llm/speculative_fold_v2.cc |
Adds host validation and aliased state outputs. |
onnxruntime/contrib_ops/cuda/cuda_contrib_kernels.cc |
Registers v2 CUDA kernels. |
docs/contrib_ops/cuda/speculative_fold.md |
Documents state handling and migration. |
cmake/onnxruntime_unittests.cmake |
Includes v2 tests and kernels in the test build. |
Review effort: Balanced
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Comment on lines
+74
to
+75
| ORT_ENFORCE(updated_ctl->DataRaw() == ctl->DataRaw() && updated_context->DataRaw() == committed->DataRaw(), | ||
| "FoldMid2 requires aliased control/context outputs"); |
| #include <sstream> | ||
| #include <string> | ||
| #include <type_traits> | ||
| #include <utility> |
| EXPECT_TRUE(status.IsOK()) << status; | ||
| if (status.IsOK()) { | ||
| EXPECT_EQ(outputs[6].Get<Tensor>().Data<int64_t>()[0], muted ? 0 : 1); | ||
| EXPECT_EQ(outputs[10].Get<Tensor>().Data<int32_t>()[0], muted ? 0 : 1); |
Tianlei Wu (tianleiwu)
merged commit Oct 23, 2026
efa5ab5
into
asonawane/main-ops-mtp-fold-state
7 checks passed
Contributor
|
Squashed into #33474 (asonawane/main-ops-mtp-fold-state). Closing this stacked PR. |
Tianlei Wu (tianleiwu)
added a commit
that referenced
this pull request
Oct 23, 2026
…ty, optional in-place ctl/ctx) and remove unused MtpMoe Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
3 tasks done
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
Replace the existing
com.microsoftspeculative-fold operators at opset 1 with the multi-row implementation required by Qwen/DFlash verification. No opset-2 schemas or kernels are added; model imports remain compatible with the supported[1, 1]com.microsoftdomain range.head_rows.FoldTail.Related GenAI changes
efb26517).com.microsoftopset 1 for the procedural graph builder (latest commit2e63ae0c).Base
Incremental PR against
asonawane/main-ops-mtp-fold-state.Validation
lintrunner -apassed for all touched ORT and GenAI paths;git diff --checkpassed.nvcc. These require CI/configured-build verification.