From 1d43b4b44402d32761e750443ff730a56a7e1dc0 Mon Sep 17 00:00:00 2001 From: Aryan Date: Sat, 16 May 2026 17:13:08 -0400 Subject: [PATCH] paged: handle 5-tuple return from FallbackKernel.process_kernel PyTorch added unbacked_bindings as a fifth return value from ir.FallbackKernel.process_kernel. The previous 4-value unpack caused a mypy error (and would cause a ValueError at runtime on newer torch). Use starred unpacking (*_) to consume the extra element, keeping compatibility with both old (4-tuple) and new (5-tuple) PyTorch versions. Fixes #40 --- fms_extras/utils/cache/paged.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/fms_extras/utils/cache/paged.py b/fms_extras/utils/cache/paged.py index a3235c7..37cf417 100644 --- a/fms_extras/utils/cache/paged.py +++ b/fms_extras/utils/cache/paged.py @@ -258,14 +258,12 @@ def has_side_effects(self): @classmethod def create(cls, kernel, *args, mutated_inputs=[], **kwargs) -> None: with V.graph.fake_mode: - ( - example_output, - tensor_args, - non_tensor_args, - unflatten_args, - ) = cls.process_kernel( - kernel, *args, **kwargs - ) # type: ignore + # process_kernel returns 5 values since PyTorch 2.x added + # unbacked_bindings as the fifth element; unpack with * to stay + # compatible across versions. + example_output, tensor_args, non_tensor_args, unflatten_args, *_ = ( + cls.process_kernel(kernel, *args, **kwargs) + ) for tensor_arg in tensor_args: tensor_arg.realize()