Fix Qwen3-Omni Talker sampler crash on FlashInfer 0.6.x#139
Open
zhudianGG wants to merge 2 commits into
Open
Conversation
The Talker / CodePredictor samplers pass per-request philox seed/offset as
int tensors, but FlashInfer 0.6.x reworked its sample-from-probs binding to
accept only a scalar int (or torch.Generator) and rejects a tensor at the
C/TVM-FFI layer ("Mismatched type on argument #7 ... ffi.Tensor"). This
crashes the Talker during CUDA-graph decode capture, so TTS cannot run on
FlashInfer 0.6.x even after the init-dtype fix (#138).
Add _flashinfer_accepts_tensor_seed(): probe the binding once (during eager
warmup, cached; never under capture) and route accordingly:
- non-graph path (sample_tokens) coerces tensor seed/offset to scalar ints
- CUDA-graph paths (sample_cuda_graphable_gpu, CudaGraphableSampler) pass a
fixed scalar int, NOT None -- None makes FlashInfer fall back to its
default CUDA generator, whose current_seed() read is illegal during graph
capture. These paths are deterministic=True so the seed value does not
affect captured output.
Validated end-to-end: launched qwen3omni_thinker_tp2 and ran the TTS
benchmark (text_to_speech, seed_tts, concurrency 1-32, request counts
12/20/24/40/80/160). Talker captures all graph configs, generates real audio
with 0 failures, and throughput matches the reference within +-10% at every
concurrency level.
Covers the Talker/CodePredictor sampler path that crashed on FlashInfer
0.6.x and had no automated coverage (the talker_prefill graph test only
checks hidden-state determinism, not the decode sampler):
- probe resolves to a concrete bool and caches
- _coerce_seed_offset passes scalars/None through untouched
- sample_tokens greedy with tensor seed returns the per-row argmax
- sample_cuda_graphable_gpu CAPTURES + REPLAYS under a real torch.cuda.graph
with tensor seed/offset buffers (the exact path that crashed) and the
replayed tokens match the static input's argmax
CUDA/FlashInfer-gated. Verified the graph-capture test fails on the
pre-fix sampler ("Mismatched type on argument #7 ... ffi.Tensor").
3ffd3f3 to
970dd34
Compare
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: Follow-up to #138. That PR fixed the Talker init-dtype crash but didn't exercise the Talker's CUDA-graph sampler, which still crashes on FlashInfer 0.6.x because the samplers pass tensor seed/offset (rejected by the reworked binding). Adds a one-time capability probe and routes graph paths to a scalar-int seed (not None, which trips an illegal current_seed() under capture).
Test plan: Launched qwen3omni_thinker_tp2 + TTS benchmark (seed_tts, concurrency 1–32, matched request counts 12/20/24/40/80/160). 0 failures, real audio, throughput within ±10% of reference at every level.