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 1, 20:00 UTC
[Bugfix] Fix `sequence_parallel_chunk_impl` custom op aliasing its input (#44130)
Signed-off-by: Vadim Gimpelson <vadim.gimpelson@gmail.com> Co-authored-by: Cursor <cursoragent@cursor.com>
Vadim Gimpelson committed
Jun 6, 2026 at 03:56 UTC
4765f0f189fd0cd032a79da37ba427c3ba60ec33
1 file changed
+4
-1
vllm/model_executor/models/utils.py
+4
-1
@@ -838,7 +838,10 @@ def sequence_parallel_chunk_impl(x: torch.Tensor) -> torch.Tensor:
838
839
chunk = y.shape[0] // tp_size
840
start = tp_rank * chunk
841
- return torch.narrow(y, 0, start, chunk)
841
+ out = torch.narrow(y, 0, start, chunk)
842
+ # narrow() returns a view; clone when it aliases the input (no-pad case),
843
+ # since a functional custom op must not return a view of an input.
844
+ return out.clone() if y is x else out
845
846
847
def sequence_parallel_chunk_impl_fake(x: torch.Tensor) -> torch.Tensor: