[None][feat] GVR V2 hint-free mode: pre_idx=None derives the top-k bracket from the current row - #18410
Draft
longcheng-nv wants to merge 1 commit into
Draft
Conversation
…acket from the current row
run_varlen(pre_idx=None) makes the self-sampling GVR decode kernel fully
self-contained -- no prev-step top-K hint tensor required:
- register families: bracket = min/max fold of the first k row values,
which already sit in the row-load register fragments (zero extra loads);
the hint prefetch and the hint-gather bracket arms (use_bm/use_img) are
compiled out under the hf arm; DEG cells keep the whole-row fold (n<=3k:
the row is the sample)
- clustered register family: P0 samples the first k row elements
(coalesced, cluster-uniform by construction, zero barrier changes)
- streaming families: gather_hint sites compiled out (sentinel
pass-through; a device-truth census on 886 real decode captures x
BS{1,8,64,512} shows these sites never fire on the accept path)
The hinted path is unchanged; pre_idx stays in the API as the eligibility
gate and future extension point (e.g. disagg true-top-K seeding). k comes
from indices.shape[1]; hint-free is auto-engine only. Exactness is
hint-independent by contract (tie-aware value-multiset checks all-pass on
real decode captures).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: longcheng-nv <243710427+longcheng-nv@users.noreply.github.com>
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.
@coderabbitai summary
Description
run_varlen(pre_idx=None)runs the self-sampling GVR decode top-k kernel without the prev-step top-K hint tensor. The hinted path is unchanged;pre_idxstays in the API as the eligibility gate. Hint-free is auto-engine only, andkcomes fromindices.shape[1].Callers that have no usable hint (first decode step, disagg generation side, deployments that drop the per-layer prior arena, ~256 MB at 61 layers / BS 1024) today pay a 3.6-6x register-family penalty (worst case 14.7x) if they pass degenerate hints. With
pre_idx=Nonethe same shapes run at hinted-path speed.Implementation: one
hfconstexpr per kernel family, threaded through the compile caches and the varlen launcher key.use_bm/use_img) are compiled outgather_hintrescue sites compiled out; a device-truth census on 886 real decode captures x BS {1,8,64,512} shows these sites never fireMeasurements
886 real decode captures (DSv3.2, V4 Flash, V4 Pro) x BS {1,8,64,512}, three arms in one process, cold-L2 nsys kernel-only, B200.
own= hinted (production today),invalid= all-1hints (dropping the hint with no kernel change),hf= this PR.Full 886 x 11-BS grid on this head (9,746 cases, hinted vs
pre_idx=Nonein one process, same protocol):Test Coverage
tests/unittest/_torch/thop/parallel/test_gvr_selfsampling_topk.py: apre_idx=Nonearm per kernel family, exactness vstorch.topk, and None-vs-hinted output equivalence.PR Checklist