@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / cd86fff38f
Fork 0

A high-throughput and memory-efficient inference and serving engine for LLMs

Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git

Synced Nov 9, 03:45 UTC

[BUGFIX] Fix hipErrorIllegalState in Qwen3-Omni during startup profiling allow inference Omni on ROCM (#33077)

Signed-off-by: JartX <sagformas@epdcenter.es>

JartX committed Feb 1, 2026 at 14:36 UTC cd86fff38feed579a22768ac9f9464360a0819fe
1 file changed +31 -7
vllm/model_executor/models/qwen3_omni_moe_thinker.py
+31 -7
@@ -907,13 +907,37 @@ class Qwen3Omni_VisionTransformer(nn.Module):
907 hidden_states = hidden_states + pos_embeds
908 rotary_pos_emb_cos, rotary_pos_emb_sin = self.rot_pos_emb(grid_thw)
909
910 - cu_seqlens = torch.repeat_interleave(
911 - grid_thw[:, 1] * grid_thw[:, 2], grid_thw[:, 0]
912 - ).cumsum(
913 - dim=0,
914 - dtype=grid_thw.dtype if torch.jit.is_tracing() else torch.int32,
915 - )
916 - cu_seqlens = F.pad(cu_seqlens, (1, 0), value=0)
910 + # RDNA3 (gfx11) specific bug workaround: torch.repeat_interleave triggers
911 + # kernel crashes. We attempt the operation and catch the RuntimeError
912 + # to switch to a vectorized cumsum + searchsorted approach.
913 + try:
914 + cu_seqlens = torch.repeat_interleave(
915 + grid_thw[:, 1] * grid_thw[:, 2], grid_thw[:, 0]
916 + ).cumsum(
917 + dim=0,
918 + dtype=grid_thw.dtype if torch.jit.is_tracing() else torch.int32,
919 + )
920 + cu_seqlens = F.pad(cu_seqlens, (1, 0), value=0)
921 + except RuntimeError:
922 + logger.warning(
923 + "torch.repeat_interleave not executable, "
924 + "switching to vectorized searchsorted implementation."
925 + )
926 + repeat_counts = grid_thw[:, 0]
927 + values = grid_thw[:, 1] * grid_thw[:, 2]
928 + repeat_cumsum = repeat_counts.cumsum(0)
929 + total_items = repeat_cumsum[-1].item()
930 +
931 + indices = torch.searchsorted(
932 + repeat_cumsum,
933 + torch.arange(total_items, device=grid_thw.device),
934 + right=True,
935 + )
936 + cu_seqlens = values[indices].cumsum(
937 + dim=0,
938 + dtype=grid_thw.dtype if torch.jit.is_tracing() else torch.int32,
939 + )
940 + cu_seqlens = F.pad(cu_seqlens, (1, 0), value=0)
941
942 hidden_states = hidden_states.unsqueeze(1)
943 rotary_pos_emb_cos = rotary_pos_emb_cos.to(hidden_states.device)