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, 10:00 UTC
[ez] Delete more torch version checks <= 2.8 (#33288)
Signed-off-by: angelayi <yiangela7@gmail.com>
Angela Yi committed
Jan 28, 2026 at 21:28 UTC
07ea184f00c1dc2dbc163efc7dc1ac91e98d9ed5
2 files changed
+22
-70
vllm/compilation/compiler_interface.py
+22
-66
@@ -375,14 +375,13 @@ class InductorAdaptor(CompilerInterface):
375
# it to get the hash of the compiled graph directly.
376
377
hash_str, file_path = None, None
378
- from torch._inductor.codecache import FxGraphCache, compiled_fx_graph_hash
378
+ from torch._inductor.codecache import compiled_fx_graph_hash
379
380
- if torch.__version__.startswith("2.5"):
381
- original_load = FxGraphCache.load
382
- original_load_name = "torch._inductor.codecache.FxGraphCache.load"
383
-
384
- def hijack_load(*args: Any, **kwargs: Any) -> Any:
385
- inductor_compiled_graph = original_load(*args, **kwargs)
380
+ def hijacked_compile_fx_inner(*args: Any, **kwargs: Any) -> Any:
381
+ output = torch._inductor.compile_fx.compile_fx_inner(*args, **kwargs)
382
+ nonlocal hash_str
383
+ inductor_compiled_graph = output
384
+ if inductor_compiled_graph is not None:
385
nonlocal file_path
386
compiled_fn = inductor_compiled_graph.current_callable
387
file_path = compiled_fn.__code__.co_filename # noqa
@@ -395,44 +394,14 @@ class InductorAdaptor(CompilerInterface):
394
for cell in compiled_fn.__closure__:
395
if not callable(cell.cell_contents):
396
continue
398
- if cell.cell_contents.__code__.co_filename.startswith(
399
- self.base_cache_dir
400
- ):
401
- # this is the real file path compiled from Inductor
402
- file_path = cell.cell_contents.__code__.co_filename
397
+ code = cell.cell_contents.__code__
398
+ if code.co_filename.startswith(self.base_cache_dir):
399
+ # this is the real file path
400
+ # compiled from Inductor
401
+ file_path = code.co_filename
402
break
404
- return inductor_compiled_graph
405
-
406
- hijacked_compile_fx_inner = torch._inductor.compile_fx.compile_fx_inner # noqa
407
- elif torch.__version__ >= "2.6":
408
- # function renamed in 2.6
409
- original_load_name = None
410
-
411
- def hijacked_compile_fx_inner(*args: Any, **kwargs: Any) -> Any:
412
- output = torch._inductor.compile_fx.compile_fx_inner(*args, **kwargs)
413
- nonlocal hash_str
414
- inductor_compiled_graph = output
415
- if inductor_compiled_graph is not None:
416
- nonlocal file_path
417
- compiled_fn = inductor_compiled_graph.current_callable
418
- file_path = compiled_fn.__code__.co_filename # noqa
419
- if (
420
- not file_path.startswith(self.base_cache_dir)
421
- and compiled_fn.__closure__ is not None
422
- ):
423
- # hooked in the align_inputs_from_check_idxs function
424
- # in torch/_inductor/utils.py
425
- for cell in compiled_fn.__closure__:
426
- if not callable(cell.cell_contents):
427
- continue
428
- code = cell.cell_contents.__code__
429
- if code.co_filename.startswith(self.base_cache_dir):
430
- # this is the real file path
431
- # compiled from Inductor
432
- file_path = code.co_filename
433
- break
434
- hash_str = inductor_compiled_graph._fx_graph_cache_key
435
- return output
403
+ hash_str = inductor_compiled_graph._fx_graph_cache_key
404
+ return output
405
406
def hijack_compiled_fx_graph_hash(*args: Any, **kwargs: Any) -> Any:
407
out = compiled_fx_graph_hash(*args, **kwargs)
@@ -453,10 +422,6 @@ class InductorAdaptor(CompilerInterface):
422
return AlwaysHitShapeEnv()
423
424
with ExitStack() as stack:
456
- # hijack to get the compiled graph itself
457
- if original_load_name is not None:
458
- stack.enter_context(patch(original_load_name, hijack_load))
459
-
425
# for hijacking the hash of the compiled graph
426
stack.enter_context(
427
patch(
@@ -573,25 +538,16 @@ class InductorAdaptor(CompilerInterface):
538
# Dynamo metrics context, see method for more details.
539
exit_stack.enter_context(self.metrics_context())
540
576
- if torch.__version__.startswith("2.5"):
577
- inductor_compiled_graph = FxGraphCache._lookup_graph(
578
- hash_str, example_inputs, True, False
579
- )
580
- assert inductor_compiled_graph is not None, (
581
- "Inductor cache lookup failed. Please remove "
582
- f"the cache directory and try again." # noqa
583
- )
584
- elif torch.__version__ >= "2.6":
585
- from torch._inductor.output_code import CompiledFxGraphConstantsWithGm
541
+ from torch._inductor.output_code import CompiledFxGraphConstantsWithGm
542
587
- constants = CompiledFxGraphConstantsWithGm(graph)
588
- inductor_compiled_graph, _ = FxGraphCache._lookup_graph(
589
- hash_str, example_inputs, True, None, constants
590
- )
591
- assert inductor_compiled_graph is not None, (
592
- "Inductor cache lookup failed. Please remove "
593
- f"the cache directory and try again." # noqa
594
- )
543
+ constants = CompiledFxGraphConstantsWithGm(graph)
544
+ inductor_compiled_graph, _ = FxGraphCache._lookup_graph(
545
+ hash_str, example_inputs, True, None, constants
546
+ )
547
+ assert inductor_compiled_graph is not None, (
548
+ "Inductor cache lookup failed. Please remove "
549
+ f"the cache directory and try again." # noqa
550
+ )
551
552
# Inductor calling convention (function signature):
553
# f(list) -> tuple
vllm/model_executor/layers/quantization/kernels/scaled_mm/pytorch.py
-4
@@ -3,7 +3,6 @@
3
4
5
import torch
6
-from packaging import version
6
7
from vllm.config import CompilationMode, get_current_vllm_config
8
from vllm.platforms import current_platform
@@ -98,9 +97,6 @@ class RowWiseTorchFP8ScaledMMLinearKernel(TorchFP8ScaledMMLinearKernel):
97
if compute_capability is not None and compute_capability < 94:
98
return False, "requires compute capability 94 and above."
99
101
- if not version.parse(torch.__version__) >= version.parse("2.7"):
102
- return False, "requires pytorch version >=2.7."
103
-
100
return True, None
101
102
@classmethod