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 7, 06:30 UTC
[Feature][CI]: compare `func` & `no_func` outputs in test_functionalization.py (#35481)
Signed-off-by: Bhuminjay <bhuminjaysoni@gmail.com> Signed-off-by: Bhuminjay Soni <Soni5Happy@gmail.com> Co-authored-by: Luka Govedič <ProExpertProg@users.noreply.github.com>
Bhuminjay Soni committed
Mar 4, 2026 at 23:31 UTC
fb3e78ab095f48f7f1856176783d29b6652340cf
1 file changed
+7
-9
tests/compile/passes/test_functionalization.py
+7
-9
@@ -309,12 +309,15 @@ def test_fix_functionalization(
309
model = model_class()
310
inputs_func = model.example_inputs()
311
inputs_no_func = copy.deepcopy(inputs_func)
312
- model_func = model_class()
313
- model_no_func = copy.deepcopy(model_func)
312
+ model_func = copy.deepcopy(model)
313
+ model_no_func = copy.deepcopy(model)
314
model_func = torch.compile(model_func, backend=backend_func)
315
model_no_func = torch.compile(model_no_func, backend=backend_no_func)
316
- model_func(*inputs_func)
317
- model_no_func(*inputs_no_func)
316
+
317
+ # deepcopy inputs to prevent potential in place mutation
318
+ outputs_func = model_func(*copy.deepcopy(inputs_func))
319
+ outputs_no_func = model_no_func(*copy.deepcopy(inputs_no_func))
320
+ torch.testing.assert_close(outputs_func, outputs_no_func)
321
322
# check if the functionalization pass is applied
323
for op in model.ops_in_model(do_fusion):
@@ -332,8 +335,3 @@ def test_fix_functionalization(
335
found[op] = True
336
assert all(found[op] for op in model.ops_in_model(do_fusion))
337
assert all(not found.get(op) for op in model.ops_not_in_model())
335
-
336
- # TODO (Rohan138): compare the outputs from model_func and model_no_func
337
- # currently runs into errors while comparing `TestFusedAddRMSNorm`
338
- # Linked issue: https://github.com/vllm-project/vllm/issues/34996
339
- # torch.testing.assert_close(outputs_func, outputs_no_func)