feat(linked): add FlashInfer sampling provider - #930
Draft
voltjia wants to merge 2 commits into
Draft
Conversation
voltjia
force-pushed
the
feat/operator-implementation-selection
branch
from
August 13, 2026 16:43
4ba65ce to
87a242b
Compare
voltjia
force-pushed
the
feat/linked-flashinfer-sampling
branch
from
August 13, 2026 16:43
8054804 to
94965ca
Compare
This was referenced Aug 13, 2026
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
TopKTopPSamplingFromLogitsbacked by FlashInfer's AOT sampling module.fp16,bf16,fp32, andfp64logits;top_k_firstandjoint; CPU/CUDA int32/int64 indices; deterministic seed/offset; default or caller workspace; and non-default CUDA streams.flashinfer-jit-cache>=0.6.7,<0.7andapache-tvm-ffi==0.1.10.Design
The provider composes FlashInfer's TVM-FFI entry points:
top_k_first: top-k mask -> softmax -> top-p samplingjoint: softmax -> joint top-k/top-p samplingIndices are gathered into a contiguous FP32 logits matrix before sampling, preserving repeated/reordered indices and output batches that differ from the unique-logits batch. Two pinned host staging slots and CUDA events preserve asynchronous stream semantics; the provider-owned default workspace is sequenced across streams, while caller-provided workspace follows the existing Handle ownership contract.
The linked DSOs remain external dependencies under the existing linked-provider deployment contract. They are resolved at configure time and referenced through runtime paths; this PR does not bundle FlashInfer or TVM-FFI into InfiniOps wheels.
Validation
git diff --checkpassed.Known Boundary
An isolated C++ exact-external-workspace probe compiled, but its test container failed at the first standalone
cudaMallocbefore entering InfiniOps. The Python GPU matrix exercised the provider-owned workspace and stream path; exact external-workspace runtime remains a residual validation gap rather than an observed provider failure.Dependency
Stacked on #931, which adds exact implementation selection through consumer-owned
ops.json. After #931 merges, this PR can be rebased and retargeted tomaster.