[Qwen3TTS][Bugfix] Guard inner CUDA graph replay during outer capture (#2910)

Signed-off-by: ChipMates <strasserm@chipmates.ai>
This commit is contained in:
ChipMates authored and GitHub committed 2026-04-21 23:04:54 -04:00
1 parent 7a34298743
commit e6cf26efb7
1 file changed
+9
@@ -141,6 +141,15 @@ class CUDAGraphDecoderWrapper:
if not self.enabled or not self._warmed_up or codes.shape[0] != 1:
return self.decoder(codes)
# Inner CUDA graph replay is illegal while an outer stream capture is
# active (e.g. vLLM's cudagraph_mode=FULL warmup on Stage 1). Fall back
# to eager in that case so the outer capture can complete. The guard is
# a no-op at runtime: is_current_stream_capturing() returns False
# outside the startup capture window, so normal inference still hits
# the graph fast path.
if torch.cuda.is_current_stream_capturing():
return self.decoder(codes)
actual_size = codes.shape[-1]
padded_size = self._get_padded_size(actual_size)