From 9d6f0372e50ac29b1adda94d29646069acd85597 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 20 Aug 2025 13:31:41 +0000 Subject: [PATCH] Fix duplicate torch operation registrations in tests/compile Co-authored-by: ProExpertProg <11367180+ProExpertProg@users.noreply.github.com> --- tests/compile/piecewise/test_multiple_graphs.py | 4 ++-- tests/compile/piecewise/test_simple.py | 6 +++--- tests/compile/piecewise/test_toy_llama.py | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/compile/piecewise/test_multiple_graphs.py b/tests/compile/piecewise/test_multiple_graphs.py index e460d70951786..b71ae66d3fd28 100644 --- a/tests/compile/piecewise/test_multiple_graphs.py +++ b/tests/compile/piecewise/test_multiple_graphs.py @@ -19,7 +19,7 @@ from vllm.forward_context import set_forward_context from vllm.utils import direct_register_custom_op # create a library to hold the custom op -silly_lib = Library("silly", "FRAGMENT") # noqa +silly_lib = Library("silly_multiple", "FRAGMENT") # noqa BATCH_SIZE = 32 MLP_SIZE = 128 @@ -188,7 +188,7 @@ def test_ignore_torch_compile_decorator(): def forward(self, x: torch.Tensor) -> torch.Tensor: x = x + x attn_output = torch.empty_like(x) - torch.ops.silly.attention(x, x, x, attn_output) + torch.ops.silly_multiple.attention(x, x, x, attn_output) x = attn_output x = x * 3 return x diff --git a/tests/compile/piecewise/test_simple.py b/tests/compile/piecewise/test_simple.py index 2d1a72d44ec70..2920d2cdd7ae7 100644 --- a/tests/compile/piecewise/test_simple.py +++ b/tests/compile/piecewise/test_simple.py @@ -20,7 +20,7 @@ from vllm.utils import direct_register_custom_op global_counter = 0 # create a library to hold the custom op -silly_lib = Library("silly", "FRAGMENT") # noqa +silly_lib = Library("silly_simple", "FRAGMENT") # noqa def silly_attention(q: torch.Tensor, k: torch.Tensor, v: torch.Tensor, @@ -66,12 +66,12 @@ class SillyModel(nn.Module): x = x + 1 x = x + 2 out = torch.empty_like(x) - torch.ops.silly.attention(x, x, x, out) + torch.ops.silly_simple.attention(x, x, x, out) x = out x = x - 2 x = x - 1 out = torch.empty_like(x) - torch.ops.silly.attention(x, x, x, out) + torch.ops.silly_simple.attention(x, x, x, out) x = out x = x + 1 return x diff --git a/tests/compile/piecewise/test_toy_llama.py b/tests/compile/piecewise/test_toy_llama.py index bcfd0d834c5db..0e7ab819c65e8 100644 --- a/tests/compile/piecewise/test_toy_llama.py +++ b/tests/compile/piecewise/test_toy_llama.py @@ -24,7 +24,7 @@ from vllm.forward_context import BatchDescriptor, set_forward_context from vllm.utils import direct_register_custom_op # create a library to hold the custom op -silly_lib = Library("silly", "FRAGMENT") # noqa +silly_lib = Library("silly_toy_llama", "FRAGMENT") # noqa def silly_attention(q: torch.Tensor, k: torch.Tensor, v: torch.Tensor, @@ -160,7 +160,7 @@ class LlamaAttention(nn.Module): k = k + positions.unsqueeze(1) attn_output = torch.empty_like(q) - torch.ops.silly.attention(q, k, v, attn_output) + torch.ops.silly_toy_llama.attention(q, k, v, attn_output) output = self.output_projection(attn_output) return output